@langchain/langgraph 0.0.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/LICENSE +21 -0
- package/README.md +588 -0
- package/dist/channels/base.cjs +58 -0
- package/dist/channels/base.d.ts +46 -0
- package/dist/channels/base.js +50 -0
- package/dist/channels/binop.cjs +70 -0
- package/dist/channels/binop.d.ts +16 -0
- package/dist/channels/binop.js +66 -0
- package/dist/channels/index.cjs +9 -0
- package/dist/channels/index.d.ts +1 -0
- package/dist/channels/index.js +1 -0
- package/dist/channels/last_value.cjs +53 -0
- package/dist/channels/last_value.d.ts +12 -0
- package/dist/channels/last_value.js +49 -0
- package/dist/channels/topic.cjs +90 -0
- package/dist/channels/topic.d.ts +19 -0
- package/dist/channels/topic.js +86 -0
- package/dist/checkpoint/base.cjs +32 -0
- package/dist/checkpoint/base.d.ts +47 -0
- package/dist/checkpoint/base.js +27 -0
- package/dist/checkpoint/index.cjs +8 -0
- package/dist/checkpoint/index.d.ts +2 -0
- package/dist/checkpoint/index.js +2 -0
- package/dist/checkpoint/memory.cjs +35 -0
- package/dist/checkpoint/memory.d.ts +8 -0
- package/dist/checkpoint/memory.js +31 -0
- package/dist/constants.cjs +5 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/graph/graph.cjs +175 -0
- package/dist/graph/graph.d.ts +30 -0
- package/dist/graph/graph.js +171 -0
- package/dist/graph/index.cjs +9 -0
- package/dist/graph/index.d.ts +2 -0
- package/dist/graph/index.js +2 -0
- package/dist/graph/state.cjs +108 -0
- package/dist/graph/state.d.ts +17 -0
- package/dist/graph/state.js +104 -0
- package/dist/index.cjs +8 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/prebuilt/agent_executor.cjs +96 -0
- package/dist/prebuilt/agent_executor.d.ts +12 -0
- package/dist/prebuilt/agent_executor.js +92 -0
- package/dist/prebuilt/chat_agent_executor.cjs +130 -0
- package/dist/prebuilt/chat_agent_executor.d.ts +6 -0
- package/dist/prebuilt/chat_agent_executor.js +126 -0
- package/dist/prebuilt/index.cjs +9 -0
- package/dist/prebuilt/index.d.ts +3 -0
- package/dist/prebuilt/index.js +3 -0
- package/dist/prebuilt/tool_executor.cjs +63 -0
- package/dist/prebuilt/tool_executor.d.ts +27 -0
- package/dist/prebuilt/tool_executor.js +59 -0
- package/dist/pregel/debug.cjs +46 -0
- package/dist/pregel/debug.d.ts +4 -0
- package/dist/pregel/debug.js +41 -0
- package/dist/pregel/index.cjs +475 -0
- package/dist/pregel/index.d.ts +75 -0
- package/dist/pregel/index.js +469 -0
- package/dist/pregel/io.cjs +57 -0
- package/dist/pregel/io.d.ts +9 -0
- package/dist/pregel/io.js +52 -0
- package/dist/pregel/read.cjs +217 -0
- package/dist/pregel/read.d.ts +43 -0
- package/dist/pregel/read.js +211 -0
- package/dist/pregel/reserved.cjs +7 -0
- package/dist/pregel/reserved.d.ts +3 -0
- package/dist/pregel/reserved.js +4 -0
- package/dist/pregel/validate.cjs +90 -0
- package/dist/pregel/validate.d.ts +15 -0
- package/dist/pregel/validate.js +85 -0
- package/dist/pregel/write.cjs +54 -0
- package/dist/pregel/write.d.ts +13 -0
- package/dist/pregel/write.js +50 -0
- package/index.cjs +1 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +100 -0
- package/prebuilt.cjs +1 -0
- package/prebuilt.d.ts +1 -0
- package/prebuilt.js +1 -0
- package/pregel.cjs +1 -0
- package/pregel.d.ts +1 -0
- package/pregel.js +1 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChannelWrite = void 0;
|
|
4
|
+
const runnables_1 = require("@langchain/core/runnables");
|
|
5
|
+
const constants_js_1 = require("../constants.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Mapping of write channels to Runnables that return the value to be written,
|
|
8
|
+
* or None to skip writing.
|
|
9
|
+
*/
|
|
10
|
+
class ChannelWrite extends runnables_1.RunnablePassthrough {
|
|
11
|
+
constructor(channels) {
|
|
12
|
+
const name = `ChannelWrite<${channels.map(([chan]) => chan).join(",")}>`;
|
|
13
|
+
super({
|
|
14
|
+
...{ channels, name },
|
|
15
|
+
func: async (input, config) => this._write(input, config ?? {}),
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(this, "channels", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true,
|
|
21
|
+
value: void 0
|
|
22
|
+
});
|
|
23
|
+
this.channels = channels;
|
|
24
|
+
}
|
|
25
|
+
get configSpecs() {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
id: constants_js_1.CONFIG_KEY_SEND,
|
|
29
|
+
name: constants_js_1.CONFIG_KEY_SEND,
|
|
30
|
+
description: null,
|
|
31
|
+
default: null,
|
|
32
|
+
annotation: "TYPE_SEND",
|
|
33
|
+
isShared: true,
|
|
34
|
+
dependencies: null,
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
async _write(input, config) {
|
|
40
|
+
const values = this.channels.map(async ([chan, r]) => [
|
|
41
|
+
chan,
|
|
42
|
+
r ? await r.invoke(input, config) : input,
|
|
43
|
+
]);
|
|
44
|
+
let valuesAwaited = await Promise.all(values);
|
|
45
|
+
valuesAwaited = valuesAwaited.filter((write, index) => this.channels[index][1] === null || write[1] !== null);
|
|
46
|
+
ChannelWrite.doWrite(config, Object.fromEntries(valuesAwaited.filter(([_, val], i) => this.channels[i][1] ? Boolean(val) : val)));
|
|
47
|
+
}
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
static doWrite(config, values) {
|
|
50
|
+
const write = config.configurable?.[constants_js_1.CONFIG_KEY_SEND];
|
|
51
|
+
write(Object.entries(values));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.ChannelWrite = ChannelWrite;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Runnable, RunnableConfig, RunnablePassthrough } from "@langchain/core/runnables";
|
|
2
|
+
import { ConfigurableFieldSpec } from "../checkpoint/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mapping of write channels to Runnables that return the value to be written,
|
|
5
|
+
* or None to skip writing.
|
|
6
|
+
*/
|
|
7
|
+
export declare class ChannelWrite<RunInput = any, RunOutput = any> extends RunnablePassthrough<RunInput> {
|
|
8
|
+
channels: Array<[string, Runnable<RunInput, RunOutput> | undefined]>;
|
|
9
|
+
constructor(channels: Array<[string, Runnable<RunInput, RunOutput> | undefined]>);
|
|
10
|
+
get configSpecs(): ConfigurableFieldSpec[];
|
|
11
|
+
_write(input: any, config: RunnableConfig): Promise<void>;
|
|
12
|
+
static doWrite(config: RunnableConfig, values: Record<string, any>): void;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { RunnablePassthrough, } from "@langchain/core/runnables";
|
|
2
|
+
import { CONFIG_KEY_SEND } from "../constants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Mapping of write channels to Runnables that return the value to be written,
|
|
5
|
+
* or None to skip writing.
|
|
6
|
+
*/
|
|
7
|
+
export class ChannelWrite extends RunnablePassthrough {
|
|
8
|
+
constructor(channels) {
|
|
9
|
+
const name = `ChannelWrite<${channels.map(([chan]) => chan).join(",")}>`;
|
|
10
|
+
super({
|
|
11
|
+
...{ channels, name },
|
|
12
|
+
func: async (input, config) => this._write(input, config ?? {}),
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(this, "channels", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value: void 0
|
|
19
|
+
});
|
|
20
|
+
this.channels = channels;
|
|
21
|
+
}
|
|
22
|
+
get configSpecs() {
|
|
23
|
+
return [
|
|
24
|
+
{
|
|
25
|
+
id: CONFIG_KEY_SEND,
|
|
26
|
+
name: CONFIG_KEY_SEND,
|
|
27
|
+
description: null,
|
|
28
|
+
default: null,
|
|
29
|
+
annotation: "TYPE_SEND",
|
|
30
|
+
isShared: true,
|
|
31
|
+
dependencies: null,
|
|
32
|
+
},
|
|
33
|
+
];
|
|
34
|
+
}
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
async _write(input, config) {
|
|
37
|
+
const values = this.channels.map(async ([chan, r]) => [
|
|
38
|
+
chan,
|
|
39
|
+
r ? await r.invoke(input, config) : input,
|
|
40
|
+
]);
|
|
41
|
+
let valuesAwaited = await Promise.all(values);
|
|
42
|
+
valuesAwaited = valuesAwaited.filter((write, index) => this.channels[index][1] === null || write[1] !== null);
|
|
43
|
+
ChannelWrite.doWrite(config, Object.fromEntries(valuesAwaited.filter(([_, val], i) => this.channels[i][1] ? Boolean(val) : val)));
|
|
44
|
+
}
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
+
static doWrite(config, values) {
|
|
47
|
+
const write = config.configurable?.[CONFIG_KEY_SEND];
|
|
48
|
+
write(Object.entries(values));
|
|
49
|
+
}
|
|
50
|
+
}
|
package/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/index.cjs');
|
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/index.js'
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/index.js'
|
package/package.json
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@langchain/langgraph",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "LangGraph",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=18"
|
|
8
|
+
},
|
|
9
|
+
"main": "./index.js",
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git@github.com:langchain-ai/langgraphjs.git"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "yarn clean && yarn build:esm && yarn build:cjs && yarn build:scripts",
|
|
17
|
+
"build:esm": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist/ && rm -rf dist/tests dist/**/tests",
|
|
18
|
+
"build:cjs": "NODE_OPTIONS=--max-old-space-size=4096 tsc --outDir dist-cjs/ -p tsconfig.cjs.json && node scripts/move-cjs-to-dist.js && rm -rf dist-cjs",
|
|
19
|
+
"build:watch": "node scripts/create-entrypoints.js && tsc --outDir dist/ --watch",
|
|
20
|
+
"build:scripts": "node scripts/create-entrypoints.js && node scripts/check-tree-shaking.js",
|
|
21
|
+
"lint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/ && dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts --",
|
|
22
|
+
"lint:fix": "yarn lint --fix",
|
|
23
|
+
"clean": "rm -rf dist/ && NODE_OPTIONS=--max-old-space-size=4096 node scripts/create-entrypoints.js pre",
|
|
24
|
+
"prepack": "yarn build",
|
|
25
|
+
"test": "NODE_OPTIONS=--experimental-vm-modules jest --testPathIgnorePatterns=\\.int\\.test.ts --testTimeout 30000 --maxWorkers=50%",
|
|
26
|
+
"test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --watch --testPathIgnorePatterns=\\.int\\.test.ts",
|
|
27
|
+
"test:single": "NODE_OPTIONS=--experimental-vm-modules yarn run jest --config jest.config.cjs --testTimeout 100000",
|
|
28
|
+
"test:int": "NODE_OPTIONS=--experimental-vm-modules jest --testPathPattern=\\.int\\.test.ts --testTimeout 100000 --maxWorkers=50%",
|
|
29
|
+
"format": "prettier --write \"src\"",
|
|
30
|
+
"format:check": "prettier --check \"src\""
|
|
31
|
+
},
|
|
32
|
+
"author": "LangChain",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@langchain/community": "^0.0.17",
|
|
36
|
+
"@langchain/core": "^0.1.15",
|
|
37
|
+
"@langchain/openai": "^0.0.12",
|
|
38
|
+
"langchain": "^0.1.3",
|
|
39
|
+
"zod": "^3.22.4"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@jest/globals": "^29.5.0",
|
|
43
|
+
"@langchain/openai": "^0.0.12",
|
|
44
|
+
"@swc/core": "^1.3.90",
|
|
45
|
+
"@swc/jest": "^0.2.29",
|
|
46
|
+
"@tsconfig/recommended": "^1.0.3",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
48
|
+
"@typescript-eslint/parser": "^6.12.0",
|
|
49
|
+
"dotenv": "^16.3.1",
|
|
50
|
+
"dpdm": "^3.12.0",
|
|
51
|
+
"eslint": "^8.33.0",
|
|
52
|
+
"eslint-config-airbnb-base": "^15.0.0",
|
|
53
|
+
"eslint-config-prettier": "^8.6.0",
|
|
54
|
+
"eslint-plugin-import": "^2.27.5",
|
|
55
|
+
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
56
|
+
"eslint-plugin-prettier": "^4.2.1",
|
|
57
|
+
"jest": "^29.5.0",
|
|
58
|
+
"jest-environment-node": "^29.6.4",
|
|
59
|
+
"prettier": "^2.8.3",
|
|
60
|
+
"release-it": "^15.10.1",
|
|
61
|
+
"rollup": "^4.5.2",
|
|
62
|
+
"ts-jest": "^29.1.0",
|
|
63
|
+
"tsx": "^4.7.0",
|
|
64
|
+
"typescript": "<5.2.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public",
|
|
68
|
+
"registry": "https://registry.npmjs.org/"
|
|
69
|
+
},
|
|
70
|
+
"exports": {
|
|
71
|
+
".": {
|
|
72
|
+
"types": "./index.d.ts",
|
|
73
|
+
"import": "./index.js",
|
|
74
|
+
"require": "./index.cjs"
|
|
75
|
+
},
|
|
76
|
+
"./pregel": {
|
|
77
|
+
"types": "./pregel.d.ts",
|
|
78
|
+
"import": "./pregel.js",
|
|
79
|
+
"require": "./pregel.cjs"
|
|
80
|
+
},
|
|
81
|
+
"./prebuilt": {
|
|
82
|
+
"types": "./prebuilt.d.ts",
|
|
83
|
+
"import": "./prebuilt.js",
|
|
84
|
+
"require": "./prebuilt.cjs"
|
|
85
|
+
},
|
|
86
|
+
"./package.json": "./package.json"
|
|
87
|
+
},
|
|
88
|
+
"files": [
|
|
89
|
+
"dist/",
|
|
90
|
+
"index.cjs",
|
|
91
|
+
"index.js",
|
|
92
|
+
"index.d.ts",
|
|
93
|
+
"pregel.cjs",
|
|
94
|
+
"pregel.js",
|
|
95
|
+
"pregel.d.ts",
|
|
96
|
+
"prebuilt.cjs",
|
|
97
|
+
"prebuilt.js",
|
|
98
|
+
"prebuilt.d.ts"
|
|
99
|
+
]
|
|
100
|
+
}
|
package/prebuilt.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/prebuilt/index.cjs');
|
package/prebuilt.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/prebuilt/index.js'
|
package/prebuilt.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/prebuilt/index.js'
|
package/pregel.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/pregel/index.cjs');
|
package/pregel.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/pregel/index.js'
|
package/pregel.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dist/pregel/index.js'
|