Class ReactAgentBuilder<B extends ReactAgentBuilder<B,State>,State extends MessagesState<org.springframework.ai.chat.messages.Message>>
java.lang.Object
org.bsc.langgraph4j.spring.ai.agent.ReactAgentBuilder<B,State>
- Direct Known Subclasses:
AgentExecutorEx.Builder,ReactAgent.Builder
public abstract class ReactAgentBuilder<B extends ReactAgentBuilder<B,State>,State extends MessagesState<org.springframework.ai.chat.messages.Message>>
extends Object
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.ai.chat.model.ChatModelprotected ConversationContextPolicy<org.springframework.ai.chat.messages.Message>protected booleanprotected StateSerializer<State>protected booleanprotected Stringprotected final Set<org.springframework.ai.tool.ToolCallback> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StateGraph<State>build()abstract StateGraph<State>build(Function<ReactAgentBuilder<?, ?>, ReactAgent.ChatService> chatServiceFactory) chatModel(org.springframework.ai.chat.model.ChatModel chatModel) chatModel(org.springframework.ai.chat.model.ChatModel chatModel, boolean streaming) Deprecated.chatModel(org.springframework.ai.chat.model.ChatModel chatModel, boolean streaming, boolean emitStreamingOutputEnd) Deprecated.UsechatModel(ChatModel)and configure streaming options withstreaming(boolean)andemitStreamingEnd(boolean).conversationContextPolicy(ConversationContextPolicy<org.springframework.ai.chat.messages.Message> conversationContextPolicy) defaultSystem(String systemMessage) emitStreamingEnd(boolean emitStreamingOutputEnd) protected Bresult()skills(org.springframework.core.io.Resource skillsRootPath) stateSerializer(StateSerializer<State> stateSerializer) Sets the state serializer for the graph builder.streaming(boolean streaming) tool(org.springframework.ai.tool.ToolCallback tool) List<org.springframework.ai.tool.ToolCallback>tools()tools(org.springframework.ai.tool.ToolCallbackProvider toolCallbackProvider) toolsFromObject(Object objectWithTools)
-
Field Details
-
stateSerializer
protected StateSerializer<State extends MessagesState<org.springframework.ai.chat.messages.Message>> stateSerializer -
chatModel
protected org.springframework.ai.chat.model.ChatModel chatModel -
systemMessage
-
streaming
protected boolean streaming -
tools
-
schema
-
emitStreamingOutputEnd
protected boolean emitStreamingOutputEnd -
conversationContextPolicy
protected ConversationContextPolicy<org.springframework.ai.chat.messages.Message> conversationContextPolicy
-
-
Constructor Details
-
ReactAgentBuilder
public ReactAgentBuilder()
-
-
Method Details
-
systemMessage
-
tools
-
result
-
conversationContextPolicy
public B conversationContextPolicy(ConversationContextPolicy<org.springframework.ai.chat.messages.Message> conversationContextPolicy) -
schema
-
stateSerializer
Sets the state serializer for the graph builder.- Parameters:
stateSerializer- the state serializer to set- Returns:
- the current instance of GraphBuilder for method chaining
-
chatModel
@Deprecated public B chatModel(org.springframework.ai.chat.model.ChatModel chatModel, boolean streaming, boolean emitStreamingOutputEnd) Deprecated.UsechatModel(ChatModel)and configure streaming options withstreaming(boolean)andemitStreamingEnd(boolean).Sets the chat model and streaming-related options.- Parameters:
chatModel- the chat model to usestreaming- enables/disables streaming modeemitStreamingOutputEnd- enables/disables emitting the streaming end output event- Returns:
- the current builder instance
-
chatModel
@Deprecated public B chatModel(org.springframework.ai.chat.model.ChatModel chatModel, boolean streaming) Deprecated.UsechatModel(ChatModel)and configure streaming options withstreaming(boolean).Sets the chat model and streaming-related options.- Parameters:
chatModel- the chat model to usestreaming- enables/disables streaming mode- Returns:
- the current builder instance
-
chatModel
-
streaming
-
emitStreamingEnd
-
defaultSystem
-
tool
-
tools
-
tools
-
toolsFromObject
-
skills
-
skills
-
build
public abstract StateGraph<State> build(Function<ReactAgentBuilder<?, ?>, throws GraphStateExceptionReactAgent.ChatService> chatServiceFactory) - Throws:
GraphStateException
-
build
- Throws:
GraphStateException
-
chatModel(ChatModel)and configure streaming options withstreaming(boolean).