@langchain/langgraph 0.0.11 → 0.0.13
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/dist/channels/any_value.cjs +57 -0
- package/dist/channels/any_value.d.ts +16 -0
- package/dist/channels/any_value.js +53 -0
- package/dist/channels/base.cjs +19 -28
- package/dist/channels/base.d.ts +13 -19
- package/dist/channels/base.js +17 -24
- package/dist/channels/binop.cjs +4 -3
- package/dist/channels/binop.d.ts +1 -1
- package/dist/channels/binop.js +3 -2
- package/dist/channels/dynamic_barrier_value.cjs +88 -0
- package/dist/channels/dynamic_barrier_value.d.ts +26 -0
- package/dist/channels/dynamic_barrier_value.js +84 -0
- package/dist/channels/ephemeral_value.cjs +64 -0
- package/dist/channels/ephemeral_value.d.ts +14 -0
- package/dist/channels/ephemeral_value.js +60 -0
- package/dist/channels/index.cjs +1 -3
- package/dist/channels/index.d.ts +1 -1
- package/dist/channels/index.js +1 -1
- package/dist/channels/last_value.cjs +11 -5
- package/dist/channels/last_value.d.ts +5 -1
- package/dist/channels/last_value.js +9 -3
- package/dist/channels/named_barrier_value.cjs +71 -0
- package/dist/channels/named_barrier_value.d.ts +18 -0
- package/dist/channels/named_barrier_value.js +66 -0
- package/dist/channels/topic.cjs +5 -3
- package/dist/channels/topic.d.ts +3 -3
- package/dist/channels/topic.js +5 -3
- package/dist/checkpoint/base.cjs +30 -12
- package/dist/checkpoint/base.d.ts +39 -22
- package/dist/checkpoint/base.js +28 -11
- package/dist/checkpoint/id.cjs +40 -0
- package/dist/checkpoint/id.d.ts +2 -0
- package/dist/checkpoint/id.js +35 -0
- package/dist/checkpoint/index.cjs +2 -2
- package/dist/checkpoint/index.d.ts +2 -2
- package/dist/checkpoint/index.js +2 -2
- package/dist/checkpoint/memory.cjs +63 -49
- package/dist/checkpoint/memory.d.ts +7 -10
- package/dist/checkpoint/memory.js +62 -47
- package/dist/checkpoint/sqlite.cjs +170 -0
- package/dist/checkpoint/sqlite.d.ts +14 -0
- package/dist/checkpoint/sqlite.js +163 -0
- package/dist/constants.cjs +3 -1
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +2 -0
- package/dist/errors.cjs +31 -0
- package/dist/errors.d.ts +12 -0
- package/dist/errors.js +24 -0
- package/dist/graph/graph.cjs +234 -96
- package/dist/graph/graph.d.ts +52 -23
- package/dist/graph/graph.js +233 -97
- package/dist/graph/index.cjs +2 -2
- package/dist/graph/index.d.ts +2 -2
- package/dist/graph/index.js +2 -2
- package/dist/graph/message.cjs +4 -3
- package/dist/graph/message.d.ts +4 -1
- package/dist/graph/message.js +4 -3
- package/dist/graph/state.cjs +237 -102
- package/dist/graph/state.d.ts +41 -18
- package/dist/graph/state.js +238 -104
- package/dist/index.cjs +6 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +2 -1
- package/dist/prebuilt/agent_executor.cjs +22 -36
- package/dist/prebuilt/agent_executor.d.ts +7 -10
- package/dist/prebuilt/agent_executor.js +23 -37
- package/dist/prebuilt/chat_agent_executor.cjs +13 -13
- package/dist/prebuilt/chat_agent_executor.d.ts +3 -1
- package/dist/prebuilt/chat_agent_executor.js +15 -15
- package/dist/prebuilt/index.cjs +4 -1
- package/dist/prebuilt/index.d.ts +1 -0
- package/dist/prebuilt/index.js +1 -0
- package/dist/prebuilt/tool_node.cjs +59 -0
- package/dist/prebuilt/tool_node.d.ts +17 -0
- package/dist/prebuilt/tool_node.js +54 -0
- package/dist/pregel/debug.cjs +6 -8
- package/dist/pregel/debug.d.ts +2 -2
- package/dist/pregel/debug.js +5 -7
- package/dist/pregel/index.cjs +406 -236
- package/dist/pregel/index.d.ts +77 -41
- package/dist/pregel/index.js +408 -241
- package/dist/pregel/io.cjs +117 -30
- package/dist/pregel/io.d.ts +11 -3
- package/dist/pregel/io.js +111 -28
- package/dist/pregel/read.cjs +126 -46
- package/dist/pregel/read.d.ts +27 -18
- package/dist/pregel/read.js +125 -45
- package/dist/pregel/types.cjs +2 -0
- package/dist/pregel/types.d.ts +32 -0
- package/dist/pregel/types.js +1 -0
- package/dist/pregel/validate.cjs +58 -51
- package/dist/pregel/validate.d.ts +14 -13
- package/dist/pregel/validate.js +56 -50
- package/dist/pregel/write.cjs +46 -30
- package/dist/pregel/write.d.ts +18 -8
- package/dist/pregel/write.js +45 -29
- package/dist/serde/base.cjs +2 -0
- package/dist/serde/base.d.ts +4 -0
- package/dist/serde/base.js +1 -0
- package/dist/setup/async_local_storage.cjs +2 -2
- package/dist/setup/async_local_storage.js +1 -1
- package/dist/tests/channels.test.d.ts +1 -0
- package/dist/tests/channels.test.js +151 -0
- package/dist/tests/chatbot.int.test.d.ts +1 -0
- package/dist/tests/chatbot.int.test.js +61 -0
- package/dist/tests/checkpoints.test.d.ts +1 -0
- package/dist/tests/checkpoints.test.js +190 -0
- package/dist/tests/graph.test.d.ts +1 -0
- package/dist/tests/graph.test.js +15 -0
- package/dist/tests/prebuilt.int.test.d.ts +1 -0
- package/dist/tests/prebuilt.int.test.js +101 -0
- package/dist/tests/prebuilt.test.d.ts +1 -0
- package/dist/tests/prebuilt.test.js +195 -0
- package/dist/tests/pregel.io.test.d.ts +1 -0
- package/dist/tests/pregel.io.test.js +332 -0
- package/dist/tests/pregel.read.test.d.ts +1 -0
- package/dist/tests/pregel.read.test.js +109 -0
- package/dist/tests/pregel.test.d.ts +1 -0
- package/dist/tests/pregel.test.js +1879 -0
- package/dist/tests/pregel.validate.test.d.ts +1 -0
- package/dist/tests/pregel.validate.test.js +198 -0
- package/dist/tests/pregel.write.test.d.ts +1 -0
- package/dist/tests/pregel.write.test.js +44 -0
- package/dist/tests/tracing.int.test.d.ts +1 -0
- package/dist/tests/tracing.int.test.js +449 -0
- package/dist/tests/utils.d.ts +22 -0
- package/dist/tests/utils.js +76 -0
- package/dist/utils.cjs +74 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.js +70 -0
- package/package.json +12 -8
- package/dist/pregel/reserved.cjs +0 -6
- package/dist/pregel/reserved.d.ts +0 -3
- package/dist/pregel/reserved.js +0 -3
package/dist/pregel/index.d.ts
CHANGED
|
@@ -1,75 +1,111 @@
|
|
|
1
|
-
import { Runnable, RunnableConfig } from "@langchain/core/runnables";
|
|
1
|
+
import { Runnable, RunnableConfig, RunnableFunc } from "@langchain/core/runnables";
|
|
2
2
|
import { CallbackManagerForChainRun } from "@langchain/core/callbacks/manager";
|
|
3
3
|
import { IterableReadableStream } from "@langchain/core/utils/stream";
|
|
4
4
|
import { BaseChannel } from "../channels/base.js";
|
|
5
|
-
import { BaseCheckpointSaver } from "../checkpoint/base.js";
|
|
6
|
-
import {
|
|
5
|
+
import { BaseCheckpointSaver, Checkpoint, ReadonlyCheckpoint } from "../checkpoint/base.js";
|
|
6
|
+
import { PregelNode } from "./read.js";
|
|
7
7
|
import { ChannelWrite } from "./write.js";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
8
|
+
import { All, PregelExecutableTask, PregelTaskDescription } from "./types.js";
|
|
9
|
+
type WriteValue = Runnable | RunnableFunc<unknown, unknown> | unknown;
|
|
11
10
|
export declare class Channel {
|
|
12
11
|
static subscribeTo(channels: string, options?: {
|
|
13
12
|
key?: string;
|
|
14
|
-
when?: (arg: any) => boolean;
|
|
15
13
|
tags?: string[];
|
|
16
|
-
}):
|
|
14
|
+
}): PregelNode;
|
|
17
15
|
static subscribeTo(channels: string[], options?: {
|
|
18
|
-
key?: string;
|
|
19
|
-
when?: (arg: any) => boolean;
|
|
20
16
|
tags?: string[];
|
|
21
|
-
}):
|
|
22
|
-
static writeTo(
|
|
17
|
+
}): PregelNode;
|
|
18
|
+
static writeTo(channels: string[], kwargs?: Record<string, WriteValue>): ChannelWrite;
|
|
23
19
|
}
|
|
24
|
-
export
|
|
20
|
+
export type StreamMode = "values" | "updates";
|
|
21
|
+
/**
|
|
22
|
+
* Construct a type with a set of properties K of type T
|
|
23
|
+
*/
|
|
24
|
+
type StrRecord<K extends string, T> = {
|
|
25
|
+
[P in K]: T;
|
|
26
|
+
};
|
|
27
|
+
export interface PregelInterface<Nn extends StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel>> {
|
|
28
|
+
nodes: Nn;
|
|
29
|
+
channels: Cc;
|
|
30
|
+
inputs: keyof Cc | Array<keyof Cc>;
|
|
31
|
+
outputs: keyof Cc | Array<keyof Cc>;
|
|
25
32
|
/**
|
|
26
|
-
* @default
|
|
33
|
+
* @default true
|
|
27
34
|
*/
|
|
28
|
-
|
|
35
|
+
autoValidate?: boolean;
|
|
29
36
|
/**
|
|
30
|
-
* @default "
|
|
37
|
+
* @default "values"
|
|
31
38
|
*/
|
|
32
|
-
|
|
39
|
+
streamMode?: StreamMode;
|
|
40
|
+
streamChannels?: keyof Cc | Array<keyof Cc>;
|
|
33
41
|
/**
|
|
34
|
-
* @default
|
|
42
|
+
* @default []
|
|
35
43
|
*/
|
|
36
|
-
|
|
44
|
+
interruptAfter?: Array<keyof Nn> | All;
|
|
37
45
|
/**
|
|
38
46
|
* @default []
|
|
39
47
|
*/
|
|
40
|
-
|
|
48
|
+
interruptBefore?: Array<keyof Nn> | All;
|
|
41
49
|
/**
|
|
42
|
-
* @default
|
|
50
|
+
* @default undefined
|
|
43
51
|
*/
|
|
44
|
-
|
|
52
|
+
stepTimeout?: number;
|
|
45
53
|
/**
|
|
46
|
-
* @default
|
|
54
|
+
* @default false
|
|
47
55
|
*/
|
|
48
|
-
|
|
49
|
-
nodes: Record<string, ChannelInvoke>;
|
|
56
|
+
debug?: boolean;
|
|
50
57
|
checkpointer?: BaseCheckpointSaver;
|
|
51
|
-
stepTimeout?: number;
|
|
52
58
|
}
|
|
53
|
-
export interface PregelOptions extends RunnableConfig {
|
|
54
|
-
|
|
59
|
+
export interface PregelOptions<Nn extends StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel>> extends RunnableConfig {
|
|
60
|
+
streamMode?: StreamMode;
|
|
61
|
+
inputKeys?: keyof Cc | Array<keyof Cc>;
|
|
62
|
+
outputKeys?: keyof Cc | Array<keyof Cc>;
|
|
63
|
+
interruptBefore?: All | Array<keyof Nn>;
|
|
64
|
+
interruptAfter?: All | Array<keyof Nn>;
|
|
65
|
+
debug?: boolean;
|
|
55
66
|
}
|
|
56
67
|
export type PregelInputType = any;
|
|
57
68
|
export type PregelOutputType = any;
|
|
58
|
-
export declare class Pregel extends Runnable<PregelInputType, PregelOutputType, PregelOptions
|
|
69
|
+
export declare class Pregel<const Nn extends StrRecord<string, PregelNode>, const Cc extends StrRecord<string, BaseChannel>> extends Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc>> implements PregelInterface<Nn, Cc> {
|
|
59
70
|
static lc_name(): string;
|
|
60
71
|
lc_namespace: string[];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
72
|
+
nodes: Nn;
|
|
73
|
+
channels: Cc;
|
|
74
|
+
inputs: keyof Cc | Array<keyof Cc>;
|
|
75
|
+
outputs: keyof Cc | Array<keyof Cc>;
|
|
76
|
+
autoValidate: boolean;
|
|
77
|
+
streamMode: StreamMode;
|
|
78
|
+
streamChannels?: keyof Cc | Array<keyof Cc>;
|
|
79
|
+
interruptAfter?: Array<keyof Nn> | All;
|
|
80
|
+
interruptBefore?: Array<keyof Nn> | All;
|
|
81
|
+
stepTimeout?: number;
|
|
65
82
|
debug: boolean;
|
|
66
|
-
nodes: Record<string, ChannelInvoke>;
|
|
67
83
|
checkpointer?: BaseCheckpointSaver;
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
84
|
+
constructor(fields: PregelInterface<Nn, Cc>);
|
|
85
|
+
validate(): this;
|
|
86
|
+
get streamChannelsList(): Array<keyof Cc>;
|
|
87
|
+
get streamChannelsAsIs(): keyof Cc | Array<keyof Cc>;
|
|
88
|
+
_defaults(config: PregelOptions<Nn, Cc>): [
|
|
89
|
+
boolean,
|
|
90
|
+
StreamMode,
|
|
91
|
+
// stream mode
|
|
92
|
+
keyof Cc | Array<keyof Cc>,
|
|
93
|
+
// input keys
|
|
94
|
+
keyof Cc | Array<keyof Cc>,
|
|
95
|
+
RunnableConfig,
|
|
96
|
+
// config without pregel keys
|
|
97
|
+
All | Array<keyof Nn>,
|
|
98
|
+
// interrupt before
|
|
99
|
+
All | Array<keyof Nn>
|
|
100
|
+
];
|
|
101
|
+
_transform(input: AsyncGenerator<PregelInputType>, runManager?: CallbackManagerForChainRun, config?: PregelOptions<Nn, Cc>): AsyncGenerator<PregelOutputType>;
|
|
102
|
+
invoke(input: PregelInputType, options?: PregelOptions<Nn, Cc>): Promise<PregelOutputType>;
|
|
103
|
+
stream(input: PregelInputType, config?: PregelOptions<Nn, Cc>): Promise<IterableReadableStream<PregelOutputType>>;
|
|
104
|
+
transform(generator: AsyncGenerator<PregelInputType>, config?: PregelOptions<Nn, Cc>): AsyncGenerator<PregelOutputType>;
|
|
75
105
|
}
|
|
106
|
+
export declare function _shouldInterrupt<N extends PropertyKey, C extends PropertyKey>(checkpoint: ReadonlyCheckpoint, interruptNodes: All | Array<N>, snapshotChannels: Array<C>, tasks: Array<PregelExecutableTask<N, C>>): boolean;
|
|
107
|
+
export declare function _localRead<Cc extends StrRecord<string, BaseChannel>>(checkpoint: ReadonlyCheckpoint, channels: Cc, writes: Array<[keyof Cc, unknown]>, select: Array<keyof Cc> | keyof Cc, fresh?: boolean): Record<string, unknown> | unknown;
|
|
108
|
+
export declare function _applyWrites<Cc extends Record<string, BaseChannel>>(checkpoint: Checkpoint, channels: Cc, pendingWrites: Array<[keyof Cc, unknown]>): void;
|
|
109
|
+
export declare function _prepareNextTasks<Nn extends StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel>>(checkpoint: ReadonlyCheckpoint, processes: Nn, channels: Cc, forExecution: false): [Checkpoint, Array<PregelTaskDescription>];
|
|
110
|
+
export declare function _prepareNextTasks<Nn extends StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel>>(checkpoint: ReadonlyCheckpoint, processes: Nn, channels: Cc, forExecution: true): [Checkpoint, Array<PregelExecutableTask<keyof Nn, keyof Cc>>];
|
|
111
|
+
export {};
|