From 6022e838e8d3de5b43120cb042d17ac8695f0694 Mon Sep 17 00:00:00 2001 From: bsorrentino Date: Wed, 22 Jan 2025 18:28:45 +0100 Subject: [PATCH] docs: update documentation for new release --- README.md | 4 ++-- core/src/site/markdown/concepts/low_level.md | 15 ++++++--------- src/site/markdown/index.md | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 89079d6f..d6a2e720 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ LangGraph for Java. A library for building stateful, multi-agents applications w | Date | Release | info |--------------|----------------| --- -| Jan 13, 2025 | `1.2.3` | official release +| Jan 22, 2025 | `1.2.4` | official release ## Samples @@ -73,7 +73,7 @@ LangGraph for Java. A library for building stateful, multi-agents applications w org.bsc.langgraph4j langgraph4j-core - 1.2.3 + 1.2.4 ``` diff --git a/core/src/site/markdown/concepts/low_level.md b/core/src/site/markdown/concepts/low_level.md index 99fbbc1d..a22324b4 100644 --- a/core/src/site/markdown/concepts/low_level.md +++ b/core/src/site/markdown/concepts/low_level.md @@ -62,7 +62,7 @@ If no [`Channel`] is specified for an item then it is assumed that all updates t ```java static class MessagesState extends AgentState { - static Map> SCHEMA = mapOf( + static Map> SCHEMA = Map.of( "messages", AppenderChannel.of(ArrayList::new) ); } @@ -80,7 +80,7 @@ You can also specify a custom reducer for a particular state property ```java static class MyState extends AgentState { - static Map> SCHEMA = mapOf( + static Map> SCHEMA = Map.of( "property", Channel.of( ( oldValue, newValue ) -> newValue.toUpperCase() ) ); } @@ -134,7 +134,6 @@ In LangGraph4j, nodes are typically a **Functional Interface** ([`AsyncNodeActio ```java import static org.bsc.langgraph4j.action.AsyncEdgeAction.edge_async; import static org.bsc.langgraph4j.action.AsyncNodeAction.node_async; -import static org.bsc.langgraph4j.utils.CollectionsUtils.mapOf; public class State extends AgentState { @@ -149,7 +148,7 @@ public class State extends AgentState { AsyncNodeAction myNode = node_async(state -> { System.out.println( "In myNode: " ); - return mapOf( results: "Hello " + state.input().orElse( "" ) ); + return Map.of( results: "Hello " + state.input().orElse( "" ) ); }); AsyncNodeAction myOtherNode = node_async(state -> state); @@ -215,9 +214,7 @@ graph.addEdge("nodeA", "nodeB"); If you want to **optionally** route to 1 or more edges (or optionally terminate), you can use the [`addConditionalEdges`] method. This method accepts the name of a node and a **Functional Interface** ([`AsyncEdgeAction`]) that will be used as " routing function" to call after that node is executed: ```java -import static org.bsc.langgraph4j.utils.CollectionsUtils.mapOf; - -graph.addConditionalEdges("nodeA", routingFunction, mapOf( "first": "nodeB", "second": "nodeC" ) ); +graph.addConditionalEdges("nodeA", routingFunction, Map.of( "first": "nodeB", "second": "nodeC" ) ); ``` Similar to nodes, the `routingFunction` accept the current `state` of the graph and return a string value. @@ -245,7 +242,7 @@ A conditional entry point lets you start at different nodes depending on custom import static org.bsc.langgraph4j.StateGraph.START; import static org.bsc.langgraph4j.utils.CollectionsUtils.mapOf; -graph.addConditionalEdges(START, routingFunction, mapOf( "first": "nodeB", "second": "nodeC" ) ); +graph.addConditionalEdges(START, routingFunction, Map.of( "first": "nodeB", "second": "nodeC" ) ); ``` You must provide an object that maps the `routingFunction`'s output to the name of the next node. @@ -285,7 +282,7 @@ You must pass these when invoking the graph as part of the configurable part of ```java -RunnableConfig config = RunnableConfig.builder() +var config = RunnableConfig.builder() .threadId("a") .build(); graph.invoke(inputs, config); diff --git a/src/site/markdown/index.md b/src/site/markdown/index.md index 0dc26001..2b616f56 100644 --- a/src/site/markdown/index.md +++ b/src/site/markdown/index.md @@ -57,7 +57,7 @@ LangGraph for Java. A library for building stateful, multi-agents applications w | Date | Release | info |--------------|----------------| --- -| Jan 13, 2025 | `1.2.3` | official release +| Jan 22, 2025 | `1.2.4` | official release ## Quick Start