Class AgentExecutor.GraphBuilder
java.lang.Object
org.bsc.langgraph4j.agentexecutor.AgentExecutor.GraphBuilder
- Enclosing interface:
- AgentExecutor
Builder class for constructing a graph of agent execution.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds the state graph.chatLanguageModel
(dev.langchain4j.model.chat.ChatLanguageModel chatLanguageModel) Sets the chat language model for the graph builder.chatLanguageModel
(dev.langchain4j.model.chat.StreamingChatLanguageModel streamingChatLanguageModel) Sets the streaming chat language model for the graph builder.objectsWithTools
(List<Object> objectsWithTools) Deprecated.stateSerializer
(StateSerializer<AgentExecutor.State> stateSerializer) Sets the state serializer for the graph builder.toolSpecification
(dev.langchain4j.agent.tool.ToolSpecification spec, dev.langchain4j.service.tool.ToolExecutor executor) Sets the tool specification with executor for the graph builder.toolSpecification
(Object objectsWithTool) Sets the tool specification for the graph builder.toolSpecification
(ToolNode.Specification toolSpecifications) Sets the tool specification for the graph builder.
-
Constructor Details
-
GraphBuilder
public GraphBuilder()
-
-
Method Details
-
chatLanguageModel
public AgentExecutor.GraphBuilder chatLanguageModel(dev.langchain4j.model.chat.ChatLanguageModel chatLanguageModel) Sets the chat language model for the graph builder.- Parameters:
chatLanguageModel
- the chat language model- Returns:
- the updated GraphBuilder instance
-
chatLanguageModel
public AgentExecutor.GraphBuilder chatLanguageModel(dev.langchain4j.model.chat.StreamingChatLanguageModel streamingChatLanguageModel) Sets the streaming chat language model for the graph builder.- Parameters:
streamingChatLanguageModel
- the streaming chat language model- Returns:
- the updated GraphBuilder instance
-
objectsWithTools
Deprecated.Sets the objects with tools for the graph builder (deprecated).- Parameters:
objectsWithTools
- the list of objects with tools- Returns:
- the updated GraphBuilder instance
-
toolSpecification
Sets the tool specification for the graph builder.- Parameters:
objectsWithTool
- the tool specification- Returns:
- the updated GraphBuilder instance
-
toolSpecification
public AgentExecutor.GraphBuilder toolSpecification(dev.langchain4j.agent.tool.ToolSpecification spec, dev.langchain4j.service.tool.ToolExecutor executor) Sets the tool specification with executor for the graph builder.- Parameters:
spec
- the tool specificationexecutor
- the tool executor- Returns:
- the updated GraphBuilder instance
-
toolSpecification
Sets the tool specification for the graph builder.- Parameters:
toolSpecifications
- the tool specifications- Returns:
- the updated GraphBuilder instance
-
stateSerializer
public AgentExecutor.GraphBuilder stateSerializer(StateSerializer<AgentExecutor.State> stateSerializer) Sets the state serializer for the graph builder.- Parameters:
stateSerializer
- the state serializer- Returns:
- the updated GraphBuilder instance
-
build
Builds the state graph.- Returns:
- the constructed StateGraph
- Throws:
GraphStateException
- if there is an error in the graph state
-