类 ReActAgent
java.lang.Object
com.agentsflex.core.agent.react.ReActAgent
- 所有已实现的接口:
IAgent
ReActAgent 是一个通用的 ReAct 模式 Agent,支持 Reasoning + Action 的交互方式。
-
字段概要
字段修饰符和类型字段说明private final ChatModelprivate ChatOptionsprivate static final intprivate static final Stringprivate final List<ReActAgentListener>private static final org.slf4j.Loggerprivate final MemoryPromptprivate ReActMessageBuilderstatic final Stringprivate ReActStepParserprivate final ReActAgentStateprivate final List<ToolInterceptor> -
构造器概要
构造器构造器说明ReActAgent(ChatModel chatModel, List<Tool> tools, ReActAgentState state) ReActAgent(ChatModel chatModel, List<Tool> tools, String userQuery) ReActAgent(ChatModel chatModel, List<Tool> tools, String userQuery, MemoryPrompt memoryPrompt) -
方法概要
修饰符和类型方法说明voidaddListener(ReActAgentListener listener) 注册监听器voidaddToolInterceptor(ToolInterceptor interceptor) voidexecute()运行 ReAct Agent 流程private StringextractRequestQuestion(String content) getState()getTools()private booleanisFinalAnswer(String content) private booleanisReActAction(String content) private booleanisRequestUserInput(String content) booleanprivate voidnotifyOnActionEnd(ReActStep reActStep, Object result) private voidprivate voidnotifyOnActionNotMatched(ReActStep step, List<Tool> tools) private voidnotifyOnActionStart(ReActStep reActStep) private voidnotifyOnChatResponse(AiMessageResponse response) private voidnotifyOnChatResponseStream(StreamContext context, AiMessageResponse response) private voidprivate voidnotifyOnFinalAnswer(String finalAnswer) private voidprivate voidnotifyOnNonActionResponse(AiMessageResponse response) private voidprivate voidnotifyOnRequestUserInput(String question) private voidnotifyOnStepParseError(String content) private booleanprocessReActSteps(String content) voidremoveListener(ReActAgentListener listener) 移除监听器voidsetChatOptions(ChatOptions chatOptions) voidsetMessageBuilder(ReActMessageBuilder messageBuilder) voidsetReActStepParser(ReActStepParser reActStepParser) voidsetStreamable(boolean streamable) private voidprivate void
-
字段详细资料
-
构造器详细资料
-
ReActAgent
-
ReActAgent
public ReActAgent(ChatModel chatModel, List<Tool> tools, String userQuery, MemoryPrompt memoryPrompt) -
ReActAgent
-
-
方法详细资料
-
addListener
注册监听器 -
removeListener
移除监听器 -
addToolInterceptor
-
getToolInterceptors
-
getChatModel
-
getTools
-
getReActStepParser
-
setReActStepParser
-
getListeners
-
isStreamable
-
setStreamable
-
getMemoryPrompt
-
getMessageBuilder
-
setMessageBuilder
-
getChatOptions
-
setChatOptions
-
getState
-
execute
运行 ReAct Agent 流程 -
startNextReactStepNormal
-
startNextReActStepStream
-
isFinalAnswer
-
isReActAction
-
isRequestUserInput
-
extractRequestQuestion
-
processReActSteps
-
notifyOnChatResponse
-
notifyOnNonActionResponse
-
notifyOnNonActionResponseStream
-
notifyOnChatResponseStream
-
notifyOnFinalAnswer
-
notifyOnRequestUserInput
-
notifyOnActionStart
-
notifyOnActionEnd
-
notifyOnMaxIterationsReached
-
notifyOnStepParseError
-
notifyOnActionNotMatched
-
notifyOnActionInvokeError
-
notifyOnError
-