Link Search Menu Expand Document Documentation Menu

执行代理

2.13 版本引入

执行代理时,它会运行配置的工具。从 OpenSearch 3.0 版本开始,您可以通过将 async 查询参数设置为 true 来异步执行代理。

端点

POST /_plugins/_ml/agents/<agent_id>/_execute

查询参数

下表列出了可用的查询参数。

参数 数据类型 必需/可选 描述
async 布尔型 可选 如果为 true,则异步执行代理并返回一个 task_id 以跟踪执行。要检查任务状态,请使用任务 API。默认值为 false

请求正文字段

下表列出了可用的请求字段。

字段 数据类型 必需/可选 描述
parameters 对象 必需 代理所需的参数。
parameters.verbose 布尔型 可选 提供详细输出。

请求示例

POST /_plugins/_ml/agents/879v9YwBjWKCe6Kg12Tx/_execute
{
  "parameters": {
    "question": "what's the population increase of Seattle from 2021 to 2023"
  }
}

示例响应

{
  "inference_results": [
    {
      "output": [
        {
          "result": """ Based on the given context, the key information is:

The metro area population of Seattle in 2021 was 3,461,000.
The metro area population of Seattle in 2023 is 3,519,000.

To calculate the population increase from 2021 to 2023:

Population in 2023 (3,519,000) - Population in 2021 (3,461,000) = 58,000

Therefore, the population increase of Seattle from 2021 to 2023 is 58,000."""
        }
      ]
    }
  ]
}
剩余 350 字符

有问题?

想要贡献?