流程智能体
2.13 版本引入
流代理配置了一组按顺序运行的工具。例如,以下代理先运行 VectorDBTool
,然后运行 MLModelTool
。代理协调这些工具,使一个工具的输出可以成为另一个工具的输入。在此示例中,VectorDBTool
查询 k-NN 索引,代理将其输出 ${parameters.VectorDBTool.output}
作为上下文以及 ${parameters.question}
(参见 prompt
参数)传递给 MLModelTool
。
POST /_plugins/_ml/agents/_register
{
"name": "Test_Agent_For_RAG",
"type": "flow",
"description": "this is a test agent",
"tools": [
{
"type": "VectorDBTool",
"parameters": {
"model_id": "YOUR_TEXT_EMBEDDING_MODEL_ID",
"index": "my_test_data",
"embedding_field": "embedding",
"source_field": ["text"],
"input": "${parameters.question}"
}
},
{
"type": "MLModelTool",
"description": "A general tool to answer any question",
"parameters": {
"model_id": "YOUR_LLM_MODEL_ID",
"prompt": "\n\nHuman:You are a professional data analyst. You will always answer a question based on the given context first. If the answer is not directly shown in the context, you will analyze the data and find the answer. If you don't know the answer, just say you don't know. \n\n Context:\n${parameters.VectorDBTool.output}\n\nHuman:${parameters.question}\n\nAssistant:"
}
}
]
}
有关注册代理 API 请求字段的更多信息,请参阅请求体字段。
有关分步教程,请参阅代理和工具教程。
后续步骤
- 要了解有关注册代理的更多信息,请参阅注册代理 API。
- 有关支持的工具列表,请参阅工具。
- 有关分步教程,请参阅代理和工具教程。
- 有关支持的 API,请参阅代理 API。
- 要在配置自动化中使用代理和工具,请参阅自动化配置。