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 Details

    • stateSerializer

      protected StateSerializer<State extends MessagesState<org.springframework.ai.chat.messages.Message>> stateSerializer
    • chatModel

      protected org.springframework.ai.chat.model.ChatModel chatModel
    • systemMessage

      protected String systemMessage
    • streaming

      protected boolean streaming
    • tools

      protected final Set<org.springframework.ai.tool.ToolCallback> tools
    • schema

      protected Map<String,Channel<?>> schema
    • emitStreamingOutputEnd

      protected boolean emitStreamingOutputEnd
    • conversationContextPolicy

      protected ConversationContextPolicy<org.springframework.ai.chat.messages.Message> conversationContextPolicy
  • Constructor Details

    • ReactAgentBuilder

      public ReactAgentBuilder()
  • Method Details

    • systemMessage

      public Optional<String> systemMessage()
    • tools

      public List<org.springframework.ai.tool.ToolCallback> tools()
    • result

      protected B result()
    • conversationContextPolicy

      public B conversationContextPolicy(ConversationContextPolicy<org.springframework.ai.chat.messages.Message> conversationContextPolicy)
    • schema

      public B schema(Map<String,Channel<?>> schema)
    • stateSerializer

      public B stateSerializer(StateSerializer<State> 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.
      Use chatModel(ChatModel) and configure streaming options with streaming(boolean) and emitStreamingEnd(boolean).
      Sets the chat model and streaming-related options.
      Parameters:
      chatModel - the chat model to use
      streaming - enables/disables streaming mode
      emitStreamingOutputEnd - 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.
      Use chatModel(ChatModel) and configure streaming options with streaming(boolean).
      Sets the chat model and streaming-related options.
      Parameters:
      chatModel - the chat model to use
      streaming - enables/disables streaming mode
      Returns:
      the current builder instance
    • chatModel

      public B chatModel(org.springframework.ai.chat.model.ChatModel chatModel)
    • streaming

      public B streaming(boolean streaming)
    • emitStreamingEnd

      public B emitStreamingEnd(boolean emitStreamingOutputEnd)
    • defaultSystem

      public B defaultSystem(String systemMessage)
    • tool

      public B tool(org.springframework.ai.tool.ToolCallback tool)
    • tools

      public B tools(List<org.springframework.ai.tool.ToolCallback> tools)
    • tools

      public B tools(org.springframework.ai.tool.ToolCallbackProvider toolCallbackProvider)
    • toolsFromObject

      public B toolsFromObject(Object objectWithTools)
    • skills

      public B skills(String skillDirectory)
    • skills

      public B skills(org.springframework.core.io.Resource skillsRootPath)
    • build

      public abstract StateGraph<State> build(Function<ReactAgentBuilder<?,?>,ReactAgent.ChatService> chatServiceFactory) throws GraphStateException
      Throws:
      GraphStateException
    • build

      public final StateGraph<State> build() throws GraphStateException
      Throws:
      GraphStateException