@langchain/langgraph 0.1.0-rc.1 → 0.1.1
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 +1 -1
- package/dist/graph/message.d.ts +0 -3
- package/dist/graph/messages_annotation.cjs +12 -0
- package/dist/graph/messages_annotation.d.ts +4 -0
- package/dist/graph/messages_annotation.js +9 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/prebuilt/react_agent_executor.d.ts +2 -2
- package/dist/prebuilt/tool_node.d.ts +3 -3
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -243,7 +243,7 @@ Is there anything else you'd like to know about the weather in New York or any o
|
|
|
243
243
|
- [Tutorials](https://langchain-ai.github.io/langgraphjs/tutorials/): Learn to build with LangGraph through guided examples.
|
|
244
244
|
- [How-to Guides](https://langchain-ai.github.io/langgraphjs/how-tos/): Accomplish specific things within LangGraph, from streaming, to adding memory & persistence, to common design patterns (branching, subgraphs, etc.). These are the place to go if you want to copy and run a specific code snippet.
|
|
245
245
|
- [Conceptual Guides](https://langchain-ai.github.io/langgraphjs/concepts/): In-depth explanations of the key concepts and principles behind LangGraph, such as nodes, edges, state and more.
|
|
246
|
-
- [API Reference](https://langchain-ai.github.io/langgraphjs/reference/
|
|
246
|
+
- [API Reference](https://langchain-ai.github.io/langgraphjs/reference/): Review important classes and methods, simple examples of how to use the graph and checkpointing APIs, higher-level prebuilt components and more.
|
|
247
247
|
|
|
248
248
|
## Running Example Jupyter Notebooks
|
|
249
249
|
|
package/dist/graph/message.d.ts
CHANGED
|
@@ -5,7 +5,4 @@ export declare function messagesStateReducer(left: BaseMessage[], right: Message
|
|
|
5
5
|
export declare class MessageGraph extends StateGraph<BaseMessage[], BaseMessage[], Messages> {
|
|
6
6
|
constructor();
|
|
7
7
|
}
|
|
8
|
-
export interface MessagesState {
|
|
9
|
-
messages: BaseMessage[];
|
|
10
|
-
}
|
|
11
8
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MessagesAnnotation = void 0;
|
|
5
|
+
const annotation_js_1 = require("./annotation.cjs");
|
|
6
|
+
const message_js_1 = require("./message.cjs");
|
|
7
|
+
exports.MessagesAnnotation = annotation_js_1.Annotation.Root({
|
|
8
|
+
messages: (0, annotation_js_1.Annotation)({
|
|
9
|
+
reducer: message_js_1.messagesStateReducer,
|
|
10
|
+
default: () => [],
|
|
11
|
+
}),
|
|
12
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */
|
|
2
|
+
import { Annotation } from "./annotation.js";
|
|
3
|
+
import { messagesStateReducer } from "./message.js";
|
|
4
|
+
export const MessagesAnnotation = Annotation.Root({
|
|
5
|
+
messages: Annotation({
|
|
6
|
+
reducer: messagesStateReducer,
|
|
7
|
+
default: () => [],
|
|
8
|
+
}),
|
|
9
|
+
});
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
16
16
|
};
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.MessagesAnnotation = void 0;
|
|
18
19
|
const async_local_storage_js_1 = require("./setup/async_local_storage.cjs");
|
|
19
20
|
// Initialize global async local storage instance for tracing
|
|
20
21
|
(0, async_local_storage_js_1.initializeAsyncLocalStorageSingleton)();
|
|
21
22
|
__exportStar(require("./web.cjs"), exports);
|
|
23
|
+
var messages_annotation_js_1 = require("./graph/messages_annotation.cjs");
|
|
24
|
+
Object.defineProperty(exports, "MessagesAnnotation", { enumerable: true, get: function () { return messages_annotation_js_1.MessagesAnnotation; } });
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,3 +3,4 @@ import { initializeAsyncLocalStorageSingleton } from "./setup/async_local_storag
|
|
|
3
3
|
// Initialize global async local storage instance for tracing
|
|
4
4
|
initializeAsyncLocalStorageSingleton();
|
|
5
5
|
export * from "./web.js";
|
|
6
|
+
export { MessagesAnnotation } from "./graph/messages_annotation.js";
|
|
@@ -4,7 +4,7 @@ import { Runnable, RunnableToolLike } from "@langchain/core/runnables";
|
|
|
4
4
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
5
5
|
import { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
|
|
6
6
|
import { START } from "../graph/index.js";
|
|
7
|
-
import {
|
|
7
|
+
import { MessagesAnnotation } from "../graph/messages_annotation.js";
|
|
8
8
|
import { CompiledStateGraph } from "../graph/state.js";
|
|
9
9
|
import { All } from "../pregel/types.js";
|
|
10
10
|
import { ToolNode } from "./tool_node.js";
|
|
@@ -14,7 +14,7 @@ export interface AgentState {
|
|
|
14
14
|
export type N = typeof START | "agent" | "tools";
|
|
15
15
|
export type CreateReactAgentParams = {
|
|
16
16
|
llm: BaseChatModel;
|
|
17
|
-
tools: ToolNode<
|
|
17
|
+
tools: ToolNode<typeof MessagesAnnotation.State> | (StructuredToolInterface | RunnableToolLike)[];
|
|
18
18
|
messageModifier?: SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;
|
|
19
19
|
checkpointSaver?: BaseCheckpointSaver;
|
|
20
20
|
interruptBefore?: N[] | All;
|
|
@@ -3,13 +3,13 @@ import { RunnableToolLike } from "@langchain/core/runnables";
|
|
|
3
3
|
import { StructuredToolInterface } from "@langchain/core/tools";
|
|
4
4
|
import { RunnableCallable } from "../utils.js";
|
|
5
5
|
import { END } from "../graph/graph.js";
|
|
6
|
-
import {
|
|
6
|
+
import { MessagesAnnotation } from "../graph/messages_annotation.js";
|
|
7
7
|
export type ToolNodeOptions = {
|
|
8
8
|
name?: string;
|
|
9
9
|
tags?: string[];
|
|
10
10
|
handleToolErrors?: boolean;
|
|
11
11
|
};
|
|
12
|
-
export declare class ToolNode<T extends BaseMessage[] |
|
|
12
|
+
export declare class ToolNode<T extends BaseMessage[] | typeof MessagesAnnotation.State> extends RunnableCallable<T, T> {
|
|
13
13
|
/**
|
|
14
14
|
A node that runs the tools requested in the last AIMessage. It can be used
|
|
15
15
|
either in StateGraph with a "messages" key or in MessageGraph. If multiple
|
|
@@ -21,4 +21,4 @@ export declare class ToolNode<T extends BaseMessage[] | MessagesState> extends R
|
|
|
21
21
|
constructor(tools: (StructuredToolInterface | RunnableToolLike)[], options?: ToolNodeOptions);
|
|
22
22
|
private run;
|
|
23
23
|
}
|
|
24
|
-
export declare function toolsCondition(state: BaseMessage[] |
|
|
24
|
+
export declare function toolsCondition(state: BaseMessage[] | typeof MessagesAnnotation.State): "tools" | typeof END;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "LangGraph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
},
|
|
15
15
|
"scripts": {
|
|
16
16
|
"build": "yarn turbo:command build:internal --filter=@langchain/langgraph",
|
|
17
|
-
"build:internal": "yarn
|
|
17
|
+
"build:internal": "yarn lc_build --create-entrypoints --pre --tree-shaking",
|
|
18
18
|
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
|
19
19
|
"lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
20
20
|
"lint": "yarn lint:eslint && yarn lint:dpdm",
|
|
@@ -31,18 +31,26 @@
|
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@langchain/core": ">=0.2.20 <0.3.0",
|
|
34
|
-
"@langchain/langgraph-checkpoint": "0.0.
|
|
35
|
-
"@langchain/langgraph-checkpoint-sqlite": "0.0.
|
|
34
|
+
"@langchain/langgraph-checkpoint": "~0.0.1",
|
|
35
|
+
"@langchain/langgraph-checkpoint-sqlite": "~0.0.1",
|
|
36
36
|
"double-ended-queue": "^2.1.0-0",
|
|
37
37
|
"uuid": "^10.0.0",
|
|
38
38
|
"zod": "^3.23.8"
|
|
39
39
|
},
|
|
40
|
+
"peerDependencies": {
|
|
41
|
+
"better-sqlite3": "^9.5.0"
|
|
42
|
+
},
|
|
43
|
+
"peerDependenciesMeta": {
|
|
44
|
+
"better-sqlite3": {
|
|
45
|
+
"optional": true
|
|
46
|
+
}
|
|
47
|
+
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"@jest/globals": "^29.5.0",
|
|
42
50
|
"@langchain/anthropic": "^0.2.12",
|
|
43
51
|
"@langchain/community": "^0.2.25",
|
|
44
52
|
"@langchain/openai": "^0.2.4",
|
|
45
|
-
"@langchain/scripts": "
|
|
53
|
+
"@langchain/scripts": ">=0.1.0 <0.2.0",
|
|
46
54
|
"@swc/core": "^1.3.90",
|
|
47
55
|
"@swc/jest": "^0.2.29",
|
|
48
56
|
"@tsconfig/recommended": "^1.0.3",
|