public interface Agent
| Modifier and Type | Method and Description |
|---|---|
void |
addListener(AgentListener agentListener)
添加一个Agent监听器
|
void |
addTool(Tool tool)
为Agent添加工具
|
void |
clearTool()
删除所有工具
|
int |
getMaxIterations()
获取最大迭代次数
|
Tool |
getTool(String toolId)
获取一个工具
|
void |
removeTool(String toolId)
删除一个工具
|
AgentSession |
run(AgentSession agentSession)
递归执行Agent,直到完成所有步骤的执行
|
AgentSession |
run(List<ConversationMessage> messages)
递归执行Agent,直到完成所有步骤的执行
|
AgentSession |
run(String query)
递归执行Agent,直到完成所有步骤的执行
|
AgentSession |
runStep(AgentSession agentSession)
单步执行Agent,提供干预能力
|
void |
setMaxIterations(int iterations)
设置最大迭代次数
|
void |
setStreamCallback(StreamAgentCallBack streamAgentCallback)
设置流式接口回调函数(基于event)
|
void |
setToolRetriever(ToolRetriever toolRetriever)
设置工具检索器
|
void addTool(Tool tool)
tool - Toolvoid removeTool(String toolId)
toolId - 工具IDvoid clearTool()
AgentSession run(String query)
query - 用户的输入AgentSession run(List<ConversationMessage> messages)
messages - 用户的输入,包含会话历史AgentSession run(AgentSession agentSession)
agentSession - 初始状态或运行中状态的agentSession,包括历史消息及其执行步骤,可以使用AgentSessionHelper类辅助处理AgentSession runStep(AgentSession agentSession)
agentSession - 初始状态或运行中状态的agentSession,包括历史消息及其执行步骤,可以使用AgentSessionHelper类辅助处理void addListener(AgentListener agentListener)
agentListener - Agent监听器void setMaxIterations(int iterations)
iterations - 次数int getMaxIterations()
void setToolRetriever(ToolRetriever toolRetriever)
toolRetriever - 工具检索器void setStreamCallback(StreamAgentCallBack streamAgentCallback)
streamAgentCallback - 事件流回调Copyright © 2024. All rights reserved.