Method: projects.locations.chat

通过生成 Message 对象的数据流来回答数据问题。

HTTP 请求

POST https://geminidataanalytics.googleapis.com/v1beta/{parent=projects/*/locations/*}:chat

网址采用 gRPC 转码语法。

路径参数

参数
parent

string

必需。聊天请求的父级值。格式:projects/{project}/locations/{location}

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "project": string,
  "messages": [
    {
      object (Message)
    }
  ],
  "credentials": {
    object (Credentials)
  },
  "thinkingMode": enum (ThinkingMode),
  "model": enum (Model),

  // Union field context_provider can be only one of the following:
  "inlineContext": {
    object (Context)
  },
  "conversationReference": {
    object (ConversationReference)
  },
  "dataAgentContext": {
    object (DataAgentContext)
  },
  "clientManagedResourceContext": {
    object (ClientManagedResourceContext)
  }
  // End of list of possible types for union field context_provider.

  // Union field datasource_settings can be only one of the following:
  "lookerSettings": {
    object (LookerSettings)
  }
  // End of list of possible types for union field datasource_settings.
}
字段
project
(deprecated)

string

可选。已弃用:请改用 parent 字段。用于配额和结算的 Google Cloud 项目。

messages[]

object (Message)

必需。当前对话的内容。

credentials

object (Credentials)

可选。调用上下文中指定的数据源时要使用的凭据。

此字段可用于为各种数据源提供凭据。例如,连接到 Looker 时,目前基于 OAuth 令牌的凭据和基于 API 密钥的凭据都支持,如向 SDK 进行身份验证中所述。

thinkingMode

enum (ThinkingMode)

可选。代理循环要使用的思考模式。如果未指定,则默认为 THINKING_MODE_UNSPECIFIED。

model

enum (Model)

可选。代理循环在处理请求时要使用的模型。此设置仅在未设置 context.options.model 时有效。

联合字段 context_provider。聊天请求的上下文提供方。它可以是以下任一值:inline_context(在请求中以内嵌方式提供的上下文)、data_agent(对数据代理资源的引用)、conversation_reference(使用 conversation_id 和 agent_id 对持久性对话和上下文的引用)。context_provider 只能是下列其中一项:
inlineContext

object (Context)

可选。聊天请求的内嵌上下文。使用此项可通过以内嵌方式传递所有上下文,以无状态方式(没有托管式对话持久性和代理)进行聊天。

conversationReference

object (ConversationReference)

可选。对持久性对话和代理上下文的引用。使用此项可借助托管式对话持久性与代理聊天。

dataAgentContext

object (DataAgentContext)

可选。聊天请求的上下文。使用此项可在没有托管式对话持久性的情况下,以无状态方式与代理聊天。

clientManagedResourceContext

object (ClientManagedResourceContext)

可选。具有客户端管理资源的上下文。部分客户端可能不会使用 GDA 管理的资源(包括对话和代理),而是会创建和管理自己的对话和代理资源。

联合字段 datasource_settings。用于自定义请求行为的可选设置,特定于目标数据源。datasource_settings 只能是下列其中一项:
lookerSettings

object (LookerSettings)

可选。Looker 特定设置。

响应正文

如果成功,响应正文将包含 Message 实例数据流。

授权范围

需要以下 OAuth 范围:

  • https://www.googleapis.com/auth/cloud-platform

如需了解详情,请参阅 Authentication Overview

ConversationReference

对持久性对话和代理上下文的引用。

JSON 表示法
{
  "conversation": string,
  "dataAgentContext": {
    object (DataAgentContext)
  }
}
字段
conversation

string

必需。对话资源的名称。格式:projects/{project}/locations/{location}/conversations/{conversationId}

dataAgentContext

object (DataAgentContext)

必需。使用数据代理进行的聊天请求的上下文。

DataAgentContext

使用数据代理进行的聊天请求的上下文。

JSON 表示法
{
  "dataAgent": string,
  "credentials": {
    object (Credentials)
  },
  "contextVersion": enum (ContextVersion)
}
字段
dataAgent

string

必需。数据代理资源的名称。

credentials
(deprecated)

object (Credentials)

可选。已弃用:请改用 ChatRequest 中的凭据。调用 Looker 数据源时要使用的凭证。

目前,基于 OAuth 令牌的凭证和基于 API 密钥的凭证都支持,如向 SDK 进行身份验证中所述。

contextVersion

enum (ContextVersion)

可选。DCS 要使用的上下文版本(例如 STAGING、PUBLISHED)

ContextVersion

DCS 支持的上下文版本列表。上下文有两种版本。这用于维护数据代理的版本控制。

枚举
CONTEXT_VERSION_UNSPECIFIED 未指定或无法识别。
STAGING 使用此版本时,DCS 会将最新的暂存上下文用于数据代理。
PUBLISHED 使用此版本时,DCS 会将最新的已发布上下文用于数据代理。

ClientManagedResourceContext

具有客户端管理资源的上下文。部分客户端可能不会使用 GDA 管理的资源(包括对话和代理),而是会创建和管理自己的对话和代理资源。

JSON 表示法
{
  "inlineContext": {
    object (Context)
  },
  "conversationId": string,
  "agentId": string
}
字段
inlineContext

object (Context)

必需。聊天请求的上下文。使用此字段可通过以内嵌方式传递所有上下文,在没有 GDA API 管理的对话和代理持久性的情况下进行对话。

conversationId

string

可选。客户端管理的对话 ID。

agentId

string

可选。客户端管理的代理 ID。

LookerSettings

用于保存 Looker 特定自定义设置的消息。

JSON 表示法
{
  "enableDevMode": boolean
}
字段
enableDevMode

boolean

可选。是否在 Looker 的开发模式下运行。如果为 true,API 会话将切换到“dev”工作区,以便与用户开发分支中的 LookML 更改进行交互。如果为 false 或未设置,会话将保持默认状态(生产模式)。请参阅 https://cloud.google.com/looker/docs/dev-mode-prod-mode

ThinkingMode

代理的思考模式。

枚举
THINKING_MODE_UNSPECIFIED 未指定的思考模式,代理将默认使用 THINKING 模式,但 BigQuery 用户默认使用 FAST 模式。
FAST 快速模式,快速回答。
THINKING 思考模式,解决复杂问题。

Model

为 BigQuery 用户选择代理模型。

枚举
MODEL_UNSPECIFIED 未指定任何模型。可以使用预览版模型或非预览版模型。
LATEST_GA_MODEL 使用最新的非预览版模型。这可能会限制某些请求级设置。