Method: projects.locations.collections.dataConnector.buildActionInvocation

使用 DataConnector 构建操作调用。

HTTP 请求

POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/dataConnector}:buildActionInvocation

网址采用 gRPC 转码语法。

路径参数

参数
name

string

必需。DataConnector 资源。

用于构建操作调用的数据连接器。

请求正文

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

JSON 表示法
{
  "actionName": string,
  "languageCode": string
}
字段
actionName

string

必需。操作的名称。

例如:“send_email”

languageCode

string

可选。用于状态和错误消息的语言。

响应正文

DataConnectorService.BuildActionInvocation 方法的响应。

如果成功,响应正文将包含结构如下的数据:

JSON 表示法
{
  "actionInvocation": {
    object (ActionInvocation)
  }
}
字段
actionInvocation

object (ActionInvocation)

操作调用。

授权范围

需要以下 OAuth 范围之一:

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

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

IAM 权限

需要拥有 name 资源的以下 IAM 权限:

  • discoveryengine.dataConnectors.buildActionInvocation

如需了解详情,请参阅 IAM 文档

ActionInvocation

表示操作调用。

JSON 表示法
{
  "agentName": string,
  "actionName": string,
  "args": {
    object
  },
  "dataConnector": string,
  "dataSource": string,
  "invocationId": string,
  "actionDisplayName": string,
  "userConfirmationMessage": string,
  "authorizationUrl": string,
  "resendQueryOnUserAuthorization": boolean,
  "parameterDeclaration": {
    object
  },
  "argSetCandidates": [
    {
      object
    }
  ]
}
字段
agentName

string

可选。执行操作的代理的名称。

actionName

string

操作的名称。

例如:“send_email”

args

object (Struct format)

操作的具名实参。

例如:{"recipient": "tom@...", "subject": ... }

向用户提供时,此部分可能可供修改。

如果操作实参有多个选项(例如,日历活动有多个可能的时间段),则此字段描述第一个选项。

dataConnector

string

DataConnector 资源。

用于执行操作的数据连接器。

dataSource

string

仅限输出。数据源的名称。

invocationId

string

仅限输出。操作调用 ID。

actionDisplayName

string

仅限输出。向用户显示的操作的简明易懂的名称。

userConfirmationMessage

string

仅限输出。向用户显示的易于理解的消息,与确认对话框一起显示。

authorizationUrl

string

仅限输出。授权网址。

resendQueryOnUserAuthorization

boolean

仅限输出。如果为 true,则调用者必须在用户授权后重新发送查询。

parameterDeclaration

object (Struct format)

仅限输出。操作参数的说明,包括呈现/验证信息。其格式基于 OpenAPI 的参数规范。基于:https://swagger.io/docs/specification/describing-parameters/

示例

{
    "type": "object",
    "properties": {
        "title": {
            "type": "string",
            "description": "title of the event",
        },
        "startTime": {
            "type": "string",
            "format": "date-time",
            "description": (
                "Start time of the meeting, e.g. 2024-07-12T23:30"
            ),
        },
        "attendees": {
            "type": "array",
            "items": {"type": "string", "format": "email"},
            "description": "List of email addresses of attendees",
        },
        "duration": {
            "type": "integer",
            "format": "int32",
            "minimum": 5,
            "maximum": 240,
            "default": { "numberValue": 30 },
            "description": (
                "Duration of the meeting in minutes. Defaults to 30"
                " minutes."
            ),
        },
        "timezone": {
            "type": "string",
            "description": (
                'IANA time Zone Database name, e.g. "Europe/Zurich". If'
                " omitted, timezone of the user will be used"
            ),
        },
        "eventType": {
            "type": "string",
            "enum": ["meeting", "focus_time", "out_of_office", "task"],
            "description": "type of the event",
        },
    },
    "required": ["startTime", "title", "attendees"]
}
argSetCandidates[]

object (Struct format)

仅限输出。如果操作实参有多个选项(例如,日历活动有多个可能的时间段),则此字段中会列出这些额外的实参候选选项。

包含一组实参,每个实参的格式都与 args 字段类似。实参集仅包含与 args 字段不同的实参。向用户提供这些值时,用户可能可以修改这些值。

例如:

args 包含第一个选项以及所有实参:

{"title": "Meeting with John", "startTime": "2024-08-01T13:30", ... }

argSetCandidates 包含其余选项,但仅填充不同的实参:

[{ "startTime": "2024-08-01T14:00" }, { "startTime": "2024-08-01T14:30" }, { "startTime": "2024-08-01T15:30" }]