Skip to content

Commit e8803d6

Browse files
committed
docs: update readme
1 parent e0335e0 commit e8803d6

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

README.md

+44-44
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
### Adding LangGraph dependency
99

10-
Currently are available only the developer SNAPSHOTs
10+
> 👉 Currently are available only the developer SNAPSHOTs
1111
1212
**Maven**
1313

14-
** JDK8 compliant **
14+
**JDK8 compliant**
1515
```xml
1616
<dependency>
1717
<groupId>org.bsc.langgraph4j</groupId>
@@ -21,7 +21,7 @@ Currently are available only the developer SNAPSHOTs
2121
<dependency>
2222
```
2323

24-
** JDK17 compliant **
24+
**JDK17 compliant**
2525
```xml
2626
<dependency>
2727
<groupId>org.bsc.langgraph4j</groupId>
@@ -71,63 +71,63 @@ Below you can find a piece of code of the `AgentExecutor` to give you an idea of
7171

7272
```java
7373

74-
public static class State implements AgentState {
74+
public static class State implements AgentState {
7575

76-
private final Map<String,Object> data;
76+
private final Map<String,Object> data;
7777

78-
public State( Map<String,Object> initData ) {
79-
this.data = new HashMap<>(initData);
80-
this.data.putIfAbsent("intermediate_steps",
81-
new AppendableValue<IntermediateStep>());
82-
}
78+
public State( Map<String,Object> initData ) {
79+
this.data = new HashMap<>(initData);
80+
this.data.putIfAbsent("intermediate_steps",
81+
new AppendableValue<IntermediateStep>());
82+
}
8383

84-
public Map<String,Object> data() { return Map.copyOf(data); }
84+
public Map<String,Object> data() { return Map.copyOf(data); }
8585

86-
Optional<String> input() { return value("input"); }
87-
Optional<AgentOutcome> agentOutcome() { return value("agent_outcome"); }
88-
Optional<List<IntermediateStep>> intermediateSteps() { return appendableValue("intermediate_steps"); }
89-
}
86+
Optional<String> input() { return value("input"); }
87+
Optional<AgentOutcome> agentOutcome() { return value("agent_outcome"); }
88+
Optional<List<IntermediateStep>> intermediateSteps() { return appendableValue("intermediate_steps"); }
89+
}
9090

9191

92-
var toolInfoList = ToolInfo.fromList( objectsWithTools );
92+
var toolInfoList = ToolInfo.fromList( objectsWithTools );
9393

94-
final List<ToolSpecification> toolSpecifications = toolInfoList.stream()
95-
.map(ToolInfo::specification)
96-
.toList();
94+
final List<ToolSpecification> toolSpecifications = toolInfoList.stream()
95+
.map(ToolInfo::specification)
96+
.toList();
9797

98-
var agentRunnable = Agent.builder()
99-
.chatLanguageModel(chatLanguageModel)
100-
.tools( toolSpecifications )
101-
.build();
98+
var agentRunnable = Agent.builder()
99+
.chatLanguageModel(chatLanguageModel)
100+
.tools( toolSpecifications )
101+
.build();
102102

103-
var workflow = new GraphState<>(State::new);
103+
var workflow = new GraphState<>(State::new);
104104

105-
workflow.setEntryPoint("agent");
105+
workflow.setEntryPoint("agent");
106106

107-
workflow.addNode( "agent", node_async( state ->
108-
runAgent(agentRunnable, state)) // see implementation in the repo code
109-
);
107+
workflow.addNode( "agent", node_async( state ->
108+
runAgent(agentRunnable, state)) // see implementation in the repo code
109+
);
110110

111-
workflow.addNode( "action", node_async( state ->
112-
executeTools(toolInfoList, state)) // see implementation in the repo code
113-
);
111+
workflow.addNode( "action", node_async( state ->
112+
executeTools(toolInfoList, state)) // see implementation in the repo code
113+
);
114114

115-
workflow.addConditionalEdge(
116-
"agent",
117-
edge_async( state -> {
118-
if (state.agentOutcome().map(AgentOutcome::finish).isPresent()) {
119-
return "end";
120-
}
121-
return "continue";
122-
}),
123-
Map.of("continue", "action", "end", END)
124-
);
115+
workflow.addConditionalEdge(
116+
"agent",
117+
edge_async( state -> {
118+
if (state.agentOutcome().map(AgentOutcome::finish).isPresent()) {
119+
return "end";
120+
}
121+
return "continue";
122+
}),
123+
Map.of("continue", "action", "end", END)
124+
);
125125

126-
workflow.addEdge("action", "agent");
126+
workflow.addEdge("action", "agent");
127127

128-
var app = workflow.compile();
128+
var app = workflow.compile();
129129

130-
return app.stream( inputs );
130+
return app.stream( inputs );
131131

132132
```
133133

0 commit comments

Comments
 (0)