对话流程智能体
2.13 版本引入
与流代理类似,会话流代理配置有一组按顺序运行的工具。它们之间的区别在于,会话流代理将对话存储在索引中,在以下示例中是 conversation_index
。以下代理运行 VectorDBTool
,然后运行 MLModelTool
。
POST /_plugins/_ml/agents/_register
{
"name": "population data analysis agent",
"type": "conversational_flow",
"description": "This is a demo agent for population data analysis",
"app_type": "rag",
"memory": {
"type": "conversation_index"
},
"tools": [
{
"type": "VectorDBTool",
"name": "population_knowledge_base",
"parameters": {
"model_id": "YOUR_TEXT_EMBEDDING_MODEL_ID",
"index": "test_population_data",
"embedding_field": "population_description_embedding",
"source_field": [
"population_description"
],
"input": "${parameters.question}"
}
},
{
"type": "MLModelTool",
"name": "bedrock_claude_model",
"description": "A general tool to answer any question",
"parameters": {
"model_id": "YOUR_LLM_MODEL_ID",
"prompt": """
Human:You are a professional data analyst. You will always answer 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 don't know.
Context:
${parameters.population_knowledge_base.output:-}
${parameters.chat_history:-}
Human:${parameters.question}
Assistant:"""
}
}
]
}
有关注册代理 API 请求字段的更多信息,请参阅请求体字段。
有关分步教程,请参阅代理和工具教程。
后续步骤
- 要了解有关注册代理的更多信息,请参阅注册代理 API。
- 有关支持的工具列表,请参阅工具。
- 有关分步教程,请参阅代理和工具教程。
- 有关支持的 API,请参阅代理 API。
- 要在配置自动化中使用代理和工具,请参阅自动化配置。