@langchain/langgraph 0.2.23 → 0.2.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/pregel/algo.cjs +6 -2
- package/dist/pregel/algo.js +6 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,16 +60,18 @@ import { tool } from "@langchain/core/tools";
|
|
|
60
60
|
import { z } from "zod";
|
|
61
61
|
import { ChatAnthropic } from "@langchain/anthropic";
|
|
62
62
|
import { StateGraph } from "@langchain/langgraph";
|
|
63
|
-
import { MemorySaver, Annotation } from "@langchain/langgraph";
|
|
63
|
+
import { MemorySaver, Annotation, messagesStateReducer } from "@langchain/langgraph";
|
|
64
64
|
import { ToolNode } from "@langchain/langgraph/prebuilt";
|
|
65
65
|
|
|
66
66
|
// Define the graph state
|
|
67
67
|
// See here for more info: https://langchain-ai.github.io/langgraphjs/how-tos/define-state/
|
|
68
68
|
const StateAnnotation = Annotation.Root({
|
|
69
69
|
messages: Annotation<BaseMessage[]>({
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
70
|
+
// `messagesStateReducer` function defines how `messages` state key should be updated
|
|
71
|
+
// (in this case it appends new messages to the list and overwrites messages with the same ID)
|
|
72
|
+
reducer: messagesStateReducer,
|
|
73
|
+
}),
|
|
74
|
+
});
|
|
73
75
|
|
|
74
76
|
// Define the tools for the agent to use
|
|
75
77
|
const weatherTool = tool(async ({ query }) => {
|
package/dist/pregel/algo.cjs
CHANGED
|
@@ -308,7 +308,9 @@ function _prepareSingleTask(taskPath, checkpoint, pendingWrites, processes, chan
|
|
|
308
308
|
...configurable[constants_js_1.CONFIG_KEY_CHECKPOINT_MAP],
|
|
309
309
|
[parentNamespace]: checkpoint.id,
|
|
310
310
|
},
|
|
311
|
-
[constants_js_1.CONFIG_KEY_RESUME_VALUE]: resume
|
|
311
|
+
[constants_js_1.CONFIG_KEY_RESUME_VALUE]: resume
|
|
312
|
+
? resume[2]
|
|
313
|
+
: configurable[constants_js_1.CONFIG_KEY_RESUME_VALUE] ?? constants_js_1.MISSING,
|
|
312
314
|
checkpoint_id: undefined,
|
|
313
315
|
checkpoint_ns: taskCheckpointNamespace,
|
|
314
316
|
},
|
|
@@ -409,7 +411,9 @@ function _prepareSingleTask(taskPath, checkpoint, pendingWrites, processes, chan
|
|
|
409
411
|
...configurable[constants_js_1.CONFIG_KEY_CHECKPOINT_MAP],
|
|
410
412
|
[parentNamespace]: checkpoint.id,
|
|
411
413
|
},
|
|
412
|
-
[constants_js_1.CONFIG_KEY_RESUME_VALUE]: resume
|
|
414
|
+
[constants_js_1.CONFIG_KEY_RESUME_VALUE]: resume
|
|
415
|
+
? resume[2]
|
|
416
|
+
: configurable[constants_js_1.CONFIG_KEY_RESUME_VALUE] ?? constants_js_1.MISSING,
|
|
413
417
|
checkpoint_id: undefined,
|
|
414
418
|
checkpoint_ns: taskCheckpointNamespace,
|
|
415
419
|
},
|
package/dist/pregel/algo.js
CHANGED
|
@@ -299,7 +299,9 @@ export function _prepareSingleTask(taskPath, checkpoint, pendingWrites, processe
|
|
|
299
299
|
...configurable[CONFIG_KEY_CHECKPOINT_MAP],
|
|
300
300
|
[parentNamespace]: checkpoint.id,
|
|
301
301
|
},
|
|
302
|
-
[CONFIG_KEY_RESUME_VALUE]: resume
|
|
302
|
+
[CONFIG_KEY_RESUME_VALUE]: resume
|
|
303
|
+
? resume[2]
|
|
304
|
+
: configurable[CONFIG_KEY_RESUME_VALUE] ?? MISSING,
|
|
303
305
|
checkpoint_id: undefined,
|
|
304
306
|
checkpoint_ns: taskCheckpointNamespace,
|
|
305
307
|
},
|
|
@@ -400,7 +402,9 @@ export function _prepareSingleTask(taskPath, checkpoint, pendingWrites, processe
|
|
|
400
402
|
...configurable[CONFIG_KEY_CHECKPOINT_MAP],
|
|
401
403
|
[parentNamespace]: checkpoint.id,
|
|
402
404
|
},
|
|
403
|
-
[CONFIG_KEY_RESUME_VALUE]: resume
|
|
405
|
+
[CONFIG_KEY_RESUME_VALUE]: resume
|
|
406
|
+
? resume[2]
|
|
407
|
+
: configurable[CONFIG_KEY_RESUME_VALUE] ?? MISSING,
|
|
404
408
|
checkpoint_id: undefined,
|
|
405
409
|
checkpoint_ns: taskCheckpointNamespace,
|
|
406
410
|
},
|