REST Resource: projects.locations.collections.engines.assistants

资源:助理

Discovery Engine Assistant 资源。

JSON 表示法
{
  "name": string,
  "displayName": string,
  "description": string,
  "generationConfig": {
    object (GenerationConfig)
  },
  "googleSearchGroundingEnabled": boolean,
  "webGroundingType": enum (WebGroundingType),
  "enabledActions": {
    string: {
      object (ActionList)
    },
    ...
  },
  "enabledTools": {
    string: {
      object (ToolList)
    },
    ...
  },
  "customerPolicy": {
    object (CustomerPolicy)
  }
}
字段
name

string

不可变。助理的资源名称。格式:projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}

它必须是采用 UTF-8 编码的字符串,长度限制为 1024 个字符。

displayName

string

必需。助理的显示名称。

必须是采用 UTF-8 编码的字符串,长度限制为 128 个字符。

description

string

可选。其他信息的说明。预计会显示在配置界面上,而不是显示给助理的用户。

generationConfig

object (GenerationConfig)

可选。用于生成助理回答的配置。

googleSearchGroundingEnabled
(deprecated)

boolean

可选。已弃用。请改用 webGroundingType

webGroundingType

enum (WebGroundingType)

可选。要使用的网页接地类型。

enabledActions
(deprecated)

map (key: string, value: object (ActionList))

可选。已弃用:将改为使用 enabledTools。相应助理上已启用的操作。键是连接器名称,例如“projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector”。值包含针对连接器实例的管理员启用操作。管理员可以选择性地针对其在项目中创建的任何连接器实例启用多项操作。例如 {"jira1ConnectorName": [(actionId1, "createTicket"), (actionId2, "transferTicket")], "gmail1ConnectorName": [(actionId3, "sendEmail"),..] }

enabledTools

map (key: string, value: object (ToolList))

可选。注意:尚未实现。请改用 enabledActions。相应助理上已启用的工具。键是连接器名称,例如“projects/{projectId}/locations/{locationId}/collections/{collectionId}/dataconnector”。值包含针对连接器实例的管理员启用工具。管理员可以选择性地在项目中创建的任何连接器实例上启用多个工具。例如 {"jira1ConnectorName": [(toolId1, "createTicket"), (toolId2, "transferTicket")], "gmail1ConnectorName": [(toolId3, "sendEmail"),..] }

customerPolicy

object (CustomerPolicy)

可选。Google 助理的客户政策。

GenerationConfig

用于生成助理回答的配置。

JSON 表示法
{
  "systemInstruction": {
    object (SystemInstruction)
  },
  "defaultLanguage": string
}
字段
systemInstruction

object (SystemInstruction)

系统指令,也称为 LLM 调用的提示序言。另请参阅 https://cloud.google.com/vertex-ai/generative-ai/docs/learn/prompts/system-instructions

defaultLanguage

string

用于生成助理回答的默认语言。使用 ISO 639-1 语言代码,例如 en。如果未指定,系统将自动检测语言。

SystemInstruction

系统指令,也称为 LLM 调用的提示序言。

JSON 表示法
{
  "additionalSystemInstruction": string
}
字段
additionalSystemInstruction

string

可选。将添加到默认系统指令的其他系统指令。

WebGroundingType

要使用的网页接地类型。

枚举
WEB_GROUNDING_TYPE_UNSPECIFIED 默认的未指定设置。这与“已停用”相同。
WEB_GROUNDING_TYPE_DISABLED 网页接地已停用。

ActionList

已弃用:将替换为 ToolList。连接器上已启用的操作

JSON 表示法
{
  "actionInfo": [
    {
      object (ActionInfo)
    }
  ]
}
字段
actionInfo[]

object (ActionInfo)

包含相应操作信息的行动列表。

ActionInfo

已弃用:将替换为 ToolInfo。用于标识操作的信息。

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

string

由 DataConnectorService.QueryAvailableActions 定义的操作的名称。

actionDisplayName

string

操作的显示名称。

ToolList

连接器上已启用的工具

JSON 表示法
{
  "toolInfo": [
    {
      object (ToolInfo)
    }
  ]
}
字段
toolInfo[]

object (ToolInfo)

包含相应工具信息的工具列表。

ToolInfo

用于标识工具的信息。

JSON 表示法
{
  "toolName": string,
  "toolDisplayName": string
}
字段
toolName

string

工具的名称,由 DataConnectorService.QueryAvailableActions 定义。注意:DataConnectorService API 中使用的是 action,但它们与此处的 tool 相同。

toolDisplayName

string

工具的显示名称。

CustomerPolicy

客户为助理定义的政策。

JSON 表示法
{
  "bannedPhrases": [
    {
      object (BannedPhrase)
    }
  ],
  "modelArmorConfig": {
    object (ModelArmorConfig)
  }
}
字段
bannedPhrases[]

object (BannedPhrase)

可选。禁用短语列表。

modelArmorConfig

object (ModelArmorConfig)

可选。用于清理用户提示和助理回答的 Model Armor 配置。

BannedPhrase

客户自定义的违禁短语的定义。用户查询或 LLM 回答中不得出现违禁短语,否则系统会拒绝回答。

JSON 表示法
{
  "phrase": string,
  "matchType": enum (BannedPhraseMatchType),
  "ignoreDiacritics": boolean
}
字段
phrase

string

必需。要禁止的原始字符串内容。

matchType

enum (BannedPhraseMatchType)

可选。违禁短语的匹配类型。

ignoreDiacritics

boolean

可选。如果值为 true,则在匹配违禁短语时忽略变音符号(例如,重音符号、元音变音)。例如,“cafe”会与“café”匹配。

BannedPhraseMatchType

禁用短语的匹配方法。

枚举
BANNED_PHRASE_MATCH_TYPE_UNSPECIFIED 默认值为 SIMPLE_STRING_MATCH。
SIMPLE_STRING_MATCH 如果禁止的短语作为确切的子字符串出现在文本中的任何位置,则匹配成功。
WORD_BOUNDARY_STRING_MATCH 只有当文本中找到的模式被字词分隔符包围时,禁止使用的短语才会匹配。词组本身可能仍包含字词分隔符。

ModelArmorConfig

客户定义的 Model Armor 模板的配置,用于清理用户提示和助理回答。

JSON 表示法
{
  "userPromptTemplate": string,
  "responseTemplate": string,
  "failureMode": enum (FailureMode)
}
字段
userPromptTemplate

string

可选。用于清理用户提示的 Model Armor 模板的资源名称。格式:projects/{project}/locations/{location}/templates/{templateId}

如果未指定,则不会对用户提示进行清理。

responseTemplate

string

可选。用于清理助理回答的 Model Armor 模板的资源名称。格式:projects/{project}/locations/{location}/templates/{templateId}

如果未指定,则不会对 Google 助理的回答进行清理。

failureMode

enum (FailureMode)

可选。定义 Model Armor 清理的失败模式。

FailureMode

确定 Model Armor 无法处理请求时的行为。

枚举
FAILURE_MODE_UNSPECIFIED 未指定的故障模式,默认行为为 FAIL_CLOSED
FAIL_OPEN 如果 Model Armor 处理失败,允许继续执行该请求,而无需进行任何更改。
FAIL_CLOSED 如果 Model Armor 处理失败,则拒绝该请求。

方法

assist

协助用户进行查询。

create

创建 Assistant

delete

删除 Assistant

get

获取 Assistant

list

列出 Engine 下的所有 Assistant

patch

更新 Assistant

streamAssist

以流式方式协助用户进行查询。