Skip to content

Commit

Permalink
refactor: rename AgentExecutor.builder to AgentExecutor.graphBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
bsorrentino committed Aug 9, 2024
1 parent b505197 commit 7f24166
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@
import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.output.FinishReason;
import lombok.var;
import org.bsc.async.AsyncGenerator;
import org.bsc.langgraph4j.*;
import org.bsc.langgraph4j.checkpoint.BaseCheckpointSaver;
import org.bsc.langgraph4j.state.AgentState;
import org.bsc.langgraph4j.state.AppendableValue;
import org.bsc.langgraph4j.state.AppenderChannel;
import org.bsc.langgraph4j.state.Channel;

Expand Down Expand Up @@ -82,7 +80,7 @@ public CompiledGraph<State> build() throws GraphStateException {
}
}

public final GraphBuilder builder() {
public final GraphBuilder graphBuilder() {
return new GraphBuilder();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private AgentExecutor.GraphBuilder newGraphBuilder() throws Exception {

var agentExecutor = new AgentExecutor();

return agentExecutor.builder()
return agentExecutor.graphBuilder()
.chatLanguageModel(chatLanguageModel)
.objectsWithTools(listOf(new TestTool()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import dev.langchain4j.agentexecutor.AgentExecutor;
import dev.langchain4j.model.openai.OpenAiChatModel;

import java.util.List;
import static org.bsc.langgraph4j.utils.CollectionsUtils.listOf;

public class AgentExecutorStreamingServer {

Expand All @@ -26,9 +26,10 @@ public static void main(String[] args) throws Exception {
.maxTokens(2000)
.build();

var agentExecutor = new AgentExecutor();

var app = agentExecutor.compile( llm, List.of(new TestTool()) );
var app = new AgentExecutor().graphBuilder()
.chatLanguageModel(llm)
.objectsWithTools(listOf(new TestTool()))
.build();

// [Serializing with Jackson (JSON) - getting "No serializer found"?](https://stackoverflow.com/a/8395924/521197)
ObjectMapper objectMapper = new ObjectMapper();
Expand Down

0 comments on commit 7f24166

Please sign in to comment.