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)
    }
  ],

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

string

可选。用于配额和结算的 Google Cloud 项目。

messages[]

object (Message)

必需。当前对话的内容。

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

object (Context)

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

conversationReference

object (ConversationReference)

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

dataAgentContext

object (DataAgentContext)

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

响应正文

如果成功,响应正文将包含 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

object (Credentials)

可选。调用 Looker 数据源时要使用的凭证。

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

contextVersion

enum (ContextVersion)

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

ContextVersion

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

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