Skip to content

Commit e08804b

Browse files
committed
test(how-to): refactor notebooks to use MessagesState utility
1 parent 6c68b52 commit e08804b

5 files changed

+123
-330
lines changed

how-tos/llm-streaming.ipynb

+30-127
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,21 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 1,
12+
"execution_count": 4,
1313
"metadata": {},
1414
"outputs": [],
1515
"source": [
1616
"String userHomeDir = System.getProperty(\"user.home\");\n",
1717
"String localRespoUrl = \"file://\" + userHomeDir + \"/.m2/repository/\";\n",
1818
"String langchain4jVersion = \"0.36.2\";\n",
19-
"String langgraph4jVersion = \"1.2-SNAPSHOT\";"
19+
"String langgraph4jVersion = \"1.3-SNAPSHOT\";"
2020
]
2121
},
2222
{
2323
"cell_type": "code",
24-
"execution_count": 2,
24+
"execution_count": null,
2525
"metadata": {},
26-
"outputs": [
27-
{
28-
"name": "stdout",
29-
"output_type": "stream",
30-
"text": [
31-
"\u001b[0mRepository \u001b[1m\u001b[32mlocal\u001b[0m url: \u001b[1m\u001b[32mfile:///Users/bsorrentino/.m2/repository/\u001b[0m added.\n",
32-
"\u001b[0mRepositories count: 4\n",
33-
"\u001b[0mname: \u001b[1m\u001b[32mcentral \u001b[0murl: \u001b[1m\u001b[32mhttps://repo.maven.apache.org/maven2/ \u001b[0mrelease:\u001b[32mtrue \u001b[0mupdate:\u001b[32mnever \u001b[0msnapshot:\u001b[32mfalse \u001b[0mupdate:\u001b[32mnever \n",
34-
"\u001b[0m\u001b[0mname: \u001b[1m\u001b[32mjboss \u001b[0murl: \u001b[1m\u001b[32mhttps://repository.jboss.org/nexus/content/repositories/releases/ \u001b[0mrelease:\u001b[32mtrue \u001b[0mupdate:\u001b[32mnever \u001b[0msnapshot:\u001b[32mfalse \u001b[0mupdate:\u001b[32mnever \n",
35-
"\u001b[0m\u001b[0mname: \u001b[1m\u001b[32matlassian \u001b[0murl: \u001b[1m\u001b[32mhttps://packages.atlassian.com/maven/public \u001b[0mrelease:\u001b[32mtrue \u001b[0mupdate:\u001b[32mnever \u001b[0msnapshot:\u001b[32mfalse \u001b[0mupdate:\u001b[32mnever \n",
36-
"\u001b[0m\u001b[0mname: \u001b[1m\u001b[32mlocal \u001b[0murl: \u001b[1m\u001b[32mfile:///Users/bsorrentino/.m2/repository/ \u001b[0mrelease:\u001b[32mtrue \u001b[0mupdate:\u001b[32mnever \u001b[0msnapshot:\u001b[32mtrue \u001b[0mupdate:\u001b[32malways \n",
37-
"\u001b[0m"
38-
]
39-
}
40-
],
26+
"outputs": [],
4127
"source": [
4228
"%dependency /add-repo local \\{localRespoUrl} release|never snapshot|always\n",
4329
"%dependency /list-repos"
@@ -52,7 +38,7 @@
5238
},
5339
{
5440
"cell_type": "code",
55-
"execution_count": 3,
41+
"execution_count": 5,
5642
"metadata": {},
5743
"outputs": [],
5844
"source": [
@@ -62,50 +48,9 @@
6248
},
6349
{
6450
"cell_type": "code",
65-
"execution_count": 4,
51+
"execution_count": null,
6652
"metadata": {},
67-
"outputs": [
68-
{
69-
"name": "stdout",
70-
"output_type": "stream",
71-
"text": [
72-
"Adding dependency \u001b[0m\u001b[1m\u001b[32morg.slf4j:slf4j-jdk14:2.0.9\n",
73-
"\u001b[0mAdding dependency \u001b[0m\u001b[1m\u001b[32morg.bsc.langgraph4j:langgraph4j-core:1.2-SNAPSHOT\n",
74-
"\u001b[0mAdding dependency \u001b[0m\u001b[1m\u001b[32morg.bsc.langgraph4j:langgraph4j-langchain4j:1.2-SNAPSHOT\n",
75-
"\u001b[0mAdding dependency \u001b[0m\u001b[1m\u001b[32mdev.langchain4j:langchain4j:0.36.2\n",
76-
"\u001b[0mAdding dependency \u001b[0m\u001b[1m\u001b[32mdev.langchain4j:langchain4j-open-ai:0.36.2\n",
77-
"\u001b[0mSolving dependencies\n",
78-
"Resolved artifacts count: 26\n",
79-
"Add to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/slf4j/slf4j-jdk14/2.0.9/slf4j-jdk14-2.0.9.jar\u001b[0m\n",
80-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/slf4j/slf4j-api/2.0.9/slf4j-api-2.0.9.jar\u001b[0m\n",
81-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/bsc/langgraph4j/langgraph4j-core/1.2-SNAPSHOT/langgraph4j-core-1.2-SNAPSHOT.jar\u001b[0m\n",
82-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/bsc/async/async-generator/3.0-SNAPSHOT/async-generator-3.0-SNAPSHOT.jar\u001b[0m\n",
83-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/bsc/langgraph4j/langgraph4j-langchain4j/1.2-SNAPSHOT/langgraph4j-langchain4j-1.2-SNAPSHOT.jar\u001b[0m\n",
84-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/dev/langchain4j/langchain4j/0.36.2/langchain4j-0.36.2.jar\u001b[0m\n",
85-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/dev/langchain4j/langchain4j-core/0.36.2/langchain4j-core-0.36.2.jar\u001b[0m\n",
86-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar\u001b[0m\n",
87-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/apache/opennlp/opennlp-tools/1.9.4/opennlp-tools-1.9.4.jar\u001b[0m\n",
88-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/dev/langchain4j/langchain4j-open-ai/0.36.2/langchain4j-open-ai-0.36.2.jar\u001b[0m\n",
89-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/dev/ai4j/openai4j/0.23.0/openai4j-0.23.0.jar\u001b[0m\n",
90-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/retrofit2/retrofit/2.9.0/retrofit-2.9.0.jar\u001b[0m\n",
91-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/retrofit2/converter-jackson/2.9.0/converter-jackson-2.9.0.jar\u001b[0m\n",
92-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/fasterxml/jackson/core/jackson-databind/2.17.2/jackson-databind-2.17.2.jar\u001b[0m\n",
93-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/fasterxml/jackson/core/jackson-annotations/2.17.2/jackson-annotations-2.17.2.jar\u001b[0m\n",
94-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/fasterxml/jackson/core/jackson-core/2.17.2/jackson-core-2.17.2.jar\u001b[0m\n",
95-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/okhttp3/okhttp/4.12.0/okhttp-4.12.0.jar\u001b[0m\n",
96-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/okio/okio/3.6.0/okio-3.6.0.jar\u001b[0m\n",
97-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/okio/okio-jvm/3.6.0/okio-jvm-3.6.0.jar\u001b[0m\n",
98-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/jetbrains/kotlin/kotlin-stdlib-common/1.9.10/kotlin-stdlib-common-1.9.10.jar\u001b[0m\n",
99-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/squareup/okhttp3/okhttp-sse/4.12.0/okhttp-sse-4.12.0.jar\u001b[0m\n",
100-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.25/kotlin-stdlib-jdk8-1.9.25.jar\u001b[0m\n",
101-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/jetbrains/kotlin/kotlin-stdlib/1.9.25/kotlin-stdlib-1.9.25.jar\u001b[0m\n",
102-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/jetbrains/annotations/13.0/annotations-13.0.jar\u001b[0m\n",
103-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.25/kotlin-stdlib-jdk7-1.9.25.jar\u001b[0m\n",
104-
"\u001b[0mAdd to classpath: \u001b[0m\u001b[32m/Users/bsorrentino/Library/Jupyter/kernels/rapaio-jupyter-kernel/mima_cache/com/knuddels/jtokkit/1.1.0/jtokkit-1.1.0.jar\u001b[0m\n",
105-
"\u001b[0m"
106-
]
107-
}
108-
],
53+
"outputs": [],
10954
"source": [
11055
"%dependency /add org.slf4j:slf4j-jdk14:2.0.9\n",
11156
"%dependency /add org.bsc.langgraph4j:langgraph4j-core:\\{langgraph4jVersion}\n",
@@ -125,7 +70,7 @@
12570
},
12671
{
12772
"cell_type": "code",
128-
"execution_count": 5,
73+
"execution_count": 12,
12974
"metadata": {},
13075
"outputs": [],
13176
"source": [
@@ -147,7 +92,7 @@
14792
},
14893
{
14994
"cell_type": "code",
150-
"execution_count": 6,
95+
"execution_count": 13,
15196
"metadata": {},
15297
"outputs": [
15398
{
@@ -220,50 +165,6 @@
220165
"## Use LLMStreamGenerator in Agent"
221166
]
222167
},
223-
{
224-
"cell_type": "markdown",
225-
"metadata": {},
226-
"source": [
227-
"### Define State"
228-
]
229-
},
230-
{
231-
"cell_type": "code",
232-
"execution_count": 7,
233-
"metadata": {},
234-
"outputs": [],
235-
"source": [
236-
"import org.bsc.langgraph4j.state.AgentState;\n",
237-
"import org.bsc.langgraph4j.state.Channel;\n",
238-
"import org.bsc.langgraph4j.state.AppenderChannel;\n",
239-
"import dev.langchain4j.data.message.ChatMessage;\n",
240-
"import dev.langchain4j.data.message.UserMessage;\n",
241-
"\n",
242-
"public class MessageState extends AgentState {\n",
243-
"\n",
244-
" static Map<String, Channel<?>> SCHEMA = Map.of(\n",
245-
" \"messages\", AppenderChannel.<ChatMessage>of(ArrayList::new)\n",
246-
" );\n",
247-
"\n",
248-
" public MessageState(Map<String, Object> initData) {\n",
249-
" super( initData );\n",
250-
" }\n",
251-
"\n",
252-
" List<ChatMessage> messages() {\n",
253-
" return this.<List<ChatMessage>>value( \"messages\" )\n",
254-
" .orElseThrow( () -> new RuntimeException( \"messages not found\" ) );\n",
255-
" }\n",
256-
"\n",
257-
" // utility method to quick access to last message\n",
258-
" Optional<ChatMessage> lastMessage() {\n",
259-
" List<ChatMessage> messages = messages();\n",
260-
" return ( messages.isEmpty() ) ? \n",
261-
" Optional.empty() :\n",
262-
" Optional.of(messages.get( messages.size() - 1 ));\n",
263-
" }\n",
264-
"}"
265-
]
266-
},
267168
{
268169
"cell_type": "markdown",
269170
"metadata": {},
@@ -273,7 +174,7 @@
273174
},
274175
{
275176
"cell_type": "code",
276-
"execution_count": 8,
177+
"execution_count": 14,
277178
"metadata": {},
278179
"outputs": [
279180
{
@@ -286,12 +187,13 @@
286187
"dev.langchain4j.data.message.ChatMessage"
287188
]
288189
},
289-
"execution_count": 8,
190+
"execution_count": 14,
290191
"metadata": {},
291192
"output_type": "execute_result"
292193
}
293194
],
294195
"source": [
196+
"import dev.langchain4j.data.message.ChatMessage;\n",
295197
"import dev.langchain4j.data.message.AiMessage;\n",
296198
"import dev.langchain4j.data.message.SystemMessage;\n",
297199
"import dev.langchain4j.data.message.UserMessage;\n",
@@ -301,8 +203,9 @@
301203
"import org.bsc.langgraph4j.langchain4j.serializer.std.ChatMesssageSerializer;\n",
302204
"import org.bsc.langgraph4j.langchain4j.serializer.std.ToolExecutionRequestSerializer;\n",
303205
"import org.bsc.langgraph4j.state.AgentStateFactory;\n",
206+
"import org.bsc.langgraph4j.prebuilt.MessagesState;\n",
304207
"\n",
305-
"var stateSerializer = new ObjectStreamStateSerializer<MessageState>( MessageState::new );\n",
208+
"var stateSerializer = new ObjectStreamStateSerializer<MessagesState<ChatMessage>>( MessagesState::new );\n",
306209
"stateSerializer.mapper()\n",
307210
" // Setup custom serializer for Langchain4j ToolExecutionRequest\n",
308211
" .register(ToolExecutionRequest.class, new ToolExecutionRequestSerializer() )\n",
@@ -328,7 +231,7 @@
328231
},
329232
{
330233
"cell_type": "code",
331-
"execution_count": 9,
234+
"execution_count": 15,
332235
"metadata": {},
333236
"outputs": [],
334237
"source": [
@@ -352,13 +255,13 @@
352255
},
353256
{
354257
"cell_type": "code",
355-
"execution_count": 10,
258+
"execution_count": 17,
356259
"metadata": {},
357260
"outputs": [],
358261
"source": [
359262
"import static org.bsc.langgraph4j.StateGraph.START;\n",
360263
"import static org.bsc.langgraph4j.StateGraph.END;\n",
361-
"import org.bsc.langgraph4j.StateGraph;\n",
264+
"import org.bsc.langgraph4j.prebuilt.MessagesStateGraph;\n",
362265
"import org.bsc.langgraph4j.action.EdgeAction;\n",
363266
"import static org.bsc.langgraph4j.action.AsyncEdgeAction.edge_async;\n",
364267
"import org.bsc.langgraph4j.action.NodeAction;\n",
@@ -383,10 +286,10 @@
383286
" .specification( new SearchTool() ) \n",
384287
" .build(); \n",
385288
"\n",
386-
"NodeAction<MessageState> callModel = state -> {\n",
289+
"NodeAction<MessagesState<ChatMessage>> callModel = state -> {\n",
387290
" log.info(\"CallModel:\\n{}\", state.messages());\n",
388291
"\n",
389-
" var generator = LLMStreamingGenerator.<AiMessage, MessageState>builder()\n",
292+
" var generator = LLMStreamingGenerator.<AiMessage, MessagesState<ChatMessage>>builder()\n",
390293
" .mapResult(response -> {\n",
391294
" log.info(\"MapResult: {}\", response);\n",
392295
" return Map.of(\"messages\", response.content());\n",
@@ -404,7 +307,7 @@
404307
"};\n",
405308
" \n",
406309
"// Route Message\n",
407-
"EdgeAction<MessageState> routeMessage = state -> {\n",
310+
"EdgeAction<MessagesState<ChatMessage>> routeMessage = state -> {\n",
408311
" log.info(\"routeMessage:\\n{}\", state.messages());\n",
409312
"\n",
410313
" var lastMessage = state.lastMessage()\n",
@@ -420,7 +323,7 @@
420323
"};\n",
421324
" \n",
422325
"// Invoke Tool\n",
423-
"NodeAction<MessageState> invokeTool = state -> {\n",
326+
"NodeAction<MessagesState<ChatMessage>> invokeTool = state -> {\n",
424327
" log.info(\"invokeTool:\\n{}\", state.messages());\n",
425328
"\n",
426329
" var lastMessage = state.lastMessage()\n",
@@ -440,7 +343,7 @@
440343
"};\n",
441344
" \n",
442345
"// Define Graph\n",
443-
"var workflow = new StateGraph<MessageState>(MessageState.SCHEMA, stateSerializer)\n",
346+
"var workflow = new MessagesStateGraph<ChatMessage>(stateSerializer)\n",
444347
" .addNode(\"agent\", node_async(callModel))\n",
445348
" .addNode(\"tools\", node_async(invokeTool))\n",
446349
" .addEdge(START, \"agent\")\n",
@@ -453,7 +356,7 @@
453356
},
454357
{
455358
"cell_type": "code",
456-
"execution_count": 11,
359+
"execution_count": 18,
457360
"metadata": {},
458361
"outputs": [
459362
{
@@ -463,17 +366,17 @@
463366
"START \n",
464367
"CallModel:\n",
465368
"[UserMessage { name = null contents = [TextContent { text = \"what is the whether today?\" }] }] \n",
466-
"MapResult: Response { content = AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, tokenUsage = TokenUsage { inputTokenCount = 71, outputTokenCount = 15, totalTokenCount = 86 }, finishReason = TOOL_EXECUTION, metadata = {} } \n",
369+
"MapResult: Response { content = AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, tokenUsage = TokenUsage { inputTokenCount = 71, outputTokenCount = 16, totalTokenCount = 87 }, finishReason = TOOL_EXECUTION, metadata = {} } \n",
467370
"routeMessage:\n",
468-
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }] \n",
371+
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }] \n",
469372
"NodeOutput{node=__START__, state={messages=[UserMessage { name = null contents = [TextContent { text = \"what is the whether today?\" }] }]}} \n",
470373
"invokeTool:\n",
471-
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }] \n",
374+
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }] \n",
472375
"execute: execQuery \n",
473-
"NodeOutput{node=agent, state={messages=[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }]}} \n",
376+
"NodeOutput{node=agent, state={messages=[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }]}} \n",
474377
"CallModel:\n",
475-
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, ToolExecutionResultMessage { id = \"call_YszBAtYhA4nlonJG9BFogPkC\" toolName = \"execQuery\" text = \"Cold, with a low of 13 degrees\" }] \n",
476-
"NodeOutput{node=tools, state={messages=[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_YszBAtYhA4nlonJG9BFogPkC\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, ToolExecutionResultMessage { id = \"call_YszBAtYhA4nlonJG9BFogPkC\" toolName = \"execQuery\" text = \"Cold, with a low of 13 degrees\" }]}} \n",
378+
"[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, ToolExecutionResultMessage { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\" toolName = \"execQuery\" text = \"Cold, with a low of 13 degrees\" }] \n",
379+
"NodeOutput{node=tools, state={messages=[AiMessage { text = null toolExecutionRequests = [ToolExecutionRequest { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\", name = \"execQuery\", arguments = \"{\"query\":\"current weather\"}\" }] }, ToolExecutionResultMessage { id = \"call_fN0FFpNYHHJ8gSrr6IaVMRDu\" toolName = \"execQuery\" text = \"Cold, with a low of 13 degrees\" }]}} \n",
477380
"StreamingOutput{node=agent, chunk= } \n",
478381
"StreamingOutput{node=agent, chunk=The } \n",
479382
"StreamingOutput{node=agent, chunk= current } \n",
@@ -505,8 +408,8 @@
505408
"StreamingOutput{node=agent, chunk= feel } \n",
506409
"StreamingOutput{node=agent, chunk= free } \n",
507410
"StreamingOutput{node=agent, chunk= to } \n",
508-
"MapResult: Response { content = AiMessage { text = \"The current weather is cold, with a low of 13 degrees. If you need more specific information or details about a particular location, feel free to ask!\" toolExecutionRequests = null }, tokenUsage = TokenUsage { inputTokenCount = 93, outputTokenCount = 33, totalTokenCount = 126 }, finishReason = STOP, metadata = {} } \n",
509411
"StreamingOutput{node=agent, chunk= ask } \n",
412+
"MapResult: Response { content = AiMessage { text = \"The current weather is cold, with a low of 13 degrees. If you need more specific information or details about a particular location, feel free to ask!\" toolExecutionRequests = null }, tokenUsage = TokenUsage { inputTokenCount = 93, outputTokenCount = 34, totalTokenCount = 127 }, finishReason = STOP, metadata = {} } \n",
510413
"routeMessage:\n",
511414
"[AiMessage { text = \"The current weather is cold, with a low of 13 degrees. If you need more specific information or details about a particular location, feel free to ask!\" toolExecutionRequests = null }] \n",
512415
"StreamingOutput{node=agent, chunk=! } \n",

0 commit comments

Comments
 (0)