@langchain/langgraph 1.0.6 → 1.0.7
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/CHANGELOG.md +6 -0
- package/dist/graph/message.d.cts +2 -2
- package/dist/graph/message.d.cts.map +1 -1
- package/dist/graph/messages_annotation.d.cts +5 -5
- package/dist/graph/messages_annotation.d.cts.map +1 -1
- package/dist/graph/messages_annotation.d.ts +5 -5
- package/dist/graph/messages_annotation.d.ts.map +1 -1
- package/dist/graph/zod/zod-registry.d.ts.map +1 -1
- package/dist/prebuilt/agent_executor.d.cts +5 -5
- package/dist/prebuilt/agent_executor.d.cts.map +1 -1
- package/dist/prebuilt/agent_executor.d.ts +5 -5
- package/dist/prebuilt/agent_executor.d.ts.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.cts +3 -3
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.ts +3 -3
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -1
- package/dist/pregel/remote.cjs +4 -1
- package/dist/pregel/remote.cjs.map +1 -1
- package/dist/pregel/remote.d.cts +2 -0
- package/dist/pregel/remote.d.cts.map +1 -1
- package/dist/pregel/remote.d.ts +2 -0
- package/dist/pregel/remote.d.ts.map +1 -1
- package/dist/pregel/remote.js +4 -1
- package/dist/pregel/remote.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/graph/message.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StateGraph } from "./state.cjs";
|
|
2
2
|
import { RunnableConfig } from "@langchain/core/runnables";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _langchain_core_messages0 from "@langchain/core/messages";
|
|
4
4
|
import { BaseMessage, BaseMessageLike } from "@langchain/core/messages";
|
|
5
5
|
|
|
6
6
|
//#region src/graph/message.d.ts
|
|
@@ -34,7 +34,7 @@ declare function pushMessage(message: BaseMessage | BaseMessageLike, options?: R
|
|
|
34
34
|
* @default "messages"
|
|
35
35
|
*/
|
|
36
36
|
stateKey?: string | null;
|
|
37
|
-
}): BaseMessage<
|
|
37
|
+
}): BaseMessage<_langchain_core_messages0.MessageStructure, _langchain_core_messages0.MessageType>;
|
|
38
38
|
//#endregion
|
|
39
39
|
export { MessageGraph, Messages, REMOVE_ALL_MESSAGES, messagesStateReducer, pushMessage };
|
|
40
40
|
//# sourceMappingURL=message.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.cts","names":["BaseMessage","BaseMessageLike","RunnableConfig","StateGraph","REMOVE_ALL_MESSAGES","Messages","Array","messagesStateReducer","MessageGraph","pushMessage","
|
|
1
|
+
{"version":3,"file":"message.d.cts","names":["BaseMessage","BaseMessageLike","RunnableConfig","StateGraph","REMOVE_ALL_MESSAGES","Messages","Array","messagesStateReducer","MessageGraph","pushMessage","_langchain_core_messages0","MessageStructure","MessageType"],"sources":["../../src/graph/message.d.ts"],"sourcesContent":["import { BaseMessage, BaseMessageLike } from \"@langchain/core/messages\";\nimport type { RunnableConfig } from \"@langchain/core/runnables\";\nimport { StateGraph } from \"./state.js\";\nexport declare const REMOVE_ALL_MESSAGES = \"__remove_all__\";\nexport type Messages = Array<BaseMessage | BaseMessageLike> | BaseMessage | BaseMessageLike;\n/**\n * Prebuilt reducer that combines returned messages.\n * Can handle standard messages and special modifiers like {@link RemoveMessage}\n * instances.\n */\nexport declare function messagesStateReducer(left: Messages, right: Messages): BaseMessage[];\n/** @ignore */\nexport declare class MessageGraph extends StateGraph<BaseMessage[], BaseMessage[], Messages> {\n constructor();\n}\n/**\n * Manually push a message to a message stream.\n *\n * This is useful when you need to push a manually created message before the node\n * has finished executing.\n *\n * When a message is pushed, it will be automatically persisted to the state after the node has finished executing.\n * To disable persisting, set `options.stateKey` to `null`.\n *\n * @param message The message to push. The message must have an ID set, otherwise an error will be thrown.\n * @param options RunnableConfig / Runtime coming from node context.\n */\nexport declare function pushMessage(message: BaseMessage | BaseMessageLike, options?: RunnableConfig & {\n /**\n * The key of the state to push the message to. Set to `null` to avoid persisting.\n * @default \"messages\"\n */\n stateKey?: string | null;\n}): BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>;\n"],"mappings":";;;;;;cAGqBI,mBAAAA;KACTC,QAAAA,GAAWC,MAAMN,cAAcC,mBAAmBD,cAAcC;;AAD5E;AACA;;;AAA2CA,iBAMnBM,oBAAAA,CANmBN,IAAAA,EAMQI,QANRJ,EAAAA,KAAAA,EAMyBI,QANzBJ,CAAAA,EAMoCD,WANpCC,EAAAA;;AAAmBD,cAQzCQ,YAAAA,SAAqBL,UARoBH,CAQTA,WARSA,EAAAA,EAQMA,WARNA,EAAAA,EAQqBK,QARrBL,CAAAA,CAAAA;aAAcC,CAAAA;;AAM5E;;;;;;AAEA;;;;;;iBAewBQ,WAAAA,UAAqBT,cAAcC,2BAA2BC;EAA9DO;;;;UAA8DP,CAAAA,EAAAA,MAAAA,GAAAA,IAAAA;IAMlFF,WANgGU,CAAAA,yBAAAA,CAMjDC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAArDD"}
|
|
@@ -3,7 +3,7 @@ import { ReducedZodChannel, SchemaMeta } from "./zod/meta.cjs";
|
|
|
3
3
|
import { AnnotationRoot } from "./annotation.cjs";
|
|
4
4
|
import { Messages } from "./message.cjs";
|
|
5
5
|
import * as _langchain_core_utils_types0 from "@langchain/core/utils/types";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _langchain_core_messages19 from "@langchain/core/messages";
|
|
7
7
|
import { BaseMessage } from "@langchain/core/messages";
|
|
8
8
|
import { z } from "zod/v3";
|
|
9
9
|
|
|
@@ -45,7 +45,7 @@ import { z } from "zod/v3";
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
declare const MessagesAnnotation: AnnotationRoot<{
|
|
48
|
-
messages: BinaryOperatorAggregate<BaseMessage<
|
|
48
|
+
messages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[], Messages>;
|
|
49
49
|
}>;
|
|
50
50
|
/**
|
|
51
51
|
* Prebuilt schema meta for Zod state definition.
|
|
@@ -101,11 +101,11 @@ declare const MessagesZodMeta: SchemaMeta<BaseMessage[], Messages>;
|
|
|
101
101
|
* ```
|
|
102
102
|
*/
|
|
103
103
|
declare const MessagesZodState: z.ZodObject<{
|
|
104
|
-
messages: ReducedZodChannel<z.ZodType<BaseMessage<
|
|
104
|
+
messages: ReducedZodChannel<z.ZodType<BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[], z.ZodTypeDef, BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[]>, _langchain_core_utils_types0.InteropZodType<Messages>>;
|
|
105
105
|
}, "strip", z.ZodTypeAny, {
|
|
106
|
-
messages: BaseMessage<
|
|
106
|
+
messages: BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[];
|
|
107
107
|
}, {
|
|
108
|
-
messages: BaseMessage<
|
|
108
|
+
messages: BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[];
|
|
109
109
|
}>;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { MessagesAnnotation, MessagesZodMeta, MessagesZodState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages_annotation.d.cts","names":["
|
|
1
|
+
{"version":3,"file":"messages_annotation.d.cts","names":["___web_js7","__annotation_js0","_langchain_core_utils_types0","__zod_meta_js0","BaseMessage","z","Messages","SchemaMeta","MessagesAnnotation","_langchain_core_messages19","MessageStructure","MessageType","BinaryOperatorAggregate","AnnotationRoot","MessagesZodMeta","MessagesZodState","ZodTypeDef","ZodType","InteropZodType","ReducedZodChannel","ZodTypeAny","ZodObject"],"sources":["../../src/graph/messages_annotation.d.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v3\";\nimport { Messages } from \"./message.js\";\nimport { SchemaMeta } from \"./zod/meta.js\";\n/**\n * Prebuilt state annotation that combines returned messages.\n * Can handle standard messages and special modifiers like {@link RemoveMessage}\n * instances.\n *\n * Specifically, importing and using the prebuilt MessagesAnnotation like this:\n *\n * @example\n * ```ts\n * import { MessagesAnnotation, StateGraph } from \"@langchain/langgraph\";\n *\n * const graph = new StateGraph(MessagesAnnotation)\n * .addNode(...)\n * ...\n * ```\n *\n * Is equivalent to initializing your state manually like this:\n *\n * @example\n * ```ts\n * import { BaseMessage } from \"@langchain/core/messages\";\n * import { Annotation, StateGraph, messagesStateReducer } from \"@langchain/langgraph\";\n *\n * export const StateAnnotation = Annotation.Root({\n * messages: Annotation<BaseMessage[]>({\n * reducer: messagesStateReducer,\n * default: () => [],\n * }),\n * });\n *\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(...)\n * ...\n * ```\n */\nexport declare const MessagesAnnotation: import(\"./annotation.js\").AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\n/**\n * Prebuilt schema meta for Zod state definition.\n *\n * @example\n * ```ts\n * import { z } from \"zod/v4-mini\";\n * import { MessagesZodState, StateGraph } from \"@langchain/langgraph\";\n *\n * const AgentState = z.object({\n * messages: z.custom<BaseMessage[]>().register(registry, MessagesZodMeta),\n * });\n * ```\n */\nexport declare const MessagesZodMeta: SchemaMeta<BaseMessage[], Messages>;\n/**\n * Prebuilt state object that uses Zod to combine returned messages.\n * This utility is synonymous with the `MessagesAnnotation` annotation,\n * but uses Zod as the way to express messages state.\n *\n * You can use import and use this prebuilt schema like this:\n *\n * @example\n * ```ts\n * import { MessagesZodState, StateGraph } from \"@langchain/langgraph\";\n *\n * const graph = new StateGraph(MessagesZodState)\n * .addNode(...)\n * ...\n * ```\n *\n * Which is equivalent to initializing the schema object manually like this:\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n * import type { BaseMessage, BaseMessageLike } from \"@langchain/core/messages\";\n * import { StateGraph, messagesStateReducer } from \"@langchain/langgraph\";\n * import \"@langchain/langgraph/zod\";\n *\n * const AgentState = z.object({\n * messages: z\n * .custom<BaseMessage[]>()\n * .default(() => [])\n * .langgraph.reducer(\n * messagesStateReducer,\n * z.custom<BaseMessageLike | BaseMessageLike[]>()\n * ),\n * });\n * const graph = new StateGraph(AgentState)\n * .addNode(...)\n * ...\n * ```\n */\nexport declare const MessagesZodState: z.ZodObject<{\n messages: import(\"./zod/meta.js\").ReducedZodChannel<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[]>, import(\"@langchain/core/utils/types\").InteropZodType<Messages>>;\n}, \"strip\", z.ZodTypeAny, {\n messages: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[];\n}, {\n messages: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[];\n}>;\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA;;;;;;;;;AAgBA;;;;;;AAwCA;;;;;;;;;;;;;;;AAG6ES,cA3DxDD,kBA2D6FG,gBAAAA,CAAAA;UAApGP,yBAAAA,CA1D4CA,WA0D5CA,CAzDZK,0BAAAA,CADuGC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,CA0DhJP,EAAAA,EA1DgKE,QA0DhKF,CAAAA;;;;;;;;;;;;;;;cA3COU,iBAAiBP,WAAWH,eAAeE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwC3CS,kBAAkBV,CAAAA,CAAEgB;8BACehB,CAAAA,CAAEY,QAAQb,YAKhEK,0BAAAA,CAL+GC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,KAAgBN,CAAAA,CAAEW,YAAYZ,YAAFK,0BAAAA,CAAiDC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,MAA8ET,4BAAAA,CAAvBgB,eAAeZ;YAClWD,CAAAA,CAAEe;YACAhB,YADUK,0BAAAA,CACqCC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA;;YAEpGP,YAFWK,0BAAAA,CAEoCC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA"}
|
|
@@ -2,7 +2,7 @@ import { BinaryOperatorAggregate } from "../channels/binop.js";
|
|
|
2
2
|
import { ReducedZodChannel, SchemaMeta } from "./zod/meta.js";
|
|
3
3
|
import { AnnotationRoot } from "./annotation.js";
|
|
4
4
|
import { Messages } from "./message.js";
|
|
5
|
-
import * as
|
|
5
|
+
import * as _langchain_core_messages19 from "@langchain/core/messages";
|
|
6
6
|
import { BaseMessage } from "@langchain/core/messages";
|
|
7
7
|
import * as _langchain_core_utils_types0 from "@langchain/core/utils/types";
|
|
8
8
|
import { z } from "zod/v3";
|
|
@@ -45,7 +45,7 @@ import { z } from "zod/v3";
|
|
|
45
45
|
* ```
|
|
46
46
|
*/
|
|
47
47
|
declare const MessagesAnnotation: AnnotationRoot<{
|
|
48
|
-
messages: BinaryOperatorAggregate<BaseMessage<
|
|
48
|
+
messages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[], Messages>;
|
|
49
49
|
}>;
|
|
50
50
|
/**
|
|
51
51
|
* Prebuilt schema meta for Zod state definition.
|
|
@@ -101,11 +101,11 @@ declare const MessagesZodMeta: SchemaMeta<BaseMessage[], Messages>;
|
|
|
101
101
|
* ```
|
|
102
102
|
*/
|
|
103
103
|
declare const MessagesZodState: z.ZodObject<{
|
|
104
|
-
messages: ReducedZodChannel<z.ZodType<BaseMessage<
|
|
104
|
+
messages: ReducedZodChannel<z.ZodType<BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[], z.ZodTypeDef, BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[]>, _langchain_core_utils_types0.InteropZodType<Messages>>;
|
|
105
105
|
}, "strip", z.ZodTypeAny, {
|
|
106
|
-
messages: BaseMessage<
|
|
106
|
+
messages: BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[];
|
|
107
107
|
}, {
|
|
108
|
-
messages: BaseMessage<
|
|
108
|
+
messages: BaseMessage<_langchain_core_messages19.MessageStructure, _langchain_core_messages19.MessageType>[];
|
|
109
109
|
}>;
|
|
110
110
|
//#endregion
|
|
111
111
|
export { MessagesAnnotation, MessagesZodMeta, MessagesZodState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages_annotation.d.ts","names":["
|
|
1
|
+
{"version":3,"file":"messages_annotation.d.ts","names":["___web_js7","__annotation_js0","_langchain_core_utils_types0","__zod_meta_js0","BaseMessage","z","Messages","SchemaMeta","MessagesAnnotation","_langchain_core_messages19","MessageStructure","MessageType","BinaryOperatorAggregate","AnnotationRoot","MessagesZodMeta","MessagesZodState","ZodTypeDef","ZodType","InteropZodType","ReducedZodChannel","ZodTypeAny","ZodObject"],"sources":["../../src/graph/messages_annotation.d.ts"],"sourcesContent":["/* __LC_ALLOW_ENTRYPOINT_SIDE_EFFECTS__ */\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v3\";\nimport { Messages } from \"./message.js\";\nimport { SchemaMeta } from \"./zod/meta.js\";\n/**\n * Prebuilt state annotation that combines returned messages.\n * Can handle standard messages and special modifiers like {@link RemoveMessage}\n * instances.\n *\n * Specifically, importing and using the prebuilt MessagesAnnotation like this:\n *\n * @example\n * ```ts\n * import { MessagesAnnotation, StateGraph } from \"@langchain/langgraph\";\n *\n * const graph = new StateGraph(MessagesAnnotation)\n * .addNode(...)\n * ...\n * ```\n *\n * Is equivalent to initializing your state manually like this:\n *\n * @example\n * ```ts\n * import { BaseMessage } from \"@langchain/core/messages\";\n * import { Annotation, StateGraph, messagesStateReducer } from \"@langchain/langgraph\";\n *\n * export const StateAnnotation = Annotation.Root({\n * messages: Annotation<BaseMessage[]>({\n * reducer: messagesStateReducer,\n * default: () => [],\n * }),\n * });\n *\n * const graph = new StateGraph(StateAnnotation)\n * .addNode(...)\n * ...\n * ```\n */\nexport declare const MessagesAnnotation: import(\"./annotation.js\").AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\n/**\n * Prebuilt schema meta for Zod state definition.\n *\n * @example\n * ```ts\n * import { z } from \"zod/v4-mini\";\n * import { MessagesZodState, StateGraph } from \"@langchain/langgraph\";\n *\n * const AgentState = z.object({\n * messages: z.custom<BaseMessage[]>().register(registry, MessagesZodMeta),\n * });\n * ```\n */\nexport declare const MessagesZodMeta: SchemaMeta<BaseMessage[], Messages>;\n/**\n * Prebuilt state object that uses Zod to combine returned messages.\n * This utility is synonymous with the `MessagesAnnotation` annotation,\n * but uses Zod as the way to express messages state.\n *\n * You can use import and use this prebuilt schema like this:\n *\n * @example\n * ```ts\n * import { MessagesZodState, StateGraph } from \"@langchain/langgraph\";\n *\n * const graph = new StateGraph(MessagesZodState)\n * .addNode(...)\n * ...\n * ```\n *\n * Which is equivalent to initializing the schema object manually like this:\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n * import type { BaseMessage, BaseMessageLike } from \"@langchain/core/messages\";\n * import { StateGraph, messagesStateReducer } from \"@langchain/langgraph\";\n * import \"@langchain/langgraph/zod\";\n *\n * const AgentState = z.object({\n * messages: z\n * .custom<BaseMessage[]>()\n * .default(() => [])\n * .langgraph.reducer(\n * messagesStateReducer,\n * z.custom<BaseMessageLike | BaseMessageLike[]>()\n * ),\n * });\n * const graph = new StateGraph(AgentState)\n * .addNode(...)\n * ...\n * ```\n */\nexport declare const MessagesZodState: z.ZodObject<{\n messages: import(\"./zod/meta.js\").ReducedZodChannel<z.ZodType<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], z.ZodTypeDef, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[]>, import(\"@langchain/core/utils/types\").InteropZodType<Messages>>;\n}, \"strip\", z.ZodTypeAny, {\n messages: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[];\n}, {\n messages: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[];\n}>;\n"],"mappings":";;;;;;;;;;;;;;;;AAwCA;;;;;;;;;AAgBA;;;;;;AAwCA;;;;;;;;;;;;;;;AAG6ES,cA3DxDD,kBA2D6FG,gBAAAA,CAAAA;UAApGP,yBAAAA,CA1D4CA,WA0D5CA,CAzDZK,0BAAAA,CADuGC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,CA0DhJP,EAAAA,EA1DgKE,QA0DhKF,CAAAA;;;;;;;;;;;;;;;cA3COU,iBAAiBP,WAAWH,eAAeE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwC3CS,kBAAkBV,CAAAA,CAAEgB;8BACehB,CAAAA,CAAEY,QAAQb,YAKhEK,0BAAAA,CAL+GC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,KAAgBN,CAAAA,CAAEW,YAAYZ,YAAFK,0BAAAA,CAAiDC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA,MAA8ET,4BAAAA,CAAvBgB,eAAeZ;YAClWD,CAAAA,CAAEe;YACAhB,YADUK,0BAAAA,CACqCC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA;;YAEpGP,YAFWK,0BAAAA,CAEoCC,gBAAAA,EAAgBD,0BAAAA,CAAqCE,WAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-registry.d.ts","names":["core","$ZodType","$ZodRegistry","$replace","ReducedZodChannel","SchemaMeta","SchemaMetaRegistry","LanggraphZodMetaRegistry","Meta","Schema","S","
|
|
1
|
+
{"version":3,"file":"zod-registry.d.ts","names":["core","$ZodType","$ZodRegistry","$replace","ReducedZodChannel","SchemaMeta","SchemaMetaRegistry","LanggraphZodMetaRegistry","Meta","Schema","S","_0","Output","Input","$ZodTypeInternals","Internals","output","input","TOutput","TInput","R","TInternals","ZodType","sideEffect","ZodMiniType","registry"],"sources":["../../../src/graph/zod/zod-registry.d.ts"],"sourcesContent":["import type * as core from \"zod/v4/core\";\nimport { $ZodType, $ZodRegistry, $replace } from \"zod/v4/core\";\nimport { type ReducedZodChannel, type SchemaMeta, type SchemaMetaRegistry } from \"./meta.js\";\n/**\n * A Zod v4-compatible meta registry that extends the base registry.\n *\n * This registry allows you to associate and retrieve metadata for Zod schemas,\n * leveraging the base registry for storage. It is compatible with Zod v4 and\n * interoperates with the base registry to ensure consistent metadata management\n * across different Zod versions.\n *\n * @template Meta - The type of metadata associated with each schema.\n * @template Schema - The Zod schema type.\n */\nexport declare class LanggraphZodMetaRegistry<Meta extends SchemaMeta = SchemaMeta, Schema extends $ZodType = $ZodType> extends $ZodRegistry<Meta & {\n [key: string]: unknown;\n}, Schema> {\n protected parent: SchemaMetaRegistry;\n /**\n * Creates a new LanggraphZodMetaRegistry instance.\n *\n * @param parent - The base SchemaMetaRegistry to use for metadata storage.\n */\n constructor(parent: SchemaMetaRegistry);\n add<S extends Schema>(schema: S, ..._meta: undefined extends Meta & {\n [key: string]: unknown;\n } ? [$replace<Meta & {\n [key: string]: unknown;\n }, S>?] : [$replace<Meta & {\n [key: string]: unknown;\n }, S>]): this;\n}\n// Augment the zod/v4 module nudging the `register` method\n// to use the user provided input schema if specified.\ndeclare module \"zod/v4\" {\n interface ZodType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {\n register<R extends LanggraphZodMetaRegistry, TOutput = core.output<this>, TInput = core.input<this>, TInternals extends core.$ZodTypeInternals<TOutput, TInput> = core.$ZodTypeInternals<TOutput, TInput>>(registry: R, meta: SchemaMeta<TOutput, TInput>): ReducedZodChannel<this, ZodType<TOutput, TInput, TInternals>>;\n }\n}\ndeclare module \"zod/v4-mini\" {\n interface ZodMiniType<out Output = unknown, out Input = unknown, out Internals extends core.$ZodTypeInternals<Output, Input> = core.$ZodTypeInternals<Output, Input>> extends core.$ZodType<Output, Input, Internals> {\n register<R extends LanggraphZodMetaRegistry, TOutput = core.output<this>, TInput = core.input<this>, TInternals extends core.$ZodTypeInternals<TOutput, TInput> = core.$ZodTypeInternals<TOutput, TInput>>(registry: R, meta: SchemaMeta<TOutput, TInput>): ReducedZodChannel<this, ZodMiniType<TOutput, TInput, TInternals>>;\n }\n}\nexport declare const registry: LanggraphZodMetaRegistry<SchemaMeta<any, any>, $ZodType<unknown, unknown, core.$ZodTypeInternals<unknown, unknown>>>;\n"],"mappings":";;;;;;;;AAcA;;;;;;;;;AASwBM,cATHC,wBASGD,CAAAA,aATmCD,UASnCC,GATgDD,UAShDC,EAAAA,eAT2EL,QAS3EK,GATsFL,QAStFK,CAAAA,SATwGJ,YASxGI,CATqHE,IASrHF,GAAAA;MACNG,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;GARfA,MAQ+BC,CAAAA,CAAAA;YAA+BF,MAAAA,EAP3CF,kBAO2CE;;;;;;aAIlDL,CAAAA,MAAAA,EALSG,kBAKTH;KAdiHD,CAAAA,UAU9GO,MAV8GP,CAAAA,CAAAA,MAAAA,EAU9FQ,CAV8FR,EAAAA,GAAAA,KAAAA,EAAAA,SAAAA,SAU/DM,IAV+DN,GAAAA;;EAiB/HS,CAAAA,GAAAA,CALQR,QAKR,CALiBK,IAKjB,GAAA;IAAA,CAAA,GAAA,EAAA,MAA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CAAAA,GAIpBlB,IAAAA,CAAKc,iBAJeI,CAIGN,MAJHM,EAIWL,KAJXK,CAAAA,CAAAA,SAI2BlB,IAAAA,CAAKC,QAJhCiB,CAIyCN,MAJzCM,EAIiDL,KAJjDK,EAIwDH,SAJxDG,CAAAA,CAAAA;IAASC,QAAAA,CAAAA,UAKrIZ,wBALqIY,EAAAA,UAKjGnB,IAAAA,CAAKgB,MAL4FG,CAAAA,IAAAA,CAAAA,EAAAA,SAKrEnB,IAAAA,CAAKiB,KALgEE,CAAAA,IAAAA,CAAAA,EAAAA,mBAKhCnB,IAAAA,CAAKc,iBAL2BK,CAKTD,OALSC,EAKAA,MALAA,CAAAA,GAKUnB,IAAAA,CAAKc,iBALfK,CAKiCD,OALjCC,EAK0CA,MAL1CA,CAAAA,CAAAA,CAAAA,QAAAA,EAK6DC,CAL7DD,EAAAA,IAAAA,EAKsEd,UALtEc,CAKiFD,OALjFC,EAK0FA,MAL1FA,CAAAA,CAAAA,EAKoGf,iBALpGe,CAAAA,IAAAA,EAK4HK,WAL5HL,CAKwID,OALxIC,EAKiJA,MALjJA,EAKyJE,UALzJF,CAAAA,CAAAA;;;AAA0CA,cAQrLM,QARqLN,EAQ3KZ,wBAR2KY,CAQlJd,UARkJc,CAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAQ5HlB,QAR4HkB,CAAAA,OAAAA,EAAAA,OAAAA,EAQjGnB,IAAAA,CAAKc,iBAR4FK,CAAAA,OAAAA,EAAAA,OAAAA,CAAAA,CAAAA,CAAAA"}
|
|
@@ -3,7 +3,7 @@ import { StateDefinition } from "../graph/annotation.cjs";
|
|
|
3
3
|
import { CompiledStateGraph } from "../graph/state.cjs";
|
|
4
4
|
import { ToolExecutor } from "./tool_executor.cjs";
|
|
5
5
|
import { Runnable } from "@langchain/core/runnables";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _langchain_core_messages1 from "@langchain/core/messages";
|
|
7
7
|
import { BaseMessage } from "@langchain/core/messages";
|
|
8
8
|
import { AgentAction, AgentFinish } from "@langchain/core/agents";
|
|
9
9
|
import { Tool } from "@langchain/core/tools";
|
|
@@ -31,22 +31,22 @@ declare function createAgentExecutor({
|
|
|
31
31
|
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
32
32
|
steps: Step[];
|
|
33
33
|
input: string;
|
|
34
|
-
chatHistory?: BaseMessage<
|
|
34
|
+
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
37
37
|
steps?: Step[] | undefined;
|
|
38
38
|
input?: string | undefined;
|
|
39
|
-
chatHistory?: BaseMessage<
|
|
39
|
+
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
40
40
|
}, "__start__" | "action" | "agent", {
|
|
41
41
|
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
42
42
|
steps: BaseChannel<Step[], Step[], unknown>;
|
|
43
43
|
input: BaseChannel<string, string, unknown>;
|
|
44
|
-
chatHistory?: BaseChannel<BaseMessage<
|
|
44
|
+
chatHistory?: BaseChannel<BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, unknown> | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
47
47
|
steps: BaseChannel<Step[], Step[], unknown>;
|
|
48
48
|
input: BaseChannel<string, string, unknown>;
|
|
49
|
-
chatHistory?: BaseChannel<BaseMessage<
|
|
49
|
+
chatHistory?: BaseChannel<BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, unknown> | undefined;
|
|
50
50
|
}, StateDefinition, {
|
|
51
51
|
action: Partial<AgentExecutorState>;
|
|
52
52
|
agent: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_executor.d.cts","names":["___web_js0","AgentAction","AgentFinish","BaseMessage","Runnable","Tool","ToolExecutor","BaseChannel","Step","AgentExecutorState","Array","createAgentExecutor","agentRunnable","tools","
|
|
1
|
+
{"version":3,"file":"agent_executor.d.cts","names":["___web_js0","AgentAction","AgentFinish","BaseMessage","Runnable","Tool","ToolExecutor","BaseChannel","Step","AgentExecutorState","Array","createAgentExecutor","agentRunnable","tools","_langchain_core_messages1","MessageStructure","MessageType","StateDefinition","Partial","CompiledStateGraph"],"sources":["../../src/prebuilt/agent_executor.d.ts"],"sourcesContent":["import { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Runnable } from \"@langchain/core/runnables\";\nimport { Tool } from \"@langchain/core/tools\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport type { BaseChannel } from \"../channels/base.js\";\ninterface Step {\n action: AgentAction | AgentFinish;\n observation: unknown;\n}\n/** @ignore */\nexport interface AgentExecutorState {\n agentOutcome?: AgentAction | AgentFinish;\n steps: Array<Step>;\n input: string;\n chatHistory?: BaseMessage[];\n}\n/** @ignore */\nexport declare function createAgentExecutor({ agentRunnable, tools }: {\n agentRunnable: Runnable;\n tools: Array<Tool> | ToolExecutor;\n}): import(\"../web.js\").CompiledStateGraph<{\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps: Step[];\n input: string;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, {\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps?: Step[] | undefined;\n input?: string | undefined;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, \"__start__\" | \"action\" | \"agent\", {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, import(\"../web.js\").StateDefinition, {\n action: Partial<AgentExecutorState>;\n agent: {\n agentOutcome: any;\n };\n}, unknown, unknown>;\nexport {};\n"],"mappings":";;;;;;;;;;;UAMUQ,IAAAA;UACEP,cAAcC;;;;AADhBM,UAKOC,kBAAAA,CALH;EAAA,YAAA,CAAA,EAMKR,WANL,GAMmBC,WANnB;OACFD,EAMDS,KANCT,CAMKO,IANLP,CAAAA;OAAcC,EAAAA,MAAAA;gBAQRC;AAJlB;;AACmBF,iBAMKU,mBAAAA,CANLV;EAAAA,aAAAA;EAAAA;CAAAA,EAAAA;eAAcC,EAOdE,QAPcF;OAChBM,EAONE,KAPMF,CAOAH,IAPAG,CAAAA,GAOQF,YAPRE;sBAANE,CAAAA;cAEOP,CAAAA,EAOCF,WAPDE,GAOeD,WAPfC,GAAAA,SAAAA;SAQPK;EALaG,KAAAA,EAAAA,MAAAA;EAAmB,WAAA,CAAA,EAOzBR,WA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A,EAWYO,IAXZP,EAAAA,EAAAA,OAAAA,CAAAA;OAAcC,EAYtBK,WAZsBL,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA;aACrBM,CAAAA,EAYMD,WAZNC,CAYkBL,WAZlBK,CAWUM,yBAAAA,CACuDC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAZtHR,EAAAA,GAAAA,SAAAA,EAYkJL,WAZlJK,CAY6BM,yBAAAA,CAAoKC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAZtPR,EAAAA,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;oBAEqDO;QAAgBD,EAYrEI,OAZqEJ,CAY7DL,kBAZkGO,CAAAA;OAApGb,EAAAA;IAEaF,YAAAA,EAAAA,GAAAA;;UAAuCA,EAAAA,OAAAA,CAAAA"}
|
|
@@ -3,7 +3,7 @@ import { StateDefinition } from "../graph/annotation.js";
|
|
|
3
3
|
import { CompiledStateGraph } from "../graph/state.js";
|
|
4
4
|
import { ToolExecutor } from "./tool_executor.js";
|
|
5
5
|
import { Runnable } from "@langchain/core/runnables";
|
|
6
|
-
import * as
|
|
6
|
+
import * as _langchain_core_messages1 from "@langchain/core/messages";
|
|
7
7
|
import { BaseMessage } from "@langchain/core/messages";
|
|
8
8
|
import { AgentAction, AgentFinish } from "@langchain/core/agents";
|
|
9
9
|
import { Tool } from "@langchain/core/tools";
|
|
@@ -31,22 +31,22 @@ declare function createAgentExecutor({
|
|
|
31
31
|
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
32
32
|
steps: Step[];
|
|
33
33
|
input: string;
|
|
34
|
-
chatHistory?: BaseMessage<
|
|
34
|
+
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
35
35
|
}, {
|
|
36
36
|
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
37
37
|
steps?: Step[] | undefined;
|
|
38
38
|
input?: string | undefined;
|
|
39
|
-
chatHistory?: BaseMessage<
|
|
39
|
+
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
40
40
|
}, "__start__" | "action" | "agent", {
|
|
41
41
|
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
42
42
|
steps: BaseChannel<Step[], Step[], unknown>;
|
|
43
43
|
input: BaseChannel<string, string, unknown>;
|
|
44
|
-
chatHistory?: BaseChannel<BaseMessage<
|
|
44
|
+
chatHistory?: BaseChannel<BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, unknown> | undefined;
|
|
45
45
|
}, {
|
|
46
46
|
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
47
47
|
steps: BaseChannel<Step[], Step[], unknown>;
|
|
48
48
|
input: BaseChannel<string, string, unknown>;
|
|
49
|
-
chatHistory?: BaseChannel<BaseMessage<
|
|
49
|
+
chatHistory?: BaseChannel<BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined, unknown> | undefined;
|
|
50
50
|
}, StateDefinition, {
|
|
51
51
|
action: Partial<AgentExecutorState>;
|
|
52
52
|
agent: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent_executor.d.ts","names":["___web_js0","AgentAction","AgentFinish","BaseMessage","Runnable","Tool","ToolExecutor","BaseChannel","Step","AgentExecutorState","Array","createAgentExecutor","agentRunnable","tools","
|
|
1
|
+
{"version":3,"file":"agent_executor.d.ts","names":["___web_js0","AgentAction","AgentFinish","BaseMessage","Runnable","Tool","ToolExecutor","BaseChannel","Step","AgentExecutorState","Array","createAgentExecutor","agentRunnable","tools","_langchain_core_messages1","MessageStructure","MessageType","StateDefinition","Partial","CompiledStateGraph"],"sources":["../../src/prebuilt/agent_executor.d.ts"],"sourcesContent":["import { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Runnable } from \"@langchain/core/runnables\";\nimport { Tool } from \"@langchain/core/tools\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport type { BaseChannel } from \"../channels/base.js\";\ninterface Step {\n action: AgentAction | AgentFinish;\n observation: unknown;\n}\n/** @ignore */\nexport interface AgentExecutorState {\n agentOutcome?: AgentAction | AgentFinish;\n steps: Array<Step>;\n input: string;\n chatHistory?: BaseMessage[];\n}\n/** @ignore */\nexport declare function createAgentExecutor({ agentRunnable, tools }: {\n agentRunnable: Runnable;\n tools: Array<Tool> | ToolExecutor;\n}): import(\"../web.js\").CompiledStateGraph<{\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps: Step[];\n input: string;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, {\n agentOutcome?: AgentAction | AgentFinish | undefined;\n steps?: Step[] | undefined;\n input?: string | undefined;\n chatHistory?: BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined;\n}, \"__start__\" | \"action\" | \"agent\", {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, {\n agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;\n steps: BaseChannel<Step[], Step[], unknown>;\n input: BaseChannel<string, string, unknown>;\n chatHistory?: BaseChannel<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[] | undefined, unknown> | undefined;\n}, import(\"../web.js\").StateDefinition, {\n action: Partial<AgentExecutorState>;\n agent: {\n agentOutcome: any;\n };\n}, unknown, unknown>;\nexport {};\n"],"mappings":";;;;;;;;;;;UAMUQ,IAAAA;UACEP,cAAcC;;;;AADhBM,UAKOC,kBAAAA,CALH;EAAA,YAAA,CAAA,EAMKR,WANL,GAMmBC,WANnB;OACFD,EAMDS,KANCT,CAMKO,IANLP,CAAAA;OAAcC,EAAAA,MAAAA;gBAQRC;AAJlB;;AACmBF,iBAMKU,mBAAAA,CANLV;EAAAA,aAAAA;EAAAA;CAAAA,EAAAA;eAAcC,EAOdE,QAPcF;OAChBM,EAONE,KAPMF,CAOAH,IAPAG,CAAAA,GAOQF,YAPRE;sBAANE,CAAAA;cAEOP,CAAAA,EAOCF,WAPDE,GAOeD,WAPfC,GAAAA,SAAAA;SAQPK;EALaG,KAAAA,EAAAA,MAAAA;EAAmB,WAAA,CAAA,EAOzBR,WAPyB,CAK5BW,yBAAAA,CAEkDC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAP3E,EAAA,GAAA,SAAA;;cAAkBH,CAAAA,EAS1CZ,WAT0CY,GAS5BX,WAT4BW,GAAAA,SAAAA;OAC1CT,CAAAA,EASPI,IATOJ,EAAAA,GAAAA,SAAAA;OACFC,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;aAANK,CAAAA,EAUOP,WAVPO,CAQKI,yBAAAA,CAEiDC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAV3GN,EAAAA,GAAAA,SAAAA;cAAcJ,GAAAA,QAAAA,GAAAA,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;oBAEqDO;QAAgBD,EAYrEI,OAZqEJ,CAY7DL,kBAZkGO,CAAAA;OAApGb,EAAAA;IAEaF,YAAAA,EAAAA,GAAAA;;UAAuCA,EAAAA,OAAAA,CAAAA"}
|
|
@@ -11,7 +11,7 @@ import { ToolNode } from "./tool_node.cjs";
|
|
|
11
11
|
import { All, BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
|
|
12
12
|
import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
|
|
13
13
|
import { Runnable, RunnableBinding, RunnableLike, RunnableToolLike } from "@langchain/core/runnables";
|
|
14
|
-
import * as
|
|
14
|
+
import * as _langchain_core_messages13 from "@langchain/core/messages";
|
|
15
15
|
import { BaseMessage, BaseMessageLike, SystemMessage } from "@langchain/core/messages";
|
|
16
16
|
import { DynamicTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
17
17
|
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
@@ -50,7 +50,7 @@ type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => Ba
|
|
|
50
50
|
declare const createReactAgentAnnotation: <
|
|
51
51
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
52
|
T extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{
|
|
53
|
-
messages: BinaryOperatorAggregate<BaseMessage<
|
|
53
|
+
messages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages13.MessageStructure, _langchain_core_messages13.MessageType>[], Messages>;
|
|
54
54
|
structuredResponse: {
|
|
55
55
|
(): LastValue<T>;
|
|
56
56
|
(annotation: SingleReducer<T, T>): BinaryOperatorAggregate<T, T>;
|
|
@@ -58,7 +58,7 @@ T extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{
|
|
|
58
58
|
};
|
|
59
59
|
}>;
|
|
60
60
|
declare const PreHookAnnotation: AnnotationRoot<{
|
|
61
|
-
llmInputMessages: BinaryOperatorAggregate<BaseMessage<
|
|
61
|
+
llmInputMessages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages13.MessageStructure, _langchain_core_messages13.MessageType>[], Messages>;
|
|
62
62
|
}>;
|
|
63
63
|
type PreHookAnnotation = typeof PreHookAnnotation;
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react_agent_executor.d.cts","names":["_langchain_core_messages21","_langchain_core_language_models_chat_models0","___web_js2","BaseChatModel","LanguageModelLike","BaseMessage","BaseMessageLike","SystemMessage","Runnable","RunnableToolLike","RunnableSequence","RunnableBinding","RunnableLike","DynamicTool","StructuredToolInterface","InteropZodObject","InteropZodType","All","BaseCheckpointSaver","BaseStore","CompiledStateGraph","AnnotationRoot","MessagesAnnotation","ToolNode","LangGraphRunnableConfig","Runtime","Messages","START","InteropZodToStateDefinition","AgentState","Record","StructuredResponseType","N","StructuredResponseSchemaOptions","ServerTool","ClientTool","ConfigurableModelInterface","Promise","_shouldBindTools","_bindTools","_langchain_core_language_models_base0","BaseLanguageModelInput","MessageStructure","AIMessageChunk","BaseChatModelCallOptions","_getModel","Prompt","State","StateModifier","MessageModifier","createReactAgentAnnotation","MessageType","BinaryOperatorAggregate","T","LastValue","SingleReducer","StateDefinition","S","PreHookAnnotation","AnyAnnotationRoot","ToAnnotationRoot","A","CreateReactAgentParams","C","createReactAgent","StructuredResponseFormat","spec","ReturnType"],"sources":["../../src/prebuilt/react_agent_executor.d.ts"],"sourcesContent":["import { BaseChatModel } from \"@langchain/core/language_models/chat_models\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseMessage, BaseMessageLike, SystemMessage } from \"@langchain/core/messages\";\nimport { Runnable, RunnableToolLike, RunnableSequence, RunnableBinding, type RunnableLike } from \"@langchain/core/runnables\";\nimport { DynamicTool, StructuredToolInterface } from \"@langchain/core/tools\";\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { All, BaseCheckpointSaver, BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { type CompiledStateGraph, AnnotationRoot } from \"../graph/index.js\";\nimport { MessagesAnnotation } from \"../graph/messages_annotation.js\";\nimport { ToolNode } from \"./tool_node.js\";\nimport { LangGraphRunnableConfig, Runtime } from \"../pregel/runnable_types.js\";\nimport { Messages } from \"../graph/message.js\";\nimport { START } from \"../constants.js\";\nimport type { InteropZodToStateDefinition } from \"../graph/zod/meta.js\";\n/**\n * @deprecated `AgentState` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { AgentState } from \"langchain\";`\n */\nexport interface AgentState<\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>> {\n messages: BaseMessage[];\n // TODO: This won't be set until we\n // implement managed values in LangGraphJS\n // Will be useful for inserting a message on\n // graph recursion end\n // is_last_step: boolean;\n structuredResponse: StructuredResponseType;\n}\nexport type N = typeof START | \"agent\" | \"tools\";\ntype StructuredResponseSchemaOptions<StructuredResponseType> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: InteropZodType<StructuredResponseType> | Record<string, any>;\n prompt?: string;\n strict?: boolean;\n [key: string]: unknown;\n};\ntype ServerTool = Record<string, unknown>;\ntype ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\ninterface ConfigurableModelInterface {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _queuedMethodOperations: Record<string, any>;\n _model: () => Promise<BaseChatModel>;\n}\nexport declare function _shouldBindTools(llm: LanguageModelLike, tools: (ClientTool | ServerTool)[]): Promise<boolean>;\nexport declare function _bindTools(llm: LanguageModelLike, toolClasses: (ClientTool | ServerTool)[]): Promise<Runnable<import(\"@langchain/core/language_models/base\").BaseLanguageModelInput, import(\"@langchain/core/messages\").AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>, import(\"@langchain/core/language_models/chat_models\").BaseChatModelCallOptions> | RunnableBinding<any, any, any> | RunnableSequence<any, any>>;\nexport declare function _getModel(llm: LanguageModelLike | ConfigurableModelInterface): Promise<LanguageModelLike>;\nexport type Prompt = SystemMessage | string | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => BaseMessageLike[]) | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => Promise<BaseMessageLike[]>) | Runnable;\n/** @deprecated Use Prompt instead. */\nexport type StateModifier = Prompt;\n/** @deprecated Use Prompt instead. */\nexport type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;\nexport declare const createReactAgentAnnotation: <\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nT extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n structuredResponse: {\n (): import(\"../web.js\").LastValue<T>;\n (annotation: import(\"../web.js\").SingleReducer<T, T>): import(\"../web.js\").BinaryOperatorAggregate<T, T>;\n Root: <S extends import(\"../web.js\").StateDefinition>(sd: S) => AnnotationRoot<S>;\n };\n}>;\ndeclare const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\ntype PreHookAnnotation = typeof PreHookAnnotation;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyAnnotationRoot = AnnotationRoot<any>;\ntype ToAnnotationRoot<A extends AnyAnnotationRoot | InteropZodObject> = A extends AnyAnnotationRoot ? A : A extends InteropZodObject ? AnnotationRoot<InteropZodToStateDefinition<A>> : never;\n/**\n * @deprecated `CreateReactAgentParams` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { CreateAgentParams } from \"langchain\";`\n */\nexport type CreateReactAgentParams<A extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot> = {\n /** The chat model that can utilize OpenAI-style tool calling. */\n llm: LanguageModelLike | ((state: ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], runtime: Runtime<ToAnnotationRoot<C>[\"State\"]>) => Promise<LanguageModelLike> | LanguageModelLike);\n /** A list of tools or a ToolNode. */\n tools: ToolNode | (ServerTool | ClientTool)[];\n /**\n * @deprecated Use prompt instead.\n */\n messageModifier?: MessageModifier;\n /**\n * @deprecated Use prompt instead.\n */\n stateModifier?: StateModifier;\n /**\n * An optional prompt for the LLM. This takes full graph state BEFORE the LLM is called and prepares the input to LLM.\n *\n * Can take a few different forms:\n *\n * - str: This is converted to a SystemMessage and added to the beginning of the list of messages in state[\"messages\"].\n * - SystemMessage: this is added to the beginning of the list of messages in state[\"messages\"].\n * - Function: This function should take in full graph state and the output is then passed to the language model.\n * - Runnable: This runnable should take in full graph state and the output is then passed to the language model.\n *\n * Note:\n * Prior to `v0.2.46`, the prompt was set using `stateModifier` / `messagesModifier` parameters.\n * This is now deprecated and will be removed in a future release.\n */\n prompt?: Prompt;\n /**\n * Additional state schema for the agent.\n */\n stateSchema?: A;\n /**\n * An optional schema for the context.\n */\n contextSchema?: C;\n /** An optional checkpoint saver to persist the agent's state. */\n checkpointSaver?: BaseCheckpointSaver | boolean;\n /** An optional checkpoint saver to persist the agent's state. Alias of \"checkpointSaver\". */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** An optional list of node names to interrupt before running. */\n interruptBefore?: N[] | All;\n /** An optional list of node names to interrupt after running. */\n interruptAfter?: N[] | All;\n store?: BaseStore;\n /**\n * An optional schema for the final agent output.\n *\n * If provided, output will be formatted to match the given schema and returned in the 'structuredResponse' state key.\n * If not provided, `structuredResponse` will not be present in the output state.\n *\n * Can be passed in as:\n * - Zod schema\n * - JSON schema\n * - { prompt, schema }, where schema is one of the above.\n * The prompt will be used together with the model that is being used to generate the structured response.\n *\n * @remarks\n * **Important**: `responseFormat` requires the model to support `.withStructuredOutput()`.\n *\n * **Note**: The graph will make a separate call to the LLM to generate the structured response after the agent loop is finished.\n * This is not the only strategy to get structured responses, see more options in [this guide](https://langchain-ai.github.io/langgraph/how-tos/react-agent-structured-output/).\n */\n responseFormat?: InteropZodType<StructuredResponseType> | StructuredResponseSchemaOptions<StructuredResponseType>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>;\n /**\n * An optional name for the agent.\n */\n name?: string;\n /**\n * An optional description for the agent.\n * This can be used to describe the agent to the underlying supervisor LLM.\n */\n description?: string | undefined;\n /**\n * Use to specify how to expose the agent name to the underlying supervisor LLM.\n \n - undefined: Relies on the LLM provider {@link AIMessage#name}. Currently, only OpenAI supports this.\n - `\"inline\"`: Add the agent name directly into the content field of the {@link AIMessage} using XML-style tags.\n Example: `\"How can I help you\"` -> `\"<name>agent_name</name><content>How can I help you?</content>\"`\n */\n includeAgentName?: \"inline\" | undefined;\n /**\n * An optional node to add before the `agent` node (i.e., the node that calls the LLM).\n * Useful for managing long message histories (e.g., message trimming, summarization, etc.).\n */\n preModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], ToAnnotationRoot<A>[\"Update\"] & PreHookAnnotation[\"Update\"], LangGraphRunnableConfig>;\n /**\n * An optional node to add after the `agent` node (i.e., the node that calls the LLM).\n * Useful for implementing human-in-the-loop, guardrails, validation, or other post-processing.\n */\n postModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], LangGraphRunnableConfig>;\n /**\n * Determines the version of the graph to create.\n *\n * Can be one of\n * - `\"v1\"`: The tool node processes a single message. All tool calls in the message are\n * executed in parallel within the tool node.\n * - `\"v2\"`: The tool node processes a single tool call. Tool calls are distributed across\n * multiple instances of the tool node using the Send API.\n *\n * @default `\"v1\"`\n */\n version?: \"v1\" | \"v2\";\n};\n/**\n * @deprecated `createReactAgent` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { createAgent } from \"langchain\";`\n *\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n * import { createReactAgent } from \"@langchain/langgraph/prebuilt\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\n *\n * const getWeather = tool((input) => {\n * if ([\"sf\", \"san francisco\"].includes(input.location.toLowerCase())) {\n * return \"It's 60 degrees and foggy.\";\n * } else {\n * return \"It's 90 degrees and sunny.\";\n * }\n * }, {\n * name: \"get_weather\",\n * description: \"Call to get the current weather.\",\n * schema: z.object({\n * location: z.string().describe(\"Location to get the weather for.\"),\n * })\n * })\n *\n * const agent = createReactAgent({ llm: model, tools: [getWeather] });\n *\n * const inputs = {\n * messages: [{ role: \"user\", content: \"what is the weather in SF?\" }],\n * };\n *\n * const stream = await agent.stream(inputs, { streamMode: \"values\" });\n *\n * for await (const { messages } of stream) {\n * console.log(messages);\n * }\n * // Returns the messages in the state at each step of execution\n * ```\n */\nexport declare function createReactAgent<A extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseFormat extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<A, StructuredResponseFormat, C>): CompiledStateGraph<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, typeof MessagesAnnotation.spec & ToAnnotationRoot<A>[\"spec\"], ReturnType<typeof createReactAgentAnnotation<StructuredResponseFormat>>[\"spec\"] & ToAnnotationRoot<A>[\"spec\"]>;\nexport {};\n"],"mappings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A,SAAAA;;;;;;;kBAsBYlB,CAAAA,EAAAA,QAAAA,GAAAA,SAAAA;;;;;cAK2EY,CAAAA,EAL3EZ,YAK2EY,CAL9DoC,gBAK8DpC,CAL7CqC,CAK6CrC,CAAAA,CAAAA,OAAAA,CAAAA,GAL/BkC,iBAK+BlC,CAAAA,OAAAA,CAAAA,EALHoC,gBAKGpC,CALcqC,CAKdrC,CAAAA,CAAAA,QAAAA,CAAAA,GAL6BkC,iBAK7BlC,CAAAA,QAAAA,CAAAA,EAL0DA,uBAK1DA,CAAAA;;;AA2D9F;;eAAmDmC,CAAAA,EA3D/B/C,YA2D+B+C,CA3DlBC,gBA2DkBD,CA3DDE,CA2DCF,CAAAA,CAAAA,OAAAA,CAAAA,EA3DYC,gBA2DZD,CA3D6BE,CA2D7BF,CAAAA,CAAAA,QAAAA,CAAAA,EA3D2CnC,uBA2D3CmC,CAAAA;;;;;;;;;;;;SAEkME,CAAAA,EAAAA,IAAAA,GAAAA,IAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAF7NG,2BAA2BL,oBAAoB5C,0BAA0BO;;iCAEhEQ,sBAAsBA,+BAA+B6B,oBAAoB5C,mBAAmB4C,2BAA2BG,uBAAuBD,GAAGI,0BAA0BF,KAAK3C,mBAAmBwC,iBAAiBC,aAAaD,iBAAiBC;;YAEvQvC,kBAAAA,CAAmB4C,OAAON,iBAAiBC,YAAYM,kBAAkBjB,2BAA2Be,qCAAqCL,iBAAiBC"}
|
|
1
|
+
{"version":3,"file":"react_agent_executor.d.cts","names":["_langchain_core_messages13","_langchain_core_language_models_chat_models0","___web_js1","BaseChatModel","LanguageModelLike","BaseMessage","BaseMessageLike","SystemMessage","Runnable","RunnableToolLike","RunnableSequence","RunnableBinding","RunnableLike","DynamicTool","StructuredToolInterface","InteropZodObject","InteropZodType","All","BaseCheckpointSaver","BaseStore","CompiledStateGraph","AnnotationRoot","MessagesAnnotation","ToolNode","LangGraphRunnableConfig","Runtime","Messages","START","InteropZodToStateDefinition","AgentState","Record","StructuredResponseType","N","StructuredResponseSchemaOptions","ServerTool","ClientTool","ConfigurableModelInterface","Promise","_shouldBindTools","_bindTools","_langchain_core_language_models_base0","BaseLanguageModelInput","MessageStructure","AIMessageChunk","BaseChatModelCallOptions","_getModel","Prompt","State","StateModifier","MessageModifier","createReactAgentAnnotation","MessageType","BinaryOperatorAggregate","T","LastValue","SingleReducer","StateDefinition","S","PreHookAnnotation","AnyAnnotationRoot","ToAnnotationRoot","A","CreateReactAgentParams","C","createReactAgent","StructuredResponseFormat","spec","ReturnType"],"sources":["../../src/prebuilt/react_agent_executor.d.ts"],"sourcesContent":["import { BaseChatModel } from \"@langchain/core/language_models/chat_models\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseMessage, BaseMessageLike, SystemMessage } from \"@langchain/core/messages\";\nimport { Runnable, RunnableToolLike, RunnableSequence, RunnableBinding, type RunnableLike } from \"@langchain/core/runnables\";\nimport { DynamicTool, StructuredToolInterface } from \"@langchain/core/tools\";\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { All, BaseCheckpointSaver, BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { type CompiledStateGraph, AnnotationRoot } from \"../graph/index.js\";\nimport { MessagesAnnotation } from \"../graph/messages_annotation.js\";\nimport { ToolNode } from \"./tool_node.js\";\nimport { LangGraphRunnableConfig, Runtime } from \"../pregel/runnable_types.js\";\nimport { Messages } from \"../graph/message.js\";\nimport { START } from \"../constants.js\";\nimport type { InteropZodToStateDefinition } from \"../graph/zod/meta.js\";\n/**\n * @deprecated `AgentState` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { AgentState } from \"langchain\";`\n */\nexport interface AgentState<\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>> {\n messages: BaseMessage[];\n // TODO: This won't be set until we\n // implement managed values in LangGraphJS\n // Will be useful for inserting a message on\n // graph recursion end\n // is_last_step: boolean;\n structuredResponse: StructuredResponseType;\n}\nexport type N = typeof START | \"agent\" | \"tools\";\ntype StructuredResponseSchemaOptions<StructuredResponseType> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: InteropZodType<StructuredResponseType> | Record<string, any>;\n prompt?: string;\n strict?: boolean;\n [key: string]: unknown;\n};\ntype ServerTool = Record<string, unknown>;\ntype ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\ninterface ConfigurableModelInterface {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _queuedMethodOperations: Record<string, any>;\n _model: () => Promise<BaseChatModel>;\n}\nexport declare function _shouldBindTools(llm: LanguageModelLike, tools: (ClientTool | ServerTool)[]): Promise<boolean>;\nexport declare function _bindTools(llm: LanguageModelLike, toolClasses: (ClientTool | ServerTool)[]): Promise<Runnable<import(\"@langchain/core/language_models/base\").BaseLanguageModelInput, import(\"@langchain/core/messages\").AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>, import(\"@langchain/core/language_models/chat_models\").BaseChatModelCallOptions> | RunnableBinding<any, any, any> | RunnableSequence<any, any>>;\nexport declare function _getModel(llm: LanguageModelLike | ConfigurableModelInterface): Promise<LanguageModelLike>;\nexport type Prompt = SystemMessage | string | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => BaseMessageLike[]) | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => Promise<BaseMessageLike[]>) | Runnable;\n/** @deprecated Use Prompt instead. */\nexport type StateModifier = Prompt;\n/** @deprecated Use Prompt instead. */\nexport type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;\nexport declare const createReactAgentAnnotation: <\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nT extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n structuredResponse: {\n (): import(\"../web.js\").LastValue<T>;\n (annotation: import(\"../web.js\").SingleReducer<T, T>): import(\"../web.js\").BinaryOperatorAggregate<T, T>;\n Root: <S extends import(\"../web.js\").StateDefinition>(sd: S) => AnnotationRoot<S>;\n };\n}>;\ndeclare const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\ntype PreHookAnnotation = typeof PreHookAnnotation;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyAnnotationRoot = AnnotationRoot<any>;\ntype ToAnnotationRoot<A extends AnyAnnotationRoot | InteropZodObject> = A extends AnyAnnotationRoot ? A : A extends InteropZodObject ? AnnotationRoot<InteropZodToStateDefinition<A>> : never;\n/**\n * @deprecated `CreateReactAgentParams` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { CreateAgentParams } from \"langchain\";`\n */\nexport type CreateReactAgentParams<A extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot> = {\n /** The chat model that can utilize OpenAI-style tool calling. */\n llm: LanguageModelLike | ((state: ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], runtime: Runtime<ToAnnotationRoot<C>[\"State\"]>) => Promise<LanguageModelLike> | LanguageModelLike);\n /** A list of tools or a ToolNode. */\n tools: ToolNode | (ServerTool | ClientTool)[];\n /**\n * @deprecated Use prompt instead.\n */\n messageModifier?: MessageModifier;\n /**\n * @deprecated Use prompt instead.\n */\n stateModifier?: StateModifier;\n /**\n * An optional prompt for the LLM. This takes full graph state BEFORE the LLM is called and prepares the input to LLM.\n *\n * Can take a few different forms:\n *\n * - str: This is converted to a SystemMessage and added to the beginning of the list of messages in state[\"messages\"].\n * - SystemMessage: this is added to the beginning of the list of messages in state[\"messages\"].\n * - Function: This function should take in full graph state and the output is then passed to the language model.\n * - Runnable: This runnable should take in full graph state and the output is then passed to the language model.\n *\n * Note:\n * Prior to `v0.2.46`, the prompt was set using `stateModifier` / `messagesModifier` parameters.\n * This is now deprecated and will be removed in a future release.\n */\n prompt?: Prompt;\n /**\n * Additional state schema for the agent.\n */\n stateSchema?: A;\n /**\n * An optional schema for the context.\n */\n contextSchema?: C;\n /** An optional checkpoint saver to persist the agent's state. */\n checkpointSaver?: BaseCheckpointSaver | boolean;\n /** An optional checkpoint saver to persist the agent's state. Alias of \"checkpointSaver\". */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** An optional list of node names to interrupt before running. */\n interruptBefore?: N[] | All;\n /** An optional list of node names to interrupt after running. */\n interruptAfter?: N[] | All;\n store?: BaseStore;\n /**\n * An optional schema for the final agent output.\n *\n * If provided, output will be formatted to match the given schema and returned in the 'structuredResponse' state key.\n * If not provided, `structuredResponse` will not be present in the output state.\n *\n * Can be passed in as:\n * - Zod schema\n * - JSON schema\n * - { prompt, schema }, where schema is one of the above.\n * The prompt will be used together with the model that is being used to generate the structured response.\n *\n * @remarks\n * **Important**: `responseFormat` requires the model to support `.withStructuredOutput()`.\n *\n * **Note**: The graph will make a separate call to the LLM to generate the structured response after the agent loop is finished.\n * This is not the only strategy to get structured responses, see more options in [this guide](https://langchain-ai.github.io/langgraph/how-tos/react-agent-structured-output/).\n */\n responseFormat?: InteropZodType<StructuredResponseType> | StructuredResponseSchemaOptions<StructuredResponseType>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>;\n /**\n * An optional name for the agent.\n */\n name?: string;\n /**\n * An optional description for the agent.\n * This can be used to describe the agent to the underlying supervisor LLM.\n */\n description?: string | undefined;\n /**\n * Use to specify how to expose the agent name to the underlying supervisor LLM.\n \n - undefined: Relies on the LLM provider {@link AIMessage#name}. Currently, only OpenAI supports this.\n - `\"inline\"`: Add the agent name directly into the content field of the {@link AIMessage} using XML-style tags.\n Example: `\"How can I help you\"` -> `\"<name>agent_name</name><content>How can I help you?</content>\"`\n */\n includeAgentName?: \"inline\" | undefined;\n /**\n * An optional node to add before the `agent` node (i.e., the node that calls the LLM).\n * Useful for managing long message histories (e.g., message trimming, summarization, etc.).\n */\n preModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], ToAnnotationRoot<A>[\"Update\"] & PreHookAnnotation[\"Update\"], LangGraphRunnableConfig>;\n /**\n * An optional node to add after the `agent` node (i.e., the node that calls the LLM).\n * Useful for implementing human-in-the-loop, guardrails, validation, or other post-processing.\n */\n postModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], LangGraphRunnableConfig>;\n /**\n * Determines the version of the graph to create.\n *\n * Can be one of\n * - `\"v1\"`: The tool node processes a single message. All tool calls in the message are\n * executed in parallel within the tool node.\n * - `\"v2\"`: The tool node processes a single tool call. Tool calls are distributed across\n * multiple instances of the tool node using the Send API.\n *\n * @default `\"v1\"`\n */\n version?: \"v1\" | \"v2\";\n};\n/**\n * @deprecated `createReactAgent` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { createAgent } from \"langchain\";`\n *\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n * import { createReactAgent } from \"@langchain/langgraph/prebuilt\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\n *\n * const getWeather = tool((input) => {\n * if ([\"sf\", \"san francisco\"].includes(input.location.toLowerCase())) {\n * return \"It's 60 degrees and foggy.\";\n * } else {\n * return \"It's 90 degrees and sunny.\";\n * }\n * }, {\n * name: \"get_weather\",\n * description: \"Call to get the current weather.\",\n * schema: z.object({\n * location: z.string().describe(\"Location to get the weather for.\"),\n * })\n * })\n *\n * const agent = createReactAgent({ llm: model, tools: [getWeather] });\n *\n * const inputs = {\n * messages: [{ role: \"user\", content: \"what is the weather in SF?\" }],\n * };\n *\n * const stream = await agent.stream(inputs, { streamMode: \"values\" });\n *\n * for await (const { messages } of stream) {\n * console.log(messages);\n * }\n * // Returns the messages in the state at each step of execution\n * ```\n */\nexport declare function createReactAgent<A extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseFormat extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<A, StructuredResponseFormat, C>): CompiledStateGraph<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, typeof MessagesAnnotation.spec & ToAnnotationRoot<A>[\"spec\"], ReturnType<typeof createReactAgentAnnotation<StructuredResponseFormat>>[\"spec\"] & ToAnnotationRoot<A>[\"spec\"]>;\nexport {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;UAkBiB6B;AAAjB;+BAE+BC,MAFJ,CAAA,MAAA,EAAA,GAAA,CAAA,GAE0BA,MAF1B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;UAEIA,EACjBzB,WADiByB,EAAAA;;;;;EASnBE;EACPC,kBAAAA,EAHmBF,sBAGY;;AAETA,KAHfC,CAAAA,GAGeD,OAHJJ,KAGII,GAAAA,OAAAA,GAAAA,OAAAA;KAFtBE,+BAEOjB,CAAAA,sBAAAA,CAAAA,GAAAA;;UAAAA,eAAee,0BAA0BD;EAKhDI,MAAAA,CAAAA,EAAAA,MAAU;EACVC,MAAAA,CAAAA,EAAAA,OAAU;EAAA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;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A2D7BF,CAAAA,CAAAA,QAAAA,CAAAA,EA3D2CnC,uBA2D3CmC,CAAAA;;;;;;;;;;;;SAEkME,CAAAA,EAAAA,IAAAA,GAAAA,IAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAF7NG,2BAA2BL,oBAAoB5C,0BAA0BO;;iCAEhEQ,sBAAsBA,+BAA+B6B,oBAAoB5C,mBAAmB4C,2BAA2BG,uBAAuBD,GAAGI,0BAA0BF,KAAK3C,mBAAmBwC,iBAAiBC,aAAaD,iBAAiBC;;YAEvQvC,kBAAAA,CAAmB4C,OAAON,iBAAiBC,YAAYM,kBAAkBjB,2BAA2Be,qCAAqCL,iBAAiBC"}
|
|
@@ -10,7 +10,7 @@ import { MessagesAnnotation } from "../graph/messages_annotation.js";
|
|
|
10
10
|
import { ToolNode } from "./tool_node.js";
|
|
11
11
|
import { All, BaseCheckpointSaver, BaseStore } from "@langchain/langgraph-checkpoint";
|
|
12
12
|
import { Runnable, RunnableBinding, RunnableLike, RunnableSequence, RunnableToolLike } from "@langchain/core/runnables";
|
|
13
|
-
import * as
|
|
13
|
+
import * as _langchain_core_messages13 from "@langchain/core/messages";
|
|
14
14
|
import { BaseMessage, BaseMessageLike, SystemMessage } from "@langchain/core/messages";
|
|
15
15
|
import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
|
|
16
16
|
import { DynamicTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
@@ -50,7 +50,7 @@ type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => Ba
|
|
|
50
50
|
declare const createReactAgentAnnotation: <
|
|
51
51
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
52
|
T extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{
|
|
53
|
-
messages: BinaryOperatorAggregate<BaseMessage<
|
|
53
|
+
messages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages13.MessageStructure, _langchain_core_messages13.MessageType>[], Messages>;
|
|
54
54
|
structuredResponse: {
|
|
55
55
|
(): LastValue<T>;
|
|
56
56
|
(annotation: SingleReducer<T, T>): BinaryOperatorAggregate<T, T>;
|
|
@@ -58,7 +58,7 @@ T extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{
|
|
|
58
58
|
};
|
|
59
59
|
}>;
|
|
60
60
|
declare const PreHookAnnotation: AnnotationRoot<{
|
|
61
|
-
llmInputMessages: BinaryOperatorAggregate<BaseMessage<
|
|
61
|
+
llmInputMessages: BinaryOperatorAggregate<BaseMessage<_langchain_core_messages13.MessageStructure, _langchain_core_messages13.MessageType>[], Messages>;
|
|
62
62
|
}>;
|
|
63
63
|
type PreHookAnnotation = typeof PreHookAnnotation;
|
|
64
64
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react_agent_executor.d.ts","names":["_langchain_core_messages23","_langchain_core_language_models_chat_models0","___web_js2","BaseChatModel","LanguageModelLike","BaseMessage","BaseMessageLike","SystemMessage","Runnable","RunnableToolLike","RunnableSequence","RunnableBinding","RunnableLike","DynamicTool","StructuredToolInterface","InteropZodObject","InteropZodType","All","BaseCheckpointSaver","BaseStore","CompiledStateGraph","AnnotationRoot","MessagesAnnotation","ToolNode","LangGraphRunnableConfig","Runtime","Messages","START","InteropZodToStateDefinition","AgentState","Record","StructuredResponseType","N","StructuredResponseSchemaOptions","ServerTool","ClientTool","ConfigurableModelInterface","Promise","_shouldBindTools","_bindTools","_langchain_core_language_models_base0","BaseLanguageModelInput","MessageStructure","AIMessageChunk","BaseChatModelCallOptions","_getModel","Prompt","State","StateModifier","MessageModifier","createReactAgentAnnotation","MessageType","BinaryOperatorAggregate","T","LastValue","SingleReducer","StateDefinition","S","PreHookAnnotation","AnyAnnotationRoot","ToAnnotationRoot","A","CreateReactAgentParams","C","createReactAgent","StructuredResponseFormat","spec","ReturnType"],"sources":["../../src/prebuilt/react_agent_executor.d.ts"],"sourcesContent":["import { BaseChatModel } from \"@langchain/core/language_models/chat_models\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseMessage, BaseMessageLike, SystemMessage } from \"@langchain/core/messages\";\nimport { Runnable, RunnableToolLike, RunnableSequence, RunnableBinding, type RunnableLike } from \"@langchain/core/runnables\";\nimport { DynamicTool, StructuredToolInterface } from \"@langchain/core/tools\";\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { All, BaseCheckpointSaver, BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { type CompiledStateGraph, AnnotationRoot } from \"../graph/index.js\";\nimport { MessagesAnnotation } from \"../graph/messages_annotation.js\";\nimport { ToolNode } from \"./tool_node.js\";\nimport { LangGraphRunnableConfig, Runtime } from \"../pregel/runnable_types.js\";\nimport { Messages } from \"../graph/message.js\";\nimport { START } from \"../constants.js\";\nimport type { InteropZodToStateDefinition } from \"../graph/zod/meta.js\";\n/**\n * @deprecated `AgentState` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { AgentState } from \"langchain\";`\n */\nexport interface AgentState<\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>> {\n messages: BaseMessage[];\n // TODO: This won't be set until we\n // implement managed values in LangGraphJS\n // Will be useful for inserting a message on\n // graph recursion end\n // is_last_step: boolean;\n structuredResponse: StructuredResponseType;\n}\nexport type N = typeof START | \"agent\" | \"tools\";\ntype StructuredResponseSchemaOptions<StructuredResponseType> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: InteropZodType<StructuredResponseType> | Record<string, any>;\n prompt?: string;\n strict?: boolean;\n [key: string]: unknown;\n};\ntype ServerTool = Record<string, unknown>;\ntype ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\ninterface ConfigurableModelInterface {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _queuedMethodOperations: Record<string, any>;\n _model: () => Promise<BaseChatModel>;\n}\nexport declare function _shouldBindTools(llm: LanguageModelLike, tools: (ClientTool | ServerTool)[]): Promise<boolean>;\nexport declare function _bindTools(llm: LanguageModelLike, toolClasses: (ClientTool | ServerTool)[]): Promise<Runnable<import(\"@langchain/core/language_models/base\").BaseLanguageModelInput, import(\"@langchain/core/messages\").AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>, import(\"@langchain/core/language_models/chat_models\").BaseChatModelCallOptions> | RunnableBinding<any, any, any> | RunnableSequence<any, any>>;\nexport declare function _getModel(llm: LanguageModelLike | ConfigurableModelInterface): Promise<LanguageModelLike>;\nexport type Prompt = SystemMessage | string | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => BaseMessageLike[]) | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => Promise<BaseMessageLike[]>) | Runnable;\n/** @deprecated Use Prompt instead. */\nexport type StateModifier = Prompt;\n/** @deprecated Use Prompt instead. */\nexport type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;\nexport declare const createReactAgentAnnotation: <\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nT extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n structuredResponse: {\n (): import(\"../web.js\").LastValue<T>;\n (annotation: import(\"../web.js\").SingleReducer<T, T>): import(\"../web.js\").BinaryOperatorAggregate<T, T>;\n Root: <S extends import(\"../web.js\").StateDefinition>(sd: S) => AnnotationRoot<S>;\n };\n}>;\ndeclare const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\ntype PreHookAnnotation = typeof PreHookAnnotation;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyAnnotationRoot = AnnotationRoot<any>;\ntype ToAnnotationRoot<A extends AnyAnnotationRoot | InteropZodObject> = A extends AnyAnnotationRoot ? A : A extends InteropZodObject ? AnnotationRoot<InteropZodToStateDefinition<A>> : never;\n/**\n * @deprecated `CreateReactAgentParams` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { CreateAgentParams } from \"langchain\";`\n */\nexport type CreateReactAgentParams<A extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot> = {\n /** The chat model that can utilize OpenAI-style tool calling. */\n llm: LanguageModelLike | ((state: ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], runtime: Runtime<ToAnnotationRoot<C>[\"State\"]>) => Promise<LanguageModelLike> | LanguageModelLike);\n /** A list of tools or a ToolNode. */\n tools: ToolNode | (ServerTool | ClientTool)[];\n /**\n * @deprecated Use prompt instead.\n */\n messageModifier?: MessageModifier;\n /**\n * @deprecated Use prompt instead.\n */\n stateModifier?: StateModifier;\n /**\n * An optional prompt for the LLM. This takes full graph state BEFORE the LLM is called and prepares the input to LLM.\n *\n * Can take a few different forms:\n *\n * - str: This is converted to a SystemMessage and added to the beginning of the list of messages in state[\"messages\"].\n * - SystemMessage: this is added to the beginning of the list of messages in state[\"messages\"].\n * - Function: This function should take in full graph state and the output is then passed to the language model.\n * - Runnable: This runnable should take in full graph state and the output is then passed to the language model.\n *\n * Note:\n * Prior to `v0.2.46`, the prompt was set using `stateModifier` / `messagesModifier` parameters.\n * This is now deprecated and will be removed in a future release.\n */\n prompt?: Prompt;\n /**\n * Additional state schema for the agent.\n */\n stateSchema?: A;\n /**\n * An optional schema for the context.\n */\n contextSchema?: C;\n /** An optional checkpoint saver to persist the agent's state. */\n checkpointSaver?: BaseCheckpointSaver | boolean;\n /** An optional checkpoint saver to persist the agent's state. Alias of \"checkpointSaver\". */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** An optional list of node names to interrupt before running. */\n interruptBefore?: N[] | All;\n /** An optional list of node names to interrupt after running. */\n interruptAfter?: N[] | All;\n store?: BaseStore;\n /**\n * An optional schema for the final agent output.\n *\n * If provided, output will be formatted to match the given schema and returned in the 'structuredResponse' state key.\n * If not provided, `structuredResponse` will not be present in the output state.\n *\n * Can be passed in as:\n * - Zod schema\n * - JSON schema\n * - { prompt, schema }, where schema is one of the above.\n * The prompt will be used together with the model that is being used to generate the structured response.\n *\n * @remarks\n * **Important**: `responseFormat` requires the model to support `.withStructuredOutput()`.\n *\n * **Note**: The graph will make a separate call to the LLM to generate the structured response after the agent loop is finished.\n * This is not the only strategy to get structured responses, see more options in [this guide](https://langchain-ai.github.io/langgraph/how-tos/react-agent-structured-output/).\n */\n responseFormat?: InteropZodType<StructuredResponseType> | StructuredResponseSchemaOptions<StructuredResponseType>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>;\n /**\n * An optional name for the agent.\n */\n name?: string;\n /**\n * An optional description for the agent.\n * This can be used to describe the agent to the underlying supervisor LLM.\n */\n description?: string | undefined;\n /**\n * Use to specify how to expose the agent name to the underlying supervisor LLM.\n \n - undefined: Relies on the LLM provider {@link AIMessage#name}. Currently, only OpenAI supports this.\n - `\"inline\"`: Add the agent name directly into the content field of the {@link AIMessage} using XML-style tags.\n Example: `\"How can I help you\"` -> `\"<name>agent_name</name><content>How can I help you?</content>\"`\n */\n includeAgentName?: \"inline\" | undefined;\n /**\n * An optional node to add before the `agent` node (i.e., the node that calls the LLM).\n * Useful for managing long message histories (e.g., message trimming, summarization, etc.).\n */\n preModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], ToAnnotationRoot<A>[\"Update\"] & PreHookAnnotation[\"Update\"], LangGraphRunnableConfig>;\n /**\n * An optional node to add after the `agent` node (i.e., the node that calls the LLM).\n * Useful for implementing human-in-the-loop, guardrails, validation, or other post-processing.\n */\n postModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], LangGraphRunnableConfig>;\n /**\n * Determines the version of the graph to create.\n *\n * Can be one of\n * - `\"v1\"`: The tool node processes a single message. All tool calls in the message are\n * executed in parallel within the tool node.\n * - `\"v2\"`: The tool node processes a single tool call. Tool calls are distributed across\n * multiple instances of the tool node using the Send API.\n *\n * @default `\"v1\"`\n */\n version?: \"v1\" | \"v2\";\n};\n/**\n * @deprecated `createReactAgent` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { createAgent } from \"langchain\";`\n *\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n * import { createReactAgent } from \"@langchain/langgraph/prebuilt\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\n *\n * const getWeather = tool((input) => {\n * if ([\"sf\", \"san francisco\"].includes(input.location.toLowerCase())) {\n * return \"It's 60 degrees and foggy.\";\n * } else {\n * return \"It's 90 degrees and sunny.\";\n * }\n * }, {\n * name: \"get_weather\",\n * description: \"Call to get the current weather.\",\n * schema: z.object({\n * location: z.string().describe(\"Location to get the weather for.\"),\n * })\n * })\n *\n * const agent = createReactAgent({ llm: model, tools: [getWeather] });\n *\n * const inputs = {\n * messages: [{ role: \"user\", content: \"what is the weather in SF?\" }],\n * };\n *\n * const stream = await agent.stream(inputs, { streamMode: \"values\" });\n *\n * for await (const { messages } of stream) {\n * console.log(messages);\n * }\n * // Returns the messages in the state at each step of execution\n * ```\n */\nexport declare function createReactAgent<A extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseFormat extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<A, StructuredResponseFormat, C>): CompiledStateGraph<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, typeof MessagesAnnotation.spec & ToAnnotationRoot<A>[\"spec\"], ReturnType<typeof createReactAgentAnnotation<StructuredResponseFormat>>[\"spec\"] & ToAnnotationRoot<A>[\"spec\"]>;\nexport {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;UAkBiB6B;AAAjB;+BAE+BC,MAFJ,CAAA,MAAA,EAAA,GAAA,CAAA,GAE0BA,MAF1B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;UAEIA,EACjBzB,WADiByB,EAAAA;;;;;EASnBE;EACPC,kBAAAA,EAHmBF,sBAGY;;AAETA,KAHfC,CAAAA,GAGeD,OAHJJ,KAGII,GAAAA,OAAAA,GAAAA,OAAAA;KAFtBE,+BAEOjB,CAAAA,sBAAAA,CAAAA,GAAAA;;UAAAA,eAAee,0BAA0BD;EAKhDI,MAAAA,CAAAA,EAAAA,MAAU;EACVC,MAAAA,CAAAA,EAAAA,OAAU;EAAA,CAAA,GAAA,EAAA,MAAA,CAAA,EAAA,OAAA;;KADVD,UAAAA,GAAaJ,MAC0BjB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;KAAvCsB,UAAAA,GAAarB,uBAAwCL,GAAdI,WAAcJ,GAAAA,gBAAAA;AASyIe,KAAvLsB,MAAAA,GAASvC,aAA8KiB,GAAAA,MAAAA,GAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAArIF,kBAAAA,CAAmByB,KAAkHvB,EAAAA,MAAAA,EAAnGA,uBAAmGA,EAAAA,GAAvElB,eAAuEkB,EAAAA,CAAAA,GAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAlCF,kBAAAA,CAAmByB,KAAevB,EAAAA,MAAAA,EAAAA,uBAAAA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qCAAqCL,iBAAiBC"}
|
|
1
|
+
{"version":3,"file":"react_agent_executor.d.ts","names":["_langchain_core_messages13","_langchain_core_language_models_chat_models0","___web_js1","BaseChatModel","LanguageModelLike","BaseMessage","BaseMessageLike","SystemMessage","Runnable","RunnableToolLike","RunnableSequence","RunnableBinding","RunnableLike","DynamicTool","StructuredToolInterface","InteropZodObject","InteropZodType","All","BaseCheckpointSaver","BaseStore","CompiledStateGraph","AnnotationRoot","MessagesAnnotation","ToolNode","LangGraphRunnableConfig","Runtime","Messages","START","InteropZodToStateDefinition","AgentState","Record","StructuredResponseType","N","StructuredResponseSchemaOptions","ServerTool","ClientTool","ConfigurableModelInterface","Promise","_shouldBindTools","_bindTools","_langchain_core_language_models_base0","BaseLanguageModelInput","MessageStructure","AIMessageChunk","BaseChatModelCallOptions","_getModel","Prompt","State","StateModifier","MessageModifier","createReactAgentAnnotation","MessageType","BinaryOperatorAggregate","T","LastValue","SingleReducer","StateDefinition","S","PreHookAnnotation","AnyAnnotationRoot","ToAnnotationRoot","A","CreateReactAgentParams","C","createReactAgent","StructuredResponseFormat","spec","ReturnType"],"sources":["../../src/prebuilt/react_agent_executor.d.ts"],"sourcesContent":["import { BaseChatModel } from \"@langchain/core/language_models/chat_models\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { BaseMessage, BaseMessageLike, SystemMessage } from \"@langchain/core/messages\";\nimport { Runnable, RunnableToolLike, RunnableSequence, RunnableBinding, type RunnableLike } from \"@langchain/core/runnables\";\nimport { DynamicTool, StructuredToolInterface } from \"@langchain/core/tools\";\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { All, BaseCheckpointSaver, BaseStore } from \"@langchain/langgraph-checkpoint\";\nimport { type CompiledStateGraph, AnnotationRoot } from \"../graph/index.js\";\nimport { MessagesAnnotation } from \"../graph/messages_annotation.js\";\nimport { ToolNode } from \"./tool_node.js\";\nimport { LangGraphRunnableConfig, Runtime } from \"../pregel/runnable_types.js\";\nimport { Messages } from \"../graph/message.js\";\nimport { START } from \"../constants.js\";\nimport type { InteropZodToStateDefinition } from \"../graph/zod/meta.js\";\n/**\n * @deprecated `AgentState` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { AgentState } from \"langchain\";`\n */\nexport interface AgentState<\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>> {\n messages: BaseMessage[];\n // TODO: This won't be set until we\n // implement managed values in LangGraphJS\n // Will be useful for inserting a message on\n // graph recursion end\n // is_last_step: boolean;\n structuredResponse: StructuredResponseType;\n}\nexport type N = typeof START | \"agent\" | \"tools\";\ntype StructuredResponseSchemaOptions<StructuredResponseType> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n schema: InteropZodType<StructuredResponseType> | Record<string, any>;\n prompt?: string;\n strict?: boolean;\n [key: string]: unknown;\n};\ntype ServerTool = Record<string, unknown>;\ntype ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\ninterface ConfigurableModelInterface {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n _queuedMethodOperations: Record<string, any>;\n _model: () => Promise<BaseChatModel>;\n}\nexport declare function _shouldBindTools(llm: LanguageModelLike, tools: (ClientTool | ServerTool)[]): Promise<boolean>;\nexport declare function _bindTools(llm: LanguageModelLike, toolClasses: (ClientTool | ServerTool)[]): Promise<Runnable<import(\"@langchain/core/language_models/base\").BaseLanguageModelInput, import(\"@langchain/core/messages\").AIMessageChunk<import(\"@langchain/core/messages\").MessageStructure>, import(\"@langchain/core/language_models/chat_models\").BaseChatModelCallOptions> | RunnableBinding<any, any, any> | RunnableSequence<any, any>>;\nexport declare function _getModel(llm: LanguageModelLike | ConfigurableModelInterface): Promise<LanguageModelLike>;\nexport type Prompt = SystemMessage | string | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => BaseMessageLike[]) | ((state: typeof MessagesAnnotation.State, config: LangGraphRunnableConfig) => Promise<BaseMessageLike[]>) | Runnable;\n/** @deprecated Use Prompt instead. */\nexport type StateModifier = Prompt;\n/** @deprecated Use Prompt instead. */\nexport type MessageModifier = SystemMessage | string | ((messages: BaseMessage[]) => BaseMessage[]) | ((messages: BaseMessage[]) => Promise<BaseMessage[]>) | Runnable;\nexport declare const createReactAgentAnnotation: <\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nT extends Record<string, any> = Record<string, any>>() => AnnotationRoot<{\n messages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n structuredResponse: {\n (): import(\"../web.js\").LastValue<T>;\n (annotation: import(\"../web.js\").SingleReducer<T, T>): import(\"../web.js\").BinaryOperatorAggregate<T, T>;\n Root: <S extends import(\"../web.js\").StateDefinition>(sd: S) => AnnotationRoot<S>;\n };\n}>;\ndeclare const PreHookAnnotation: AnnotationRoot<{\n llmInputMessages: import(\"../web.js\").BinaryOperatorAggregate<BaseMessage<import(\"@langchain/core/messages\").MessageStructure, import(\"@langchain/core/messages\").MessageType>[], Messages>;\n}>;\ntype PreHookAnnotation = typeof PreHookAnnotation;\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\ntype AnyAnnotationRoot = AnnotationRoot<any>;\ntype ToAnnotationRoot<A extends AnyAnnotationRoot | InteropZodObject> = A extends AnyAnnotationRoot ? A : A extends InteropZodObject ? AnnotationRoot<InteropZodToStateDefinition<A>> : never;\n/**\n * @deprecated `CreateReactAgentParams` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { CreateAgentParams } from \"langchain\";`\n */\nexport type CreateReactAgentParams<A extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseType extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot> = {\n /** The chat model that can utilize OpenAI-style tool calling. */\n llm: LanguageModelLike | ((state: ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], runtime: Runtime<ToAnnotationRoot<C>[\"State\"]>) => Promise<LanguageModelLike> | LanguageModelLike);\n /** A list of tools or a ToolNode. */\n tools: ToolNode | (ServerTool | ClientTool)[];\n /**\n * @deprecated Use prompt instead.\n */\n messageModifier?: MessageModifier;\n /**\n * @deprecated Use prompt instead.\n */\n stateModifier?: StateModifier;\n /**\n * An optional prompt for the LLM. This takes full graph state BEFORE the LLM is called and prepares the input to LLM.\n *\n * Can take a few different forms:\n *\n * - str: This is converted to a SystemMessage and added to the beginning of the list of messages in state[\"messages\"].\n * - SystemMessage: this is added to the beginning of the list of messages in state[\"messages\"].\n * - Function: This function should take in full graph state and the output is then passed to the language model.\n * - Runnable: This runnable should take in full graph state and the output is then passed to the language model.\n *\n * Note:\n * Prior to `v0.2.46`, the prompt was set using `stateModifier` / `messagesModifier` parameters.\n * This is now deprecated and will be removed in a future release.\n */\n prompt?: Prompt;\n /**\n * Additional state schema for the agent.\n */\n stateSchema?: A;\n /**\n * An optional schema for the context.\n */\n contextSchema?: C;\n /** An optional checkpoint saver to persist the agent's state. */\n checkpointSaver?: BaseCheckpointSaver | boolean;\n /** An optional checkpoint saver to persist the agent's state. Alias of \"checkpointSaver\". */\n checkpointer?: BaseCheckpointSaver | boolean;\n /** An optional list of node names to interrupt before running. */\n interruptBefore?: N[] | All;\n /** An optional list of node names to interrupt after running. */\n interruptAfter?: N[] | All;\n store?: BaseStore;\n /**\n * An optional schema for the final agent output.\n *\n * If provided, output will be formatted to match the given schema and returned in the 'structuredResponse' state key.\n * If not provided, `structuredResponse` will not be present in the output state.\n *\n * Can be passed in as:\n * - Zod schema\n * - JSON schema\n * - { prompt, schema }, where schema is one of the above.\n * The prompt will be used together with the model that is being used to generate the structured response.\n *\n * @remarks\n * **Important**: `responseFormat` requires the model to support `.withStructuredOutput()`.\n *\n * **Note**: The graph will make a separate call to the LLM to generate the structured response after the agent loop is finished.\n * This is not the only strategy to get structured responses, see more options in [this guide](https://langchain-ai.github.io/langgraph/how-tos/react-agent-structured-output/).\n */\n responseFormat?: InteropZodType<StructuredResponseType> | StructuredResponseSchemaOptions<StructuredResponseType>\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n | Record<string, any>;\n /**\n * An optional name for the agent.\n */\n name?: string;\n /**\n * An optional description for the agent.\n * This can be used to describe the agent to the underlying supervisor LLM.\n */\n description?: string | undefined;\n /**\n * Use to specify how to expose the agent name to the underlying supervisor LLM.\n \n - undefined: Relies on the LLM provider {@link AIMessage#name}. Currently, only OpenAI supports this.\n - `\"inline\"`: Add the agent name directly into the content field of the {@link AIMessage} using XML-style tags.\n Example: `\"How can I help you\"` -> `\"<name>agent_name</name><content>How can I help you?</content>\"`\n */\n includeAgentName?: \"inline\" | undefined;\n /**\n * An optional node to add before the `agent` node (i.e., the node that calls the LLM).\n * Useful for managing long message histories (e.g., message trimming, summarization, etc.).\n */\n preModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"] & PreHookAnnotation[\"State\"], ToAnnotationRoot<A>[\"Update\"] & PreHookAnnotation[\"Update\"], LangGraphRunnableConfig>;\n /**\n * An optional node to add after the `agent` node (i.e., the node that calls the LLM).\n * Useful for implementing human-in-the-loop, guardrails, validation, or other post-processing.\n */\n postModelHook?: RunnableLike<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], LangGraphRunnableConfig>;\n /**\n * Determines the version of the graph to create.\n *\n * Can be one of\n * - `\"v1\"`: The tool node processes a single message. All tool calls in the message are\n * executed in parallel within the tool node.\n * - `\"v2\"`: The tool node processes a single tool call. Tool calls are distributed across\n * multiple instances of the tool node using the Send API.\n *\n * @default `\"v1\"`\n */\n version?: \"v1\" | \"v2\";\n};\n/**\n * @deprecated `createReactAgent` has been moved to {@link https://www.npmjs.com/package/langchain langchain} package.\n * Update your import to `import { createAgent } from \"langchain\";`\n *\n * Creates a StateGraph agent that relies on a chat model utilizing tool calling.\n *\n * @example\n * ```ts\n * import { ChatOpenAI } from \"@langchain/openai\";\n * import { tool } from \"@langchain/core/tools\";\n * import { z } from \"zod\";\n * import { createReactAgent } from \"@langchain/langgraph/prebuilt\";\n *\n * const model = new ChatOpenAI({\n * model: \"gpt-4o\",\n * });\n *\n * const getWeather = tool((input) => {\n * if ([\"sf\", \"san francisco\"].includes(input.location.toLowerCase())) {\n * return \"It's 60 degrees and foggy.\";\n * } else {\n * return \"It's 90 degrees and sunny.\";\n * }\n * }, {\n * name: \"get_weather\",\n * description: \"Call to get the current weather.\",\n * schema: z.object({\n * location: z.string().describe(\"Location to get the weather for.\"),\n * })\n * })\n *\n * const agent = createReactAgent({ llm: model, tools: [getWeather] });\n *\n * const inputs = {\n * messages: [{ role: \"user\", content: \"what is the weather in SF?\" }],\n * };\n *\n * const stream = await agent.stream(inputs, { streamMode: \"values\" });\n *\n * for await (const { messages } of stream) {\n * console.log(messages);\n * }\n * // Returns the messages in the state at each step of execution\n * ```\n */\nexport declare function createReactAgent<A extends AnyAnnotationRoot | InteropZodObject = typeof MessagesAnnotation, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nStructuredResponseFormat extends Record<string, any> = Record<string, any>, C extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot>(params: CreateReactAgentParams<A, StructuredResponseFormat, C>): CompiledStateGraph<ToAnnotationRoot<A>[\"State\"], ToAnnotationRoot<A>[\"Update\"], \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nany, typeof MessagesAnnotation.spec & ToAnnotationRoot<A>[\"spec\"], ReturnType<typeof createReactAgentAnnotation<StructuredResponseFormat>>[\"spec\"] & ToAnnotationRoot<A>[\"spec\"]>;\nexport {};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;UAkBiB6B;AAAjB;+BAE+BC,MAFJ,CAAA,MAAA,EAAA,GAAA,CAAA,GAE0BA,MAF1B,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;UAEIA,EACjBzB,WAD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,GAL/BkC,iBAK+BlC,CAAAA,OAAAA,CAAAA,EALHoC,gBAKGpC,CALcqC,CAKdrC,CAAAA,CAAAA,QAAAA,CAAAA,GAL6BkC,iBAK7BlC,CAAAA,QAAAA,CAAAA,EAL0DA,uBAK1DA,CAAAA;;;AA2D9F;;eAAmDmC,CAAAA,EA3D/B/C,YA2D+B+C,CA3DlBC,gBA2DkBD,CA3DDE,CA2DCF,CAAAA,CAAAA,OAAAA,CAAAA,EA3DYC,gBA2DZD,CA3D6BE,CA2D7BF,CAAAA,CAAAA,QAAAA,CAAAA,EA3D2CnC,uBA2D3CmC,CAAAA;;;;;;;;;;;;SAEkME,CAAAA,EAAAA,IAAAA,GAAAA,IAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAF7NG,2BAA2BL,oBAAoB5C,0BAA0BO;;iCAEhEQ,sBAAsBA,+BAA+B6B,oBAAoB5C,mBAAmB4C,2BAA2BG,uBAAuBD,GAAGI,0BAA0BF,KAAK3C,mBAAmBwC,iBAAiBC,aAAaD,iBAAiBC;;YAEvQvC,kBAAAA,CAAmB4C,OAAON,iBAAiBC,YAAYM,kBAAkBjB,2BAA2Be,qCAAqCL,iBAAiBC"}
|
package/dist/pregel/remote.cjs
CHANGED
|
@@ -94,6 +94,7 @@ var RemoteGraph = class extends __langchain_core_runnables.Runnable {
|
|
|
94
94
|
client;
|
|
95
95
|
interruptBefore;
|
|
96
96
|
interruptAfter;
|
|
97
|
+
streamResumable;
|
|
97
98
|
constructor(params) {
|
|
98
99
|
super(params);
|
|
99
100
|
this.graphId = params.graphId;
|
|
@@ -105,6 +106,7 @@ var RemoteGraph = class extends __langchain_core_runnables.Runnable {
|
|
|
105
106
|
this.config = params.config;
|
|
106
107
|
this.interruptBefore = params.interruptBefore;
|
|
107
108
|
this.interruptAfter = params.interruptAfter;
|
|
109
|
+
this.streamResumable = params.streamResumable;
|
|
108
110
|
}
|
|
109
111
|
withConfig(config) {
|
|
110
112
|
const mergedConfig = (0, __langchain_core_runnables.mergeConfigs)(this.config, config);
|
|
@@ -237,7 +239,8 @@ var RemoteGraph = class extends __langchain_core_runnables.Runnable {
|
|
|
237
239
|
interruptAfter,
|
|
238
240
|
streamSubgraphs,
|
|
239
241
|
ifNotExists: "create",
|
|
240
|
-
signal: mergedConfig.signal
|
|
242
|
+
signal: mergedConfig.signal,
|
|
243
|
+
streamResumable: this.streamResumable
|
|
241
244
|
})) {
|
|
242
245
|
let mode;
|
|
243
246
|
let namespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.cjs","names":["updatedStreamModes: StreamMode[]","Runnable","Client","tasks: PregelTaskDescription[]","CONFIG_KEY_STREAM","isCommand","namespace: string[]","CHECKPOINT_NAMESPACE_SEPARATOR","INTERRUPT","GraphInterrupt","RemoteException","nodesMap: Record<string, DrawableNode>","DrawableGraph"],"sources":["../../src/pregel/remote.ts"],"sourcesContent":["import {\n Client,\n type Checkpoint,\n type ThreadState,\n} from \"@langchain/langgraph-sdk\";\nimport {\n Graph as DrawableGraph,\n Node as DrawableNode,\n} from \"@langchain/core/runnables/graph\";\nimport {\n mergeConfigs,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport {\n All,\n CheckpointListOptions,\n CheckpointMetadata,\n} from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { isBaseMessage } from \"@langchain/core/messages\";\n\nimport {\n BaseChannel,\n GraphInterrupt,\n LangGraphRunnableConfig,\n RemoteException,\n} from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport {\n PregelParams,\n PregelInterface,\n PregelTaskDescription,\n StateSnapshot,\n StreamMode,\n} from \"./types.js\";\nimport {\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_STREAM,\n INTERRUPT,\n isCommand,\n} from \"../constants.js\";\n\nexport type RemoteGraphParams = Omit<\n PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>,\n \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"\n> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _serializeInputs = (obj: any): any => {\n if (obj === null || typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(_serializeInputs);\n }\n\n // Handle BaseMessage instances by converting them to a serializable format\n if (isBaseMessage(obj)) {\n const dict = obj.toDict();\n return {\n ...dict.data,\n role: obj.getType(),\n };\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [key, _serializeInputs(value)])\n );\n};\n\n/**\n * Return a tuple of the final list of stream modes sent to the\n * remote graph and a boolean flag indicating if only one stream mode was\n * originally requested and whether stream mode 'updates'\n * was present in the original list of stream modes.\n *\n * 'updates' mode is always added to the list of stream modes so that interrupts\n * can be detected in the remote graph.\n */\nconst getStreamModes = (\n streamMode?: StreamMode | StreamMode[],\n defaultStreamMode: StreamMode = \"updates\"\n) => {\n const updatedStreamModes: StreamMode[] = [];\n let reqUpdates = false;\n let reqSingle = true;\n\n if (\n streamMode !== undefined &&\n (typeof streamMode === \"string\" ||\n (Array.isArray(streamMode) && streamMode.length > 0))\n ) {\n reqSingle = typeof streamMode === \"string\";\n const mapped = Array.isArray(streamMode) ? streamMode : [streamMode];\n updatedStreamModes.push(...mapped);\n } else {\n updatedStreamModes.push(defaultStreamMode);\n }\n if (updatedStreamModes.includes(\"updates\")) {\n reqUpdates = true;\n } else {\n updatedStreamModes.push(\"updates\");\n }\n return {\n updatedStreamModes,\n reqUpdates,\n reqSingle,\n };\n};\n\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport class RemoteGraph<\n Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>,\n Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = StrRecord<string, any>\n >\n extends Runnable<\n PregelInputType,\n PregelOutputType,\n PregelOptions<Nn, Cc, ContextType>\n >\n implements PregelInterface<Nn, Cc, ContextType>\n{\n static lc_name() {\n return \"RemoteGraph\";\n }\n\n lc_namespace = [\"langgraph\", \"pregel\"];\n\n lg_is_pregel = true;\n\n config?: RunnableConfig;\n\n graphId: string;\n\n protected client: Client;\n\n protected interruptBefore?: Array<keyof Nn> | All;\n\n protected interruptAfter?: Array<keyof Nn> | All;\n\n constructor(params: RemoteGraphParams) {\n super(params);\n\n this.graphId = params.graphId;\n this.client =\n params.client ??\n new Client({\n apiUrl: params.url,\n apiKey: params.apiKey,\n defaultHeaders: params.headers,\n });\n this.config = params.config;\n this.interruptBefore = params.interruptBefore;\n this.interruptAfter = params.interruptAfter;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n override withConfig(config: RunnableConfig): typeof this {\n const mergedConfig = mergeConfigs(this.config, config);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.constructor as any)({ ...this, config: mergedConfig });\n }\n\n protected _sanitizeConfig(config: RunnableConfig) {\n const reservedConfigurableKeys = new Set([\n \"callbacks\",\n \"checkpoint_map\",\n \"checkpoint_id\",\n \"checkpoint_ns\",\n ]);\n\n const sanitizeObj = <T>(obj: T): T => {\n try {\n // This will only throw if we're trying to serialize a circular reference\n // or trying to serialize a BigInt...\n JSON.stringify(obj);\n return obj;\n } catch {\n const seen = new WeakSet();\n return JSON.parse(\n JSON.stringify(obj, (_, value) => {\n if (typeof value === \"object\" && value != null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n\n if (typeof value === \"bigint\") return value.toString();\n return value;\n })\n );\n }\n };\n\n // Remove non-JSON serializable fields from the config\n const sanitizedConfig = sanitizeObj(config);\n\n // Only include configurable keys that are not reserved and\n // not starting with \"__pregel_\" prefix\n const newConfigurable = Object.fromEntries(\n Object.entries(sanitizedConfig.configurable ?? {}).filter(\n ([k]) => !reservedConfigurableKeys.has(k) && !k.startsWith(\"__pregel_\")\n )\n );\n\n return {\n tags: sanitizedConfig.tags ?? [],\n metadata: sanitizedConfig.metadata ?? {},\n configurable: newConfigurable,\n recursion_limit: sanitizedConfig.recursionLimit,\n };\n }\n\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig {\n return {\n configurable: {\n thread_id: checkpoint.thread_id,\n checkpoint_ns: checkpoint.checkpoint_ns,\n checkpoint_id: checkpoint.checkpoint_id,\n checkpoint_map: checkpoint.checkpoint_map ?? {},\n },\n };\n }\n\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined {\n if (config?.configurable === undefined) {\n return undefined;\n }\n\n const checkpointKeys = [\n \"thread_id\",\n \"checkpoint_ns\",\n \"checkpoint_id\",\n \"checkpoint_map\",\n ] as const;\n\n const checkpoint = Object.fromEntries(\n checkpointKeys\n .map((key) => [key, config.configurable![key]])\n .filter(([_, value]) => value !== undefined)\n );\n\n return Object.keys(checkpoint).length > 0 ? checkpoint : undefined;\n }\n\n protected _createStateSnapshot(state: ThreadState): StateSnapshot {\n const tasks: PregelTaskDescription[] = state.tasks.map((task) => {\n return {\n id: task.id,\n name: task.name,\n error: task.error ? { message: task.error } : undefined,\n // TODO: remove in LangGraph.js 0.4\n interrupts: task.interrupts.map(({ id, ...rest }) => ({\n interrupt_id: id,\n ...rest,\n })),\n // eslint-disable-next-line no-nested-ternary\n state: task.state\n ? this._createStateSnapshot(task.state)\n : task.checkpoint\n ? { configurable: task.checkpoint }\n : undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: (task as any).result,\n };\n });\n\n return {\n values: state.values,\n next: state.next ? [...state.next] : [],\n config: {\n configurable: {\n thread_id: state.checkpoint.thread_id,\n checkpoint_ns: state.checkpoint.checkpoint_ns,\n checkpoint_id: state.checkpoint.checkpoint_id,\n checkpoint_map: state.checkpoint.checkpoint_map ?? {},\n },\n },\n metadata: state.metadata\n ? (state.metadata as CheckpointMetadata)\n : undefined,\n createdAt: state.created_at ?? undefined,\n parentConfig: state.parent_checkpoint\n ? {\n configurable: {\n thread_id: state.parent_checkpoint.thread_id,\n checkpoint_ns: state.parent_checkpoint.checkpoint_ns,\n checkpoint_id: state.parent_checkpoint.checkpoint_id,\n checkpoint_map: state.parent_checkpoint.checkpoint_map ?? {},\n },\n }\n : undefined,\n tasks,\n };\n }\n\n override async invoke(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): Promise<PregelOutputType> {\n let lastValue;\n const stream = await this.stream(input, {\n ...options,\n streamMode: \"values\",\n });\n for await (const chunk of stream) {\n lastValue = chunk;\n }\n return lastValue;\n }\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }\n ): IterableReadableStream<StreamEvent>;\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }\n ): IterableReadableStream<never>;\n\n override streamEvents(\n _input: PregelInputType,\n _options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding?: never;\n }\n ): IterableReadableStream<StreamEvent> {\n throw new Error(\"Not implemented.\");\n }\n\n override async *_streamIterator(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): AsyncGenerator<PregelOutputType> {\n const mergedConfig = mergeConfigs(this.config, options);\n const sanitizedConfig = this._sanitizeConfig(mergedConfig);\n\n const streamProtocolInstance = options?.configurable?.[CONFIG_KEY_STREAM];\n\n const streamSubgraphs =\n options?.subgraphs ?? streamProtocolInstance !== undefined;\n\n const interruptBefore = options?.interruptBefore ?? this.interruptBefore;\n const interruptAfter = options?.interruptAfter ?? this.interruptAfter;\n\n const { updatedStreamModes, reqSingle, reqUpdates } = getStreamModes(\n options?.streamMode\n );\n\n const extendedStreamModes = [\n ...new Set([\n ...updatedStreamModes,\n ...(streamProtocolInstance?.modes ?? new Set()),\n ]),\n ].map((mode) => {\n if (mode === \"messages\") return \"messages-tuple\";\n return mode;\n });\n\n let command;\n let serializedInput;\n if (isCommand(input)) {\n // TODO: Remove cast when SDK type fix gets merged\n command = input.toJSON() as Record<string, unknown>;\n serializedInput = undefined;\n } else {\n serializedInput = _serializeInputs(input);\n }\n\n for await (const chunk of this.client.runs.stream(\n sanitizedConfig.configurable.thread_id as string,\n this.graphId,\n {\n command,\n input: serializedInput,\n config: sanitizedConfig,\n streamMode: extendedStreamModes,\n interruptBefore: interruptBefore as string[],\n interruptAfter: interruptAfter as string[],\n streamSubgraphs,\n ifNotExists: \"create\",\n signal: mergedConfig.signal,\n }\n )) {\n let mode;\n let namespace: string[];\n if (chunk.event.includes(CHECKPOINT_NAMESPACE_SEPARATOR)) {\n const eventComponents = chunk.event.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n // eslint-disable-next-line prefer-destructuring\n mode = eventComponents[0];\n namespace = eventComponents.slice(1);\n } else {\n mode = chunk.event;\n namespace = [];\n }\n const callerNamespace = options?.configurable?.checkpoint_ns;\n if (typeof callerNamespace === \"string\") {\n namespace = callerNamespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .concat(namespace);\n }\n if (\n streamProtocolInstance !== undefined &&\n streamProtocolInstance.modes?.has(chunk.event)\n ) {\n streamProtocolInstance.push([namespace, mode, chunk.data]);\n }\n if (chunk.event.startsWith(\"updates\")) {\n if (\n typeof chunk.data === \"object\" &&\n chunk.data?.[INTERRUPT] !== undefined\n ) {\n throw new GraphInterrupt(chunk.data[INTERRUPT]);\n }\n if (!reqUpdates) {\n continue;\n }\n } else if (chunk.event?.startsWith(\"error\")) {\n throw new RemoteException(\n typeof chunk.data === \"string\"\n ? chunk.data\n : JSON.stringify(chunk.data)\n );\n }\n if (\n !updatedStreamModes.includes(\n chunk.event.split(CHECKPOINT_NAMESPACE_SEPARATOR)[0] as StreamMode\n )\n ) {\n continue;\n }\n if (options?.subgraphs) {\n if (reqSingle) {\n yield [namespace, chunk.data];\n } else {\n yield [namespace, mode, chunk.data];\n }\n } else if (reqSingle) {\n yield chunk.data;\n } else {\n yield [mode, chunk.data];\n }\n }\n }\n\n async updateState(\n inputConfig: LangGraphRunnableConfig,\n values: Record<string, unknown>,\n asNode?: string\n ): Promise<RunnableConfig> {\n const mergedConfig = mergeConfigs(this.config, inputConfig);\n const response = await this.client.threads.updateState(\n mergedConfig.configurable?.thread_id,\n { values, asNode, checkpoint: this._getCheckpoint(mergedConfig) }\n );\n // TODO: Fix SDK typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this._getConfig((response as any).checkpoint);\n }\n\n async *getStateHistory(\n config: RunnableConfig,\n options?: CheckpointListOptions\n ): AsyncIterableIterator<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n const states = await this.client.threads.getHistory(\n mergedConfig.configurable?.thread_id,\n {\n limit: options?.limit ?? 10,\n // TODO: Fix type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n before: this._getCheckpoint(options?.before) as any,\n metadata: options?.filter,\n checkpoint: this._getCheckpoint(mergedConfig),\n }\n );\n for (const state of states) {\n yield this._createStateSnapshot(state);\n }\n }\n\n protected _getDrawableNodes(\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>\n ): Record<string, DrawableNode> {\n const nodesMap: Record<string, DrawableNode> = {};\n for (const node of nodes) {\n const nodeId = node.id;\n nodesMap[nodeId] = {\n id: nodeId.toString(),\n name: typeof node.data === \"string\" ? node.data : node.data?.name ?? \"\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: (node.data as any) ?? {},\n metadata:\n typeof node.data !== \"string\" ? node.data?.metadata ?? {} : {},\n };\n }\n return nodesMap;\n }\n\n async getState(\n config: RunnableConfig,\n options?: { subgraphs?: boolean }\n ): Promise<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n\n const state = await this.client.threads.getState(\n mergedConfig.configurable?.thread_id,\n this._getCheckpoint(mergedConfig),\n options\n );\n return this._createStateSnapshot(state);\n }\n\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n override getGraph(\n _?: RunnableConfig & { xray?: boolean | number }\n ): DrawableGraph {\n throw new Error(\n `The synchronous \"getGraph\" is not supported for this graph. Call \"getGraphAsync\" instead.`\n );\n }\n\n /**\n * Returns a drawable representation of the computation graph.\n */\n async getGraphAsync(config?: RunnableConfig & { xray?: boolean | number }) {\n const graph = await this.client.assistants.getGraph(this.graphId, {\n xray: config?.xray,\n });\n return new DrawableGraph({\n nodes: this._getDrawableNodes(graph.nodes),\n edges: graph.edges,\n });\n }\n\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n throw new Error(\n `The synchronous \"getSubgraphs\" method is not supported for this graph. Call \"getSubgraphsAsync\" instead.`\n );\n }\n\n async *getSubgraphsAsync(\n namespace?: string,\n recurse = false\n ): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n const subgraphs = await this.client.assistants.getSubgraphs(this.graphId, {\n namespace,\n recurse,\n });\n\n for (const [ns, graphSchema] of Object.entries(subgraphs)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const remoteSubgraph = new (this.constructor as any)({\n ...this,\n graphId: graphSchema.graph_id,\n });\n yield [ns, remoteSubgraph];\n }\n }\n}\n"],"mappings":";;;;;;;;;;AA0DA,MAAM,oBAAoB,QAAkB;AAC1C,KAAI,QAAQ,QAAQ,OAAO,QAAQ,SACjC,QAAO;AAGT,KAAI,MAAM,QAAQ,KAChB,QAAO,IAAI,IAAI;AAIjB,kDAAkB,MAAM;EACtB,MAAM,OAAO,IAAI;AACjB,SAAO;GACL,GAAG,KAAK;GACR,MAAM,IAAI;;;AAId,QAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,iBAAiB;;;;;;;;;;;AAarE,MAAM,kBACJ,YACA,oBAAgC,cAC7B;CACH,MAAMA,qBAAmC;CACzC,IAAI,aAAa;CACjB,IAAI,YAAY;AAEhB,KACE,eAAe,WACd,OAAO,eAAe,YACpB,MAAM,QAAQ,eAAe,WAAW,SAAS,IACpD;AACA,cAAY,OAAO,eAAe;EAClC,MAAM,SAAS,MAAM,QAAQ,cAAc,aAAa,CAAC;AACzD,qBAAmB,KAAK,GAAG;OAE3B,oBAAmB,KAAK;AAE1B,KAAI,mBAAmB,SAAS,WAC9B,cAAa;KAEb,oBAAmB,KAAK;AAE1B,QAAO;EACL;EACA;EACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCJ,IAAa,cAAb,cAMUC,oCAMV;CACE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Y,KAAK;;;AAGlE,SAAO;;CAGT,MAAM,SACJ,QACA,SACwB;EACxB,MAAM,4DAA4B,KAAK,QAAQ;EAE/C,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,SACtC,aAAa,cAAc,WAC3B,KAAK,eAAe,eACpB;AAEF,SAAO,KAAK,qBAAqB;;;CAInC,AAAS,SACP,GACe;AACf,QAAM,IAAI,MACR;;;;;CAOJ,MAAM,cAAc,QAAuD;EACzE,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,SAAS,KAAK,SAAS,EAChE,MAAM,QAAQ;AAEhB,SAAO,IAAIC,uCAAc;GACvB,OAAO,KAAK,kBAAkB,MAAM;GACpC,OAAO,MAAM;;;;CAKjB,eAA0E;AACxE,QAAM,IAAI,MACR;;CAIJ,OAAO,kBACL,WACA,UAAU,OACsD;EAChE,MAAM,YAAY,MAAM,KAAK,OAAO,WAAW,aAAa,KAAK,SAAS;GACxE;GACA;;AAGF,OAAK,MAAM,CAAC,IAAI,gBAAgB,OAAO,QAAQ,YAAY;GAEzD,MAAM,iBAAiB,IAAK,KAAK,YAAoB;IACnD,GAAG;IACH,SAAS,YAAY;;AAEvB,SAAM,CAAC,IAAI"}
|
|
1
|
+
{"version":3,"file":"remote.cjs","names":["updatedStreamModes: StreamMode[]","Runnable","Client","tasks: PregelTaskDescription[]","CONFIG_KEY_STREAM","isCommand","namespace: string[]","CHECKPOINT_NAMESPACE_SEPARATOR","INTERRUPT","GraphInterrupt","RemoteException","nodesMap: Record<string, DrawableNode>","DrawableGraph"],"sources":["../../src/pregel/remote.ts"],"sourcesContent":["import {\n Client,\n type Checkpoint,\n type ThreadState,\n} from \"@langchain/langgraph-sdk\";\nimport {\n Graph as DrawableGraph,\n Node as DrawableNode,\n} from \"@langchain/core/runnables/graph\";\nimport {\n mergeConfigs,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport {\n All,\n CheckpointListOptions,\n CheckpointMetadata,\n} from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { isBaseMessage } from \"@langchain/core/messages\";\n\nimport {\n BaseChannel,\n GraphInterrupt,\n LangGraphRunnableConfig,\n RemoteException,\n} from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport {\n PregelParams,\n PregelInterface,\n PregelTaskDescription,\n StateSnapshot,\n StreamMode,\n} from \"./types.js\";\nimport {\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_STREAM,\n INTERRUPT,\n isCommand,\n} from \"../constants.js\";\n\nexport type RemoteGraphParams = Omit<\n PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>,\n \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"\n> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n streamResumable?: boolean;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _serializeInputs = (obj: any): any => {\n if (obj === null || typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(_serializeInputs);\n }\n\n // Handle BaseMessage instances by converting them to a serializable format\n if (isBaseMessage(obj)) {\n const dict = obj.toDict();\n return {\n ...dict.data,\n role: obj.getType(),\n };\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [key, _serializeInputs(value)])\n );\n};\n\n/**\n * Return a tuple of the final list of stream modes sent to the\n * remote graph and a boolean flag indicating if only one stream mode was\n * originally requested and whether stream mode 'updates'\n * was present in the original list of stream modes.\n *\n * 'updates' mode is always added to the list of stream modes so that interrupts\n * can be detected in the remote graph.\n */\nconst getStreamModes = (\n streamMode?: StreamMode | StreamMode[],\n defaultStreamMode: StreamMode = \"updates\"\n) => {\n const updatedStreamModes: StreamMode[] = [];\n let reqUpdates = false;\n let reqSingle = true;\n\n if (\n streamMode !== undefined &&\n (typeof streamMode === \"string\" ||\n (Array.isArray(streamMode) && streamMode.length > 0))\n ) {\n reqSingle = typeof streamMode === \"string\";\n const mapped = Array.isArray(streamMode) ? streamMode : [streamMode];\n updatedStreamModes.push(...mapped);\n } else {\n updatedStreamModes.push(defaultStreamMode);\n }\n if (updatedStreamModes.includes(\"updates\")) {\n reqUpdates = true;\n } else {\n updatedStreamModes.push(\"updates\");\n }\n return {\n updatedStreamModes,\n reqUpdates,\n reqSingle,\n };\n};\n\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport class RemoteGraph<\n Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>,\n Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = StrRecord<string, any>\n >\n extends Runnable<\n PregelInputType,\n PregelOutputType,\n PregelOptions<Nn, Cc, ContextType>\n >\n implements PregelInterface<Nn, Cc, ContextType>\n{\n static lc_name() {\n return \"RemoteGraph\";\n }\n\n lc_namespace = [\"langgraph\", \"pregel\"];\n\n lg_is_pregel = true;\n\n config?: RunnableConfig;\n\n graphId: string;\n\n protected client: Client;\n\n protected interruptBefore?: Array<keyof Nn> | All;\n\n protected interruptAfter?: Array<keyof Nn> | All;\n\n protected streamResumable?: boolean;\n\n constructor(params: RemoteGraphParams) {\n super(params);\n\n this.graphId = params.graphId;\n this.client =\n params.client ??\n new Client({\n apiUrl: params.url,\n apiKey: params.apiKey,\n defaultHeaders: params.headers,\n });\n this.config = params.config;\n this.interruptBefore = params.interruptBefore;\n this.interruptAfter = params.interruptAfter;\n this.streamResumable = params.streamResumable;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n override withConfig(config: RunnableConfig): typeof this {\n const mergedConfig = mergeConfigs(this.config, config);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.constructor as any)({ ...this, config: mergedConfig });\n }\n\n protected _sanitizeConfig(config: RunnableConfig) {\n const reservedConfigurableKeys = new Set([\n \"callbacks\",\n \"checkpoint_map\",\n \"checkpoint_id\",\n \"checkpoint_ns\",\n ]);\n\n const sanitizeObj = <T>(obj: T): T => {\n try {\n // This will only throw if we're trying to serialize a circular reference\n // or trying to serialize a BigInt...\n JSON.stringify(obj);\n return obj;\n } catch {\n const seen = new WeakSet();\n return JSON.parse(\n JSON.stringify(obj, (_, value) => {\n if (typeof value === \"object\" && value != null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n\n if (typeof value === \"bigint\") return value.toString();\n return value;\n })\n );\n }\n };\n\n // Remove non-JSON serializable fields from the config\n const sanitizedConfig = sanitizeObj(config);\n\n // Only include configurable keys that are not reserved and\n // not starting with \"__pregel_\" prefix\n const newConfigurable = Object.fromEntries(\n Object.entries(sanitizedConfig.configurable ?? {}).filter(\n ([k]) => !reservedConfigurableKeys.has(k) && !k.startsWith(\"__pregel_\")\n )\n );\n\n return {\n tags: sanitizedConfig.tags ?? [],\n metadata: sanitizedConfig.metadata ?? {},\n configurable: newConfigurable,\n recursion_limit: sanitizedConfig.recursionLimit,\n };\n }\n\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig {\n return {\n configurable: {\n thread_id: checkpoint.thread_id,\n checkpoint_ns: checkpoint.checkpoint_ns,\n checkpoint_id: checkpoint.checkpoint_id,\n checkpoint_map: checkpoint.checkpoint_map ?? {},\n },\n };\n }\n\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined {\n if (config?.configurable === undefined) {\n return undefined;\n }\n\n const checkpointKeys = [\n \"thread_id\",\n \"checkpoint_ns\",\n \"checkpoint_id\",\n \"checkpoint_map\",\n ] as const;\n\n const checkpoint = Object.fromEntries(\n checkpointKeys\n .map((key) => [key, config.configurable![key]])\n .filter(([_, value]) => value !== undefined)\n );\n\n return Object.keys(checkpoint).length > 0 ? checkpoint : undefined;\n }\n\n protected _createStateSnapshot(state: ThreadState): StateSnapshot {\n const tasks: PregelTaskDescription[] = state.tasks.map((task) => {\n return {\n id: task.id,\n name: task.name,\n error: task.error ? { message: task.error } : undefined,\n // TODO: remove in LangGraph.js 0.4\n interrupts: task.interrupts.map(({ id, ...rest }) => ({\n interrupt_id: id,\n ...rest,\n })),\n // eslint-disable-next-line no-nested-ternary\n state: task.state\n ? this._createStateSnapshot(task.state)\n : task.checkpoint\n ? { configurable: task.checkpoint }\n : undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: (task as any).result,\n };\n });\n\n return {\n values: state.values,\n next: state.next ? [...state.next] : [],\n config: {\n configurable: {\n thread_id: state.checkpoint.thread_id,\n checkpoint_ns: state.checkpoint.checkpoint_ns,\n checkpoint_id: state.checkpoint.checkpoint_id,\n checkpoint_map: state.checkpoint.checkpoint_map ?? {},\n },\n },\n metadata: state.metadata\n ? (state.metadata as CheckpointMetadata)\n : undefined,\n createdAt: state.created_at ?? undefined,\n parentConfig: state.parent_checkpoint\n ? {\n configurable: {\n thread_id: state.parent_checkpoint.thread_id,\n checkpoint_ns: state.parent_checkpoint.checkpoint_ns,\n checkpoint_id: state.parent_checkpoint.checkpoint_id,\n checkpoint_map: state.parent_checkpoint.checkpoint_map ?? {},\n },\n }\n : undefined,\n tasks,\n };\n }\n\n override async invoke(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): Promise<PregelOutputType> {\n let lastValue;\n const stream = await this.stream(input, {\n ...options,\n streamMode: \"values\",\n });\n for await (const chunk of stream) {\n lastValue = chunk;\n }\n return lastValue;\n }\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }\n ): IterableReadableStream<StreamEvent>;\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }\n ): IterableReadableStream<never>;\n\n override streamEvents(\n _input: PregelInputType,\n _options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding?: never;\n }\n ): IterableReadableStream<StreamEvent> {\n throw new Error(\"Not implemented.\");\n }\n\n override async *_streamIterator(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): AsyncGenerator<PregelOutputType> {\n const mergedConfig = mergeConfigs(this.config, options);\n const sanitizedConfig = this._sanitizeConfig(mergedConfig);\n\n const streamProtocolInstance = options?.configurable?.[CONFIG_KEY_STREAM];\n\n const streamSubgraphs =\n options?.subgraphs ?? streamProtocolInstance !== undefined;\n\n const interruptBefore = options?.interruptBefore ?? this.interruptBefore;\n const interruptAfter = options?.interruptAfter ?? this.interruptAfter;\n\n const { updatedStreamModes, reqSingle, reqUpdates } = getStreamModes(\n options?.streamMode\n );\n\n const extendedStreamModes = [\n ...new Set([\n ...updatedStreamModes,\n ...(streamProtocolInstance?.modes ?? new Set()),\n ]),\n ].map((mode) => {\n if (mode === \"messages\") return \"messages-tuple\";\n return mode;\n });\n\n let command;\n let serializedInput;\n if (isCommand(input)) {\n // TODO: Remove cast when SDK type fix gets merged\n command = input.toJSON() as Record<string, unknown>;\n serializedInput = undefined;\n } else {\n serializedInput = _serializeInputs(input);\n }\n\n for await (const chunk of this.client.runs.stream(\n sanitizedConfig.configurable.thread_id as string,\n this.graphId,\n {\n command,\n input: serializedInput,\n config: sanitizedConfig,\n streamMode: extendedStreamModes,\n interruptBefore: interruptBefore as string[],\n interruptAfter: interruptAfter as string[],\n streamSubgraphs,\n ifNotExists: \"create\",\n signal: mergedConfig.signal,\n streamResumable: this.streamResumable,\n }\n )) {\n let mode;\n let namespace: string[];\n if (chunk.event.includes(CHECKPOINT_NAMESPACE_SEPARATOR)) {\n const eventComponents = chunk.event.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n // eslint-disable-next-line prefer-destructuring\n mode = eventComponents[0];\n namespace = eventComponents.slice(1);\n } else {\n mode = chunk.event;\n namespace = [];\n }\n const callerNamespace = options?.configurable?.checkpoint_ns;\n if (typeof callerNamespace === \"string\") {\n namespace = callerNamespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .concat(namespace);\n }\n if (\n streamProtocolInstance !== undefined &&\n streamProtocolInstance.modes?.has(chunk.event)\n ) {\n streamProtocolInstance.push([namespace, mode, chunk.data]);\n }\n if (chunk.event.startsWith(\"updates\")) {\n if (\n typeof chunk.data === \"object\" &&\n chunk.data?.[INTERRUPT] !== undefined\n ) {\n throw new GraphInterrupt(chunk.data[INTERRUPT]);\n }\n if (!reqUpdates) {\n continue;\n }\n } else if (chunk.event?.startsWith(\"error\")) {\n throw new RemoteException(\n typeof chunk.data === \"string\"\n ? chunk.data\n : JSON.stringify(chunk.data)\n );\n }\n if (\n !updatedStreamModes.includes(\n chunk.event.split(CHECKPOINT_NAMESPACE_SEPARATOR)[0] as StreamMode\n )\n ) {\n continue;\n }\n if (options?.subgraphs) {\n if (reqSingle) {\n yield [namespace, chunk.data];\n } else {\n yield [namespace, mode, chunk.data];\n }\n } else if (reqSingle) {\n yield chunk.data;\n } else {\n yield [mode, chunk.data];\n }\n }\n }\n\n async updateState(\n inputConfig: LangGraphRunnableConfig,\n values: Record<string, unknown>,\n asNode?: string\n ): Promise<RunnableConfig> {\n const mergedConfig = mergeConfigs(this.config, inputConfig);\n const response = await this.client.threads.updateState(\n mergedConfig.configurable?.thread_id,\n { values, asNode, checkpoint: this._getCheckpoint(mergedConfig) }\n );\n // TODO: Fix SDK typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this._getConfig((response as any).checkpoint);\n }\n\n async *getStateHistory(\n config: RunnableConfig,\n options?: CheckpointListOptions\n ): AsyncIterableIterator<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n const states = await this.client.threads.getHistory(\n mergedConfig.configurable?.thread_id,\n {\n limit: options?.limit ?? 10,\n // TODO: Fix type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n before: this._getCheckpoint(options?.before) as any,\n metadata: options?.filter,\n checkpoint: this._getCheckpoint(mergedConfig),\n }\n );\n for (const state of states) {\n yield this._createStateSnapshot(state);\n }\n }\n\n protected _getDrawableNodes(\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>\n ): Record<string, DrawableNode> {\n const nodesMap: Record<string, DrawableNode> = {};\n for (const node of nodes) {\n const nodeId = node.id;\n nodesMap[nodeId] = {\n id: nodeId.toString(),\n name: typeof node.data === \"string\" ? node.data : node.data?.name ?? \"\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: (node.data as any) ?? {},\n metadata:\n typeof node.data !== \"string\" ? node.data?.metadata ?? {} : {},\n };\n }\n return nodesMap;\n }\n\n async getState(\n config: RunnableConfig,\n options?: { subgraphs?: boolean }\n ): Promise<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n\n const state = await this.client.threads.getState(\n mergedConfig.configurable?.thread_id,\n this._getCheckpoint(mergedConfig),\n options\n );\n return this._createStateSnapshot(state);\n }\n\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n override getGraph(\n _?: RunnableConfig & { xray?: boolean | number }\n ): DrawableGraph {\n throw new Error(\n `The synchronous \"getGraph\" is not supported for this graph. Call \"getGraphAsync\" instead.`\n );\n }\n\n /**\n * Returns a drawable representation of the computation graph.\n */\n async getGraphAsync(config?: RunnableConfig & { xray?: boolean | number }) {\n const graph = await this.client.assistants.getGraph(this.graphId, {\n xray: config?.xray,\n });\n return new DrawableGraph({\n nodes: this._getDrawableNodes(graph.nodes),\n edges: graph.edges,\n });\n }\n\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n throw new Error(\n `The synchronous \"getSubgraphs\" method is not supported for this graph. Call \"getSubgraphsAsync\" instead.`\n );\n }\n\n async *getSubgraphsAsync(\n namespace?: string,\n recurse = false\n ): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n const subgraphs = await this.client.assistants.getSubgraphs(this.graphId, {\n namespace,\n recurse,\n });\n\n for (const [ns, graphSchema] of Object.entries(subgraphs)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const remoteSubgraph = new (this.constructor as any)({\n ...this,\n graphId: graphSchema.graph_id,\n });\n yield [ns, remoteSubgraph];\n }\n }\n}\n"],"mappings":";;;;;;;;;;AA2DA,MAAM,oBAAoB,QAAkB;AAC1C,KAAI,QAAQ,QAAQ,OAAO,QAAQ,SACjC,QAAO;AAGT,KAAI,MAAM,QAAQ,KAChB,QAAO,IAAI,IAAI;AAIjB,kDAAkB,MAAM;EACtB,MAAM,OAAO,IAAI;AACjB,SAAO;GACL,GAAG,KAAK;GACR,MAAM,IAAI;;;AAId,QAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,iBAAiB;;;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,GAAG;IACH,SAAS,YAAY;;AAEvB,SAAM,CAAC,IAAI"}
|
package/dist/pregel/remote.d.cts
CHANGED
|
@@ -17,6 +17,7 @@ type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRec
|
|
|
17
17
|
url?: string;
|
|
18
18
|
apiKey?: string;
|
|
19
19
|
headers?: Record<string, string>;
|
|
20
|
+
streamResumable?: boolean;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* The `RemoteGraph` class is a client implementation for calling remote
|
|
@@ -66,6 +67,7 @@ ContextType extends Record<string, any> = StrRecord<string, any>> extends Runnab
|
|
|
66
67
|
protected client: Client;
|
|
67
68
|
protected interruptBefore?: Array<keyof Nn> | All;
|
|
68
69
|
protected interruptAfter?: Array<keyof Nn> | All;
|
|
70
|
+
protected streamResumable?: boolean;
|
|
69
71
|
constructor(params: RemoteGraphParams);
|
|
70
72
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
71
73
|
// @ts-ignore Remove ignore when we remove support for 0.2 versions of core
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.cts","names":["Client","Checkpoint","ThreadState","Graph","DrawableGraph","Node","DrawableNode","Runnable","RunnableConfig","All","CheckpointListOptions","StreamEvent","IterableReadableStream","BaseChannel","LangGraphRunnableConfig","StrRecord","PregelInputType","PregelOptions","PregelOutputType","PregelNode","PregelParams","PregelInterface","StateSnapshot","RemoteGraphParams","Omit","Record","RemoteGraph","Nn","Cc","ContextType","Array","Partial","Promise","AsyncGenerator","AsyncIterableIterator","Generator"],"sources":["../../src/pregel/remote.d.ts"],"sourcesContent":["import { Client, type Checkpoint, type ThreadState } from \"@langchain/langgraph-sdk\";\nimport { Graph as DrawableGraph, Node as DrawableNode } from \"@langchain/core/runnables/graph\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport { All, CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { BaseChannel, LangGraphRunnableConfig } from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport { PregelParams, PregelInterface, StateSnapshot } from \"./types.js\";\nexport type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>, \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n};\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport declare class RemoteGraph<Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>> extends Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc, ContextType>> implements PregelInterface<Nn, Cc, ContextType> {\n static lc_name(): string;\n lc_namespace: string[];\n lg_is_pregel: boolean;\n config?: RunnableConfig;\n graphId: string;\n protected client: Client;\n protected interruptBefore?: Array<keyof Nn> | All;\n protected interruptAfter?: Array<keyof Nn> | All;\n constructor(params: RemoteGraphParams);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n withConfig(config: RunnableConfig): typeof this;\n protected _sanitizeConfig(config: RunnableConfig): {\n tags: string[];\n metadata: Record<string, unknown>;\n configurable: {\n [k: string]: any;\n };\n recursion_limit: number | undefined;\n };\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig;\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined;\n protected _createStateSnapshot(state: ThreadState): StateSnapshot;\n invoke(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): Promise<PregelOutputType>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }): IterableReadableStream<StreamEvent>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }): IterableReadableStream<never>;\n _streamIterator(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): AsyncGenerator<PregelOutputType>;\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown>, asNode?: string): Promise<RunnableConfig>;\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n protected _getDrawableNodes(nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>): Record<string, DrawableNode>;\n getState(config: RunnableConfig, options?: {\n subgraphs?: boolean;\n }): Promise<StateSnapshot>;\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n getGraph(_?: RunnableConfig & {\n xray?: boolean | number;\n }): DrawableGraph;\n /**\n * Returns a drawable representation of the computation graph.\n */\n getGraphAsync(config?: RunnableConfig & {\n xray?: boolean | number;\n }): Promise<DrawableGraph>;\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n}\n"],"mappings":";;;;;;;;;;;;;KAWYuB,iBAAAA,GAAoBC,KAAKJ,aAAaL,kBAAkBI,aAAaJ,kBAAkBF;;EAAvFU,MAAAA,CAAAA,EAECvB,MAFDuB;EAAiB,GAAA,CAAA,EAAA,MAAA;QAAuCJ,CAAAA,EAAAA,MAAAA;SAAlBJ,CAAAA,EAKpCU,MALoCV,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;;;;;;;;AA4ClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAesCP,cAfjBkB,WAeiBlB,CAAAA,WAfMO,SAeNP,CAAAA,MAAAA,EAfwBW,UAexBX,CAAAA,GAfsCO,SAetCP,CAAAA,MAAAA,EAfwDW,UAexDX,CAAAA,EAAAA,WAfgFO,SAehFP,CAAAA,MAAAA,EAfkGK,WAelGL,CAAAA,GAfiHO,SAejHP,CAAAA,MAAAA,EAfmIK,WAenIL,CAAAA;;oBAblBiB,MAqBiBA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GArBKV,SAqBLU,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA,SArBqClB,QAqBrCkB,CArB8CT,eAqB9CS,EArB+DP,gBAqB/DO,EArBiFR,aAqBjFQ,CArB+FE,EAqB/FF,EArBmGG,EAqBnGH,EArBuGI,WAqBvGJ,CAAAA,CAAAA,YArBgIJ,eAqBhII,CArBgJE,EAqBhJF,EArBoJG,EAqBpJH,EArBwJI,WAqBxJJ,CAAAA,CAAAA;SAA0BjB,OAAAA,CAAAA,CAAAA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MANkGjB,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAAAA,MAAAA;IAARwB,QAAAA,CAAAA,EAAAA,OAAAA;KAC7ExB,EAOnBiB,MAPmBjB,CAAAA,MAAAA,EAOJF,IAPIE,CAAAA;UAA0BE,CAAAA,MAAAA,EAQjCF,cARiCE,EAAAA,QAAAA,EAAAA;IAA8CY,SAAAA,CAAAA,EAAAA,OAAAA;MAU5FU,OAVsEE,CAU9DZ,aAV8DY,CAAAA;;UACvCJ,CAAAA,EAAAA,EAWtBtB,cAXsBsB,GAAAA;IAMfxB,IAAAA,CAAAA,EAAAA,OAAAA,GAAAA,MAAAA;MAOhBF,KAPCqB;;;;eAKQjB,CAAAA,OAAAA,EAMUA,cANVA,GAAAA;IAETJ,IAAAA,CAAAA,EAAAA,OAAAA,GAAAA,MAAAA;MAMA4B,OAFmBxB,CAEXJ,KAFWI,CAAAA;;cAEnBwB,CAAAA,CAAAA,EAEYG,SAFZH,CAAAA,CAAAA,MAAAA,EAE+BX,eAF/BW,CAE+CL,EAF/CK,EAEmDJ,EAFnDI,EAEuDH,WAFvDG,CAAAA,CAAAA,CAAAA;mBAE+CL,CAAAA,SAAAA,CAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EACOM,cADPN,CAAAA,CAAAA,MAAAA,EAC+BN,eAD/BM,CAC+CA,EAD/CA,EACmDC,EADnDD,EACuDE,WADvDF,CAAAA,CAAAA,CAAAA"}
|
|
1
|
+
{"version":3,"file":"remote.d.cts","names":["Client","Checkpoint","ThreadState","Graph","DrawableGraph","Node","DrawableNode","Runnable","RunnableConfig","All","CheckpointListOptions","StreamEvent","IterableReadableStream","BaseChannel","LangGraphRunnableConfig","StrRecord","PregelInputType","PregelOptions","PregelOutputType","PregelNode","PregelParams","PregelInterface","StateSnapshot","RemoteGraphParams","Omit","Record","RemoteGraph","Nn","Cc","ContextType","Array","Partial","Promise","AsyncGenerator","AsyncIterableIterator","Generator"],"sources":["../../src/pregel/remote.d.ts"],"sourcesContent":["import { Client, type Checkpoint, type ThreadState } from \"@langchain/langgraph-sdk\";\nimport { Graph as DrawableGraph, Node as DrawableNode } from \"@langchain/core/runnables/graph\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport { All, CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { BaseChannel, LangGraphRunnableConfig } from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport { PregelParams, PregelInterface, StateSnapshot } from \"./types.js\";\nexport type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>, \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n streamResumable?: boolean;\n};\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport declare class RemoteGraph<Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>> extends Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc, ContextType>> implements PregelInterface<Nn, Cc, ContextType> {\n static lc_name(): string;\n lc_namespace: string[];\n lg_is_pregel: boolean;\n config?: RunnableConfig;\n graphId: string;\n protected client: Client;\n protected interruptBefore?: Array<keyof Nn> | All;\n protected interruptAfter?: Array<keyof Nn> | All;\n protected streamResumable?: boolean;\n constructor(params: RemoteGraphParams);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n withConfig(config: RunnableConfig): typeof this;\n protected _sanitizeConfig(config: RunnableConfig): {\n tags: string[];\n metadata: Record<string, unknown>;\n configurable: {\n [k: string]: any;\n };\n recursion_limit: number | undefined;\n };\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig;\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined;\n protected _createStateSnapshot(state: ThreadState): StateSnapshot;\n invoke(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): Promise<PregelOutputType>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }): IterableReadableStream<StreamEvent>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }): IterableReadableStream<never>;\n _streamIterator(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): AsyncGenerator<PregelOutputType>;\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown>, asNode?: string): Promise<RunnableConfig>;\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n protected _getDrawableNodes(nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>): Record<string, DrawableNode>;\n getState(config: RunnableConfig, options?: {\n subgraphs?: boolean;\n }): Promise<StateSnapshot>;\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n getGraph(_?: RunnableConfig & {\n xray?: boolean | number;\n }): DrawableGraph;\n /**\n * Returns a drawable representation of the computation graph.\n */\n getGraphAsync(config?: RunnableConfig & {\n xray?: boolean | number;\n }): Promise<DrawableGraph>;\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n}\n"],"mappings":";;;;;;;;;;;;;KAWYuB,iBAAAA,GAAoBC,KAAKJ,aAAaL,kBAAkBI,aAAaJ,kBAAkBF;;EAAvFU,MAAAA,CAAAA,EAECvB,MAFDuB;EAAiB,GAAA,CAAA,EAAA,MAAA;QAAuCJ,CAAAA,EAAAA,MAAAA;SAAlBJ,CAAAA,EAKpCU,MALoCV,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;iBAAiDF,CAAAA,EAAAA,OAAAA;;;;;;;AA6CnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBkBY,cAlBGC,WAkBHD,CAAAA,WAlB0BV,SAkB1BU,CAAAA,MAAAA,EAlB4CN,UAkB5CM,CAAAA,GAlB0DV,SAkB1DU,CAAAA,MAAAA,EAlB4EN,UAkB5EM,CAAAA,EAAAA,WAlBoGV,SAkBpGU,CAAAA,MAAAA,EAlBsHZ,WAkBtHY,CAAAA,GAlBqIV,SAkBrIU,CAAAA,MAAAA,EAlBuJZ,WAkBvJY,CAAAA;;oBAhBEA,MAsB2CjB,CAAAA,MAAA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,EAC2CD,EAD3CC,EAC+CA,WAD/CA,CAAAA,CAAAA,CAAAA"}
|
package/dist/pregel/remote.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRec
|
|
|
17
17
|
url?: string;
|
|
18
18
|
apiKey?: string;
|
|
19
19
|
headers?: Record<string, string>;
|
|
20
|
+
streamResumable?: boolean;
|
|
20
21
|
};
|
|
21
22
|
/**
|
|
22
23
|
* The `RemoteGraph` class is a client implementation for calling remote
|
|
@@ -66,6 +67,7 @@ ContextType extends Record<string, any> = StrRecord<string, any>> extends Runnab
|
|
|
66
67
|
protected client: Client;
|
|
67
68
|
protected interruptBefore?: Array<keyof Nn> | All;
|
|
68
69
|
protected interruptAfter?: Array<keyof Nn> | All;
|
|
70
|
+
protected streamResumable?: boolean;
|
|
69
71
|
constructor(params: RemoteGraphParams);
|
|
70
72
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
71
73
|
// @ts-ignore Remove ignore when we remove support for 0.2 versions of core
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","names":["Client","Checkpoint","ThreadState","Graph","DrawableGraph","Node","DrawableNode","Runnable","RunnableConfig","All","CheckpointListOptions","StreamEvent","IterableReadableStream","BaseChannel","LangGraphRunnableConfig","StrRecord","PregelInputType","PregelOptions","PregelOutputType","PregelNode","PregelParams","PregelInterface","StateSnapshot","RemoteGraphParams","Omit","Record","RemoteGraph","Nn","Cc","ContextType","Array","Partial","Promise","AsyncGenerator","AsyncIterableIterator","Generator"],"sources":["../../src/pregel/remote.d.ts"],"sourcesContent":["import { Client, type Checkpoint, type ThreadState } from \"@langchain/langgraph-sdk\";\nimport { Graph as DrawableGraph, Node as DrawableNode } from \"@langchain/core/runnables/graph\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport { All, CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { BaseChannel, LangGraphRunnableConfig } from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport { PregelParams, PregelInterface, StateSnapshot } from \"./types.js\";\nexport type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>, \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n};\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport declare class RemoteGraph<Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>> extends Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc, ContextType>> implements PregelInterface<Nn, Cc, ContextType> {\n static lc_name(): string;\n lc_namespace: string[];\n lg_is_pregel: boolean;\n config?: RunnableConfig;\n graphId: string;\n protected client: Client;\n protected interruptBefore?: Array<keyof Nn> | All;\n protected interruptAfter?: Array<keyof Nn> | All;\n constructor(params: RemoteGraphParams);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n withConfig(config: RunnableConfig): typeof this;\n protected _sanitizeConfig(config: RunnableConfig): {\n tags: string[];\n metadata: Record<string, unknown>;\n configurable: {\n [k: string]: any;\n };\n recursion_limit: number | undefined;\n };\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig;\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined;\n protected _createStateSnapshot(state: ThreadState): StateSnapshot;\n invoke(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): Promise<PregelOutputType>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }): IterableReadableStream<StreamEvent>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }): IterableReadableStream<never>;\n _streamIterator(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): AsyncGenerator<PregelOutputType>;\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown>, asNode?: string): Promise<RunnableConfig>;\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n protected _getDrawableNodes(nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>): Record<string, DrawableNode>;\n getState(config: RunnableConfig, options?: {\n subgraphs?: boolean;\n }): Promise<StateSnapshot>;\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n getGraph(_?: RunnableConfig & {\n xray?: boolean | number;\n }): DrawableGraph;\n /**\n * Returns a drawable representation of the computation graph.\n */\n getGraphAsync(config?: RunnableConfig & {\n xray?: boolean | number;\n }): Promise<DrawableGraph>;\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n}\n"],"mappings":";;;;;;;;;;;;;KAWYuB,iBAAAA,GAAoBC,KAAKJ,aAAaL,kBAAkBI,aAAaJ,kBAAkBF;;EAAvFU,MAAAA,CAAAA,EAECvB,MAFDuB;EAAiB,GAAA,CAAA,EAAA,MAAA;QAAuCJ,CAAAA,EAAAA,MAAAA;SAAlBJ,CAAAA,EAKpCU,MALoCV,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;;;;;;;;AA4ClD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAesCP,cAfjBkB,WAeiBlB,CAAAA,WAfMO,SAeNP,CAAAA,MAAAA,EAfwBW,UAexBX,CAAAA,GAfsCO,SAetCP,CAAAA,MAAAA,EAfwDW,UAexDX,CAAAA,EAAAA,WAfgFO,SAehFP,CAAAA,MAAAA,EAfkGK,WAelGL,CAAAA,GAfiHO,SAejHP,CAAAA,MAAAA,EAfmIK,WAenIL,CAAAA;;oBAblBiB,MAqBiBA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GArBKV,SAqBLU,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,CAAAA,SArBqClB,QAqBrCkB,CArB8CT,eAqB9CS,EArB+DP,gBAqB/DO,EArBiFR,aAqBjFQ,CArB+FE,EAqB/FF,EArBmGG,EAqBnGH,EArBuGI,WAqBvGJ,CAAAA,CAAAA,YArBgIJ,eAqBhII,CArBgJE,EAqBhJF,EArBoJG,EAqBpJH,EArBwJI,WAqBxJJ,CAAAA,CAAAA;SAA0BjB,OAAAA,CAAAA,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lGiB,MANkGjB,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAAAA,MAAAA;IAARwB,QAAAA,CAAAA,EAAAA,OAAAA;KAC7ExB,EAOnBiB,MAPmBjB,CAAAA,MAAAA,EAOJF,IAPIE,CAAAA;UAA0BE,CAAAA,MAAAA,EAQjCF,cARiCE,EAAAA,QAAAA,EAAAA;IAA8CY,SAAAA,CAAAA,EAAAA,OAAAA;MAU5FU,OAVsEE,CAU9DZ,aAV8DY,CAAAA;;UACvCJ,CAAAA,EAAAA,EAWtBtB,cAXsBsB,GAAAA;IAMfxB,IAAAA,CAAAA,EAAAA,OAAAA,GAAAA,MAAAA;MAOhBF,KAPCqB;;;;eAKQjB,CAAAA,OAAAA,EAMUA,cANVA,GAAAA;IAETJ,IAAAA,CAAAA,EAAAA,OAAAA,GAAAA,MAAAA;MAMA4B,OAFmBxB,CAEXJ,KAFWI,CAAAA;;cAEnBwB,CAAAA,CAAAA,EAEYG,SAFZH,CAAAA,CAAAA,MAAAA,EAE+BX,eAF/BW,CAE+CL,EAF/CK,EAEmDJ,EAFnDI,EAEuDH,WAFvDG,CAAAA,CAAAA,CAAAA;mBAE+CL,CAAAA,SAAAA,CAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EACOM,cADPN,CAAAA,CAAAA,MAAAA,EAC+BN,eAD/BM,CAC+CA,EAD/CA,EACmDC,EADnDD,EACuDE,WADvDF,CAAAA,CAAAA,CAAAA"}
|
|
1
|
+
{"version":3,"file":"remote.d.ts","names":["Client","Checkpoint","ThreadState","Graph","DrawableGraph","Node","DrawableNode","Runnable","RunnableConfig","All","CheckpointListOptions","StreamEvent","IterableReadableStream","BaseChannel","LangGraphRunnableConfig","StrRecord","PregelInputType","PregelOptions","PregelOutputType","PregelNode","PregelParams","PregelInterface","StateSnapshot","RemoteGraphParams","Omit","Record","RemoteGraph","Nn","Cc","ContextType","Array","Partial","Promise","AsyncGenerator","AsyncIterableIterator","Generator"],"sources":["../../src/pregel/remote.d.ts"],"sourcesContent":["import { Client, type Checkpoint, type ThreadState } from \"@langchain/langgraph-sdk\";\nimport { Graph as DrawableGraph, Node as DrawableNode } from \"@langchain/core/runnables/graph\";\nimport { Runnable, RunnableConfig } from \"@langchain/core/runnables\";\nimport { All, CheckpointListOptions } from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { BaseChannel, LangGraphRunnableConfig } from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport { PregelParams, PregelInterface, StateSnapshot } from \"./types.js\";\nexport type RemoteGraphParams = Omit<PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>, \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n streamResumable?: boolean;\n};\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport declare class RemoteGraph<Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>, Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>, \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nContextType extends Record<string, any> = StrRecord<string, any>> extends Runnable<PregelInputType, PregelOutputType, PregelOptions<Nn, Cc, ContextType>> implements PregelInterface<Nn, Cc, ContextType> {\n static lc_name(): string;\n lc_namespace: string[];\n lg_is_pregel: boolean;\n config?: RunnableConfig;\n graphId: string;\n protected client: Client;\n protected interruptBefore?: Array<keyof Nn> | All;\n protected interruptAfter?: Array<keyof Nn> | All;\n protected streamResumable?: boolean;\n constructor(params: RemoteGraphParams);\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n withConfig(config: RunnableConfig): typeof this;\n protected _sanitizeConfig(config: RunnableConfig): {\n tags: string[];\n metadata: Record<string, unknown>;\n configurable: {\n [k: string]: any;\n };\n recursion_limit: number | undefined;\n };\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig;\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined;\n protected _createStateSnapshot(state: ThreadState): StateSnapshot;\n invoke(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): Promise<PregelOutputType>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }): IterableReadableStream<StreamEvent>;\n streamEvents(input: PregelInputType, options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }): IterableReadableStream<never>;\n _streamIterator(input: PregelInputType, options?: Partial<PregelOptions<Nn, Cc, ContextType>>): AsyncGenerator<PregelOutputType>;\n updateState(inputConfig: LangGraphRunnableConfig, values: Record<string, unknown>, asNode?: string): Promise<RunnableConfig>;\n getStateHistory(config: RunnableConfig, options?: CheckpointListOptions): AsyncIterableIterator<StateSnapshot>;\n protected _getDrawableNodes(nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>): Record<string, DrawableNode>;\n getState(config: RunnableConfig, options?: {\n subgraphs?: boolean;\n }): Promise<StateSnapshot>;\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n getGraph(_?: RunnableConfig & {\n xray?: boolean | number;\n }): DrawableGraph;\n /**\n * Returns a drawable representation of the computation graph.\n */\n getGraphAsync(config?: RunnableConfig & {\n xray?: boolean | number;\n }): Promise<DrawableGraph>;\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n getSubgraphsAsync(namespace?: string, recurse?: boolean): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]>;\n}\n"],"mappings":";;;;;;;;;;;;;KAWYuB,iBAAAA,GAAoBC,KAAKJ,aAAaL,kBAAkBI,aAAaJ,kBAAkBF;;EAAvFU,MAAAA,CAAAA,EAECvB,MAFDuB;EAAiB,GAAA,CAAA,EAAA,MAAA;QAAuCJ,CAAAA,EAAAA,MAAAA;SAAlBJ,CAAAA,EAKpCU,MALoCV,CAAAA,MAAAA,EAAAA,MAAAA,CAAAA;iBAAiDF,CAAAA,EAAAA,OAAAA;;;;;;;AA6CnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBkBY,cAlBGC,WAkBHD,CAAAA,WAlB0BV,SAkB1BU,CAAAA,MAAAA,EAlB4CN,UAkB5CM,CAAAA,GAlB0DV,SAkB1DU,CAAAA,MAAAA,EAlB4EN,UAkB5EM,CAAAA,EAAAA,WAlBoGV,SAkBpGU,CAAAA,MAAAA,EAlBsHZ,WAkBtHY,CAAAA,GAlBqIV,SAkBrIU,CAAAA,MAAAA,EAlBuJZ,WAkBvJY,CAAAA;;oBAhBEA,MAsB2CjB,CAAAA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EADvCE,EAC2CD,EAD3CC,EAC+CA,WAD/CA,CAAAA,CAAAA,CAAAA"}
|
package/dist/pregel/remote.js
CHANGED
|
@@ -93,6 +93,7 @@ var RemoteGraph = class extends Runnable {
|
|
|
93
93
|
client;
|
|
94
94
|
interruptBefore;
|
|
95
95
|
interruptAfter;
|
|
96
|
+
streamResumable;
|
|
96
97
|
constructor(params) {
|
|
97
98
|
super(params);
|
|
98
99
|
this.graphId = params.graphId;
|
|
@@ -104,6 +105,7 @@ var RemoteGraph = class extends Runnable {
|
|
|
104
105
|
this.config = params.config;
|
|
105
106
|
this.interruptBefore = params.interruptBefore;
|
|
106
107
|
this.interruptAfter = params.interruptAfter;
|
|
108
|
+
this.streamResumable = params.streamResumable;
|
|
107
109
|
}
|
|
108
110
|
withConfig(config) {
|
|
109
111
|
const mergedConfig = mergeConfigs(this.config, config);
|
|
@@ -236,7 +238,8 @@ var RemoteGraph = class extends Runnable {
|
|
|
236
238
|
interruptAfter,
|
|
237
239
|
streamSubgraphs,
|
|
238
240
|
ifNotExists: "create",
|
|
239
|
-
signal: mergedConfig.signal
|
|
241
|
+
signal: mergedConfig.signal,
|
|
242
|
+
streamResumable: this.streamResumable
|
|
240
243
|
})) {
|
|
241
244
|
let mode;
|
|
242
245
|
let namespace;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","names":["updatedStreamModes: StreamMode[]","tasks: PregelTaskDescription[]","namespace: string[]","nodesMap: Record<string, DrawableNode>","DrawableGraph"],"sources":["../../src/pregel/remote.ts"],"sourcesContent":["import {\n Client,\n type Checkpoint,\n type ThreadState,\n} from \"@langchain/langgraph-sdk\";\nimport {\n Graph as DrawableGraph,\n Node as DrawableNode,\n} from \"@langchain/core/runnables/graph\";\nimport {\n mergeConfigs,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport {\n All,\n CheckpointListOptions,\n CheckpointMetadata,\n} from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { isBaseMessage } from \"@langchain/core/messages\";\n\nimport {\n BaseChannel,\n GraphInterrupt,\n LangGraphRunnableConfig,\n RemoteException,\n} from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport {\n PregelParams,\n PregelInterface,\n PregelTaskDescription,\n StateSnapshot,\n StreamMode,\n} from \"./types.js\";\nimport {\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_STREAM,\n INTERRUPT,\n isCommand,\n} from \"../constants.js\";\n\nexport type RemoteGraphParams = Omit<\n PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>,\n \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"\n> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _serializeInputs = (obj: any): any => {\n if (obj === null || typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(_serializeInputs);\n }\n\n // Handle BaseMessage instances by converting them to a serializable format\n if (isBaseMessage(obj)) {\n const dict = obj.toDict();\n return {\n ...dict.data,\n role: obj.getType(),\n };\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [key, _serializeInputs(value)])\n );\n};\n\n/**\n * Return a tuple of the final list of stream modes sent to the\n * remote graph and a boolean flag indicating if only one stream mode was\n * originally requested and whether stream mode 'updates'\n * was present in the original list of stream modes.\n *\n * 'updates' mode is always added to the list of stream modes so that interrupts\n * can be detected in the remote graph.\n */\nconst getStreamModes = (\n streamMode?: StreamMode | StreamMode[],\n defaultStreamMode: StreamMode = \"updates\"\n) => {\n const updatedStreamModes: StreamMode[] = [];\n let reqUpdates = false;\n let reqSingle = true;\n\n if (\n streamMode !== undefined &&\n (typeof streamMode === \"string\" ||\n (Array.isArray(streamMode) && streamMode.length > 0))\n ) {\n reqSingle = typeof streamMode === \"string\";\n const mapped = Array.isArray(streamMode) ? streamMode : [streamMode];\n updatedStreamModes.push(...mapped);\n } else {\n updatedStreamModes.push(defaultStreamMode);\n }\n if (updatedStreamModes.includes(\"updates\")) {\n reqUpdates = true;\n } else {\n updatedStreamModes.push(\"updates\");\n }\n return {\n updatedStreamModes,\n reqUpdates,\n reqSingle,\n };\n};\n\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport class RemoteGraph<\n Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>,\n Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = StrRecord<string, any>\n >\n extends Runnable<\n PregelInputType,\n PregelOutputType,\n PregelOptions<Nn, Cc, ContextType>\n >\n implements PregelInterface<Nn, Cc, ContextType>\n{\n static lc_name() {\n return \"RemoteGraph\";\n }\n\n lc_namespace = [\"langgraph\", \"pregel\"];\n\n lg_is_pregel = true;\n\n config?: RunnableConfig;\n\n graphId: string;\n\n protected client: Client;\n\n protected interruptBefore?: Array<keyof Nn> | All;\n\n protected interruptAfter?: Array<keyof Nn> | All;\n\n constructor(params: RemoteGraphParams) {\n super(params);\n\n this.graphId = params.graphId;\n this.client =\n params.client ??\n new Client({\n apiUrl: params.url,\n apiKey: params.apiKey,\n defaultHeaders: params.headers,\n });\n this.config = params.config;\n this.interruptBefore = params.interruptBefore;\n this.interruptAfter = params.interruptAfter;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n override withConfig(config: RunnableConfig): typeof this {\n const mergedConfig = mergeConfigs(this.config, config);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.constructor as any)({ ...this, config: mergedConfig });\n }\n\n protected _sanitizeConfig(config: RunnableConfig) {\n const reservedConfigurableKeys = new Set([\n \"callbacks\",\n \"checkpoint_map\",\n \"checkpoint_id\",\n \"checkpoint_ns\",\n ]);\n\n const sanitizeObj = <T>(obj: T): T => {\n try {\n // This will only throw if we're trying to serialize a circular reference\n // or trying to serialize a BigInt...\n JSON.stringify(obj);\n return obj;\n } catch {\n const seen = new WeakSet();\n return JSON.parse(\n JSON.stringify(obj, (_, value) => {\n if (typeof value === \"object\" && value != null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n\n if (typeof value === \"bigint\") return value.toString();\n return value;\n })\n );\n }\n };\n\n // Remove non-JSON serializable fields from the config\n const sanitizedConfig = sanitizeObj(config);\n\n // Only include configurable keys that are not reserved and\n // not starting with \"__pregel_\" prefix\n const newConfigurable = Object.fromEntries(\n Object.entries(sanitizedConfig.configurable ?? {}).filter(\n ([k]) => !reservedConfigurableKeys.has(k) && !k.startsWith(\"__pregel_\")\n )\n );\n\n return {\n tags: sanitizedConfig.tags ?? [],\n metadata: sanitizedConfig.metadata ?? {},\n configurable: newConfigurable,\n recursion_limit: sanitizedConfig.recursionLimit,\n };\n }\n\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig {\n return {\n configurable: {\n thread_id: checkpoint.thread_id,\n checkpoint_ns: checkpoint.checkpoint_ns,\n checkpoint_id: checkpoint.checkpoint_id,\n checkpoint_map: checkpoint.checkpoint_map ?? {},\n },\n };\n }\n\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined {\n if (config?.configurable === undefined) {\n return undefined;\n }\n\n const checkpointKeys = [\n \"thread_id\",\n \"checkpoint_ns\",\n \"checkpoint_id\",\n \"checkpoint_map\",\n ] as const;\n\n const checkpoint = Object.fromEntries(\n checkpointKeys\n .map((key) => [key, config.configurable![key]])\n .filter(([_, value]) => value !== undefined)\n );\n\n return Object.keys(checkpoint).length > 0 ? checkpoint : undefined;\n }\n\n protected _createStateSnapshot(state: ThreadState): StateSnapshot {\n const tasks: PregelTaskDescription[] = state.tasks.map((task) => {\n return {\n id: task.id,\n name: task.name,\n error: task.error ? { message: task.error } : undefined,\n // TODO: remove in LangGraph.js 0.4\n interrupts: task.interrupts.map(({ id, ...rest }) => ({\n interrupt_id: id,\n ...rest,\n })),\n // eslint-disable-next-line no-nested-ternary\n state: task.state\n ? this._createStateSnapshot(task.state)\n : task.checkpoint\n ? { configurable: task.checkpoint }\n : undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: (task as any).result,\n };\n });\n\n return {\n values: state.values,\n next: state.next ? [...state.next] : [],\n config: {\n configurable: {\n thread_id: state.checkpoint.thread_id,\n checkpoint_ns: state.checkpoint.checkpoint_ns,\n checkpoint_id: state.checkpoint.checkpoint_id,\n checkpoint_map: state.checkpoint.checkpoint_map ?? {},\n },\n },\n metadata: state.metadata\n ? (state.metadata as CheckpointMetadata)\n : undefined,\n createdAt: state.created_at ?? undefined,\n parentConfig: state.parent_checkpoint\n ? {\n configurable: {\n thread_id: state.parent_checkpoint.thread_id,\n checkpoint_ns: state.parent_checkpoint.checkpoint_ns,\n checkpoint_id: state.parent_checkpoint.checkpoint_id,\n checkpoint_map: state.parent_checkpoint.checkpoint_map ?? {},\n },\n }\n : undefined,\n tasks,\n };\n }\n\n override async invoke(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): Promise<PregelOutputType> {\n let lastValue;\n const stream = await this.stream(input, {\n ...options,\n streamMode: \"values\",\n });\n for await (const chunk of stream) {\n lastValue = chunk;\n }\n return lastValue;\n }\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }\n ): IterableReadableStream<StreamEvent>;\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }\n ): IterableReadableStream<never>;\n\n override streamEvents(\n _input: PregelInputType,\n _options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding?: never;\n }\n ): IterableReadableStream<StreamEvent> {\n throw new Error(\"Not implemented.\");\n }\n\n override async *_streamIterator(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): AsyncGenerator<PregelOutputType> {\n const mergedConfig = mergeConfigs(this.config, options);\n const sanitizedConfig = this._sanitizeConfig(mergedConfig);\n\n const streamProtocolInstance = options?.configurable?.[CONFIG_KEY_STREAM];\n\n const streamSubgraphs =\n options?.subgraphs ?? streamProtocolInstance !== undefined;\n\n const interruptBefore = options?.interruptBefore ?? this.interruptBefore;\n const interruptAfter = options?.interruptAfter ?? this.interruptAfter;\n\n const { updatedStreamModes, reqSingle, reqUpdates } = getStreamModes(\n options?.streamMode\n );\n\n const extendedStreamModes = [\n ...new Set([\n ...updatedStreamModes,\n ...(streamProtocolInstance?.modes ?? new Set()),\n ]),\n ].map((mode) => {\n if (mode === \"messages\") return \"messages-tuple\";\n return mode;\n });\n\n let command;\n let serializedInput;\n if (isCommand(input)) {\n // TODO: Remove cast when SDK type fix gets merged\n command = input.toJSON() as Record<string, unknown>;\n serializedInput = undefined;\n } else {\n serializedInput = _serializeInputs(input);\n }\n\n for await (const chunk of this.client.runs.stream(\n sanitizedConfig.configurable.thread_id as string,\n this.graphId,\n {\n command,\n input: serializedInput,\n config: sanitizedConfig,\n streamMode: extendedStreamModes,\n interruptBefore: interruptBefore as string[],\n interruptAfter: interruptAfter as string[],\n streamSubgraphs,\n ifNotExists: \"create\",\n signal: mergedConfig.signal,\n }\n )) {\n let mode;\n let namespace: string[];\n if (chunk.event.includes(CHECKPOINT_NAMESPACE_SEPARATOR)) {\n const eventComponents = chunk.event.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n // eslint-disable-next-line prefer-destructuring\n mode = eventComponents[0];\n namespace = eventComponents.slice(1);\n } else {\n mode = chunk.event;\n namespace = [];\n }\n const callerNamespace = options?.configurable?.checkpoint_ns;\n if (typeof callerNamespace === \"string\") {\n namespace = callerNamespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .concat(namespace);\n }\n if (\n streamProtocolInstance !== undefined &&\n streamProtocolInstance.modes?.has(chunk.event)\n ) {\n streamProtocolInstance.push([namespace, mode, chunk.data]);\n }\n if (chunk.event.startsWith(\"updates\")) {\n if (\n typeof chunk.data === \"object\" &&\n chunk.data?.[INTERRUPT] !== undefined\n ) {\n throw new GraphInterrupt(chunk.data[INTERRUPT]);\n }\n if (!reqUpdates) {\n continue;\n }\n } else if (chunk.event?.startsWith(\"error\")) {\n throw new RemoteException(\n typeof chunk.data === \"string\"\n ? chunk.data\n : JSON.stringify(chunk.data)\n );\n }\n if (\n !updatedStreamModes.includes(\n chunk.event.split(CHECKPOINT_NAMESPACE_SEPARATOR)[0] as StreamMode\n )\n ) {\n continue;\n }\n if (options?.subgraphs) {\n if (reqSingle) {\n yield [namespace, chunk.data];\n } else {\n yield [namespace, mode, chunk.data];\n }\n } else if (reqSingle) {\n yield chunk.data;\n } else {\n yield [mode, chunk.data];\n }\n }\n }\n\n async updateState(\n inputConfig: LangGraphRunnableConfig,\n values: Record<string, unknown>,\n asNode?: string\n ): Promise<RunnableConfig> {\n const mergedConfig = mergeConfigs(this.config, inputConfig);\n const response = await this.client.threads.updateState(\n mergedConfig.configurable?.thread_id,\n { values, asNode, checkpoint: this._getCheckpoint(mergedConfig) }\n );\n // TODO: Fix SDK typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this._getConfig((response as any).checkpoint);\n }\n\n async *getStateHistory(\n config: RunnableConfig,\n options?: CheckpointListOptions\n ): AsyncIterableIterator<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n const states = await this.client.threads.getHistory(\n mergedConfig.configurable?.thread_id,\n {\n limit: options?.limit ?? 10,\n // TODO: Fix type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n before: this._getCheckpoint(options?.before) as any,\n metadata: options?.filter,\n checkpoint: this._getCheckpoint(mergedConfig),\n }\n );\n for (const state of states) {\n yield this._createStateSnapshot(state);\n }\n }\n\n protected _getDrawableNodes(\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>\n ): Record<string, DrawableNode> {\n const nodesMap: Record<string, DrawableNode> = {};\n for (const node of nodes) {\n const nodeId = node.id;\n nodesMap[nodeId] = {\n id: nodeId.toString(),\n name: typeof node.data === \"string\" ? node.data : node.data?.name ?? \"\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: (node.data as any) ?? {},\n metadata:\n typeof node.data !== \"string\" ? node.data?.metadata ?? {} : {},\n };\n }\n return nodesMap;\n }\n\n async getState(\n config: RunnableConfig,\n options?: { subgraphs?: boolean }\n ): Promise<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n\n const state = await this.client.threads.getState(\n mergedConfig.configurable?.thread_id,\n this._getCheckpoint(mergedConfig),\n options\n );\n return this._createStateSnapshot(state);\n }\n\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n override getGraph(\n _?: RunnableConfig & { xray?: boolean | number }\n ): DrawableGraph {\n throw new Error(\n `The synchronous \"getGraph\" is not supported for this graph. Call \"getGraphAsync\" instead.`\n );\n }\n\n /**\n * Returns a drawable representation of the computation graph.\n */\n async getGraphAsync(config?: RunnableConfig & { xray?: boolean | number }) {\n const graph = await this.client.assistants.getGraph(this.graphId, {\n xray: config?.xray,\n });\n return new DrawableGraph({\n nodes: this._getDrawableNodes(graph.nodes),\n edges: graph.edges,\n });\n }\n\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n throw new Error(\n `The synchronous \"getSubgraphs\" method is not supported for this graph. Call \"getSubgraphsAsync\" instead.`\n );\n }\n\n async *getSubgraphsAsync(\n namespace?: string,\n recurse = false\n ): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n const subgraphs = await this.client.assistants.getSubgraphs(this.graphId, {\n namespace,\n recurse,\n });\n\n for (const [ns, graphSchema] of Object.entries(subgraphs)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const remoteSubgraph = new (this.constructor as any)({\n ...this,\n graphId: graphSchema.graph_id,\n });\n yield [ns, remoteSubgraph];\n }\n }\n}\n"],"mappings":";;;;;;;;;AA0DA,MAAM,oBAAoB,QAAkB;AAC1C,KAAI,QAAQ,QAAQ,OAAO,QAAQ,SACjC,QAAO;AAGT,KAAI,MAAM,QAAQ,KAChB,QAAO,IAAI,IAAI;AAIjB,KAAI,cAAc,MAAM;EACtB,MAAM,OAAO,IAAI;AACjB,SAAO;GACL,GAAG,KAAK;GACR,MAAM,IAAI;;;AAId,QAAO,OAAO,YACZ,OAAO,QAAQ,KAAK,KAAK,CAAC,KAAK,WAAW,CAAC,KAAK,iBAAiB;;;;;;;;;;;AAarE,MAAM,kBACJ,YACA,oBAAgC,cAC7B;CACH,MAAMA,qBAAmC;CACzC,IAAI,aAAa;CACjB,IAAI,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UAAU,SAAS;GACnB,YAAY,KAAK,eAAe;;AAGpC,OAAK,MAAM,SAAS,OAClB,OAAM,KAAK,qBAAqB;;CAIpC,AAAU,kBACR,OAO8B;EAC9B,MAAMC,WAAyC;AAC/C,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,SAAS,KAAK;AACpB,YAAS,UAAU;IACjB,IAAI,OAAO;IACX,MAAM,OAAO,KAAK,SAAS,WAAW,KAAK,OAAO,KAAK,MAAM,QAAQ;IAErE,MAAO,KAAK,QAAgB;IAC5B,UACE,OAAO,KAAK,SAAS,WAAW,KAAK,MAAM,YAAY,KAAK;;;AAGlE,SAAO;;CAGT,MAAM,SACJ,QACA,SACwB;EACxB,MAAM,eAAe,aAAa,KAAK,QAAQ;EAE/C,MAAM,QAAQ,MAAM,KAAK,OAAO,QAAQ,SACtC,aAAa,cAAc,WAC3B,KAAK,eAAe,eACpB;AAEF,SAAO,KAAK,qBAAqB;;;CAInC,AAAS,SACP,GACe;AACf,QAAM,IAAI,MACR;;;;;CAOJ,MAAM,cAAc,QAAuD;EACzE,MAAM,QAAQ,MAAM,KAAK,OAAO,WAAW,SAAS,KAAK,SAAS,EAChE,MAAM,QAAQ;AAEhB,SAAO,IAAIC,MAAc;GACvB,OAAO,KAAK,kBAAkB,MAAM;GACpC,OAAO,MAAM;;;;CAKjB,eAA0E;AACxE,QAAM,IAAI,MACR;;CAIJ,OAAO,kBACL,WACA,UAAU,OACsD;EAChE,MAAM,YAAY,MAAM,KAAK,OAAO,WAAW,aAAa,KAAK,SAAS;GACxE;GACA;;AAGF,OAAK,MAAM,CAAC,IAAI,gBAAgB,OAAO,QAAQ,YAAY;GAEzD,MAAM,iBAAiB,IAAK,KAAK,YAAoB;IACnD,GAAG;IACH,SAAS,YAAY;;AAEvB,SAAM,CAAC,IAAI"}
|
|
1
|
+
{"version":3,"file":"remote.js","names":["updatedStreamModes: StreamMode[]","tasks: PregelTaskDescription[]","namespace: string[]","nodesMap: Record<string, DrawableNode>","DrawableGraph"],"sources":["../../src/pregel/remote.ts"],"sourcesContent":["import {\n Client,\n type Checkpoint,\n type ThreadState,\n} from \"@langchain/langgraph-sdk\";\nimport {\n Graph as DrawableGraph,\n Node as DrawableNode,\n} from \"@langchain/core/runnables/graph\";\nimport {\n mergeConfigs,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport {\n All,\n CheckpointListOptions,\n CheckpointMetadata,\n} from \"@langchain/langgraph-checkpoint\";\nimport { StreamEvent } from \"@langchain/core/tracers/log_stream\";\nimport { IterableReadableStream } from \"@langchain/core/utils/stream\";\nimport { isBaseMessage } from \"@langchain/core/messages\";\n\nimport {\n BaseChannel,\n GraphInterrupt,\n LangGraphRunnableConfig,\n RemoteException,\n} from \"../web.js\";\nimport { StrRecord } from \"./algo.js\";\nimport { PregelInputType, PregelOptions, PregelOutputType } from \"./index.js\";\nimport { PregelNode } from \"./read.js\";\nimport {\n PregelParams,\n PregelInterface,\n PregelTaskDescription,\n StateSnapshot,\n StreamMode,\n} from \"./types.js\";\nimport {\n CHECKPOINT_NAMESPACE_SEPARATOR,\n CONFIG_KEY_STREAM,\n INTERRUPT,\n isCommand,\n} from \"../constants.js\";\n\nexport type RemoteGraphParams = Omit<\n PregelParams<StrRecord<string, PregelNode>, StrRecord<string, BaseChannel>>,\n \"channels\" | \"nodes\" | \"inputChannels\" | \"outputChannels\"\n> & {\n graphId: string;\n client?: Client;\n url?: string;\n apiKey?: string;\n headers?: Record<string, string>;\n streamResumable?: boolean;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nconst _serializeInputs = (obj: any): any => {\n if (obj === null || typeof obj !== \"object\") {\n return obj;\n }\n\n if (Array.isArray(obj)) {\n return obj.map(_serializeInputs);\n }\n\n // Handle BaseMessage instances by converting them to a serializable format\n if (isBaseMessage(obj)) {\n const dict = obj.toDict();\n return {\n ...dict.data,\n role: obj.getType(),\n };\n }\n\n return Object.fromEntries(\n Object.entries(obj).map(([key, value]) => [key, _serializeInputs(value)])\n );\n};\n\n/**\n * Return a tuple of the final list of stream modes sent to the\n * remote graph and a boolean flag indicating if only one stream mode was\n * originally requested and whether stream mode 'updates'\n * was present in the original list of stream modes.\n *\n * 'updates' mode is always added to the list of stream modes so that interrupts\n * can be detected in the remote graph.\n */\nconst getStreamModes = (\n streamMode?: StreamMode | StreamMode[],\n defaultStreamMode: StreamMode = \"updates\"\n) => {\n const updatedStreamModes: StreamMode[] = [];\n let reqUpdates = false;\n let reqSingle = true;\n\n if (\n streamMode !== undefined &&\n (typeof streamMode === \"string\" ||\n (Array.isArray(streamMode) && streamMode.length > 0))\n ) {\n reqSingle = typeof streamMode === \"string\";\n const mapped = Array.isArray(streamMode) ? streamMode : [streamMode];\n updatedStreamModes.push(...mapped);\n } else {\n updatedStreamModes.push(defaultStreamMode);\n }\n if (updatedStreamModes.includes(\"updates\")) {\n reqUpdates = true;\n } else {\n updatedStreamModes.push(\"updates\");\n }\n return {\n updatedStreamModes,\n reqUpdates,\n reqSingle,\n };\n};\n\n/**\n * The `RemoteGraph` class is a client implementation for calling remote\n * APIs that implement the LangGraph Server API specification.\n *\n * For example, the `RemoteGraph` class can be used to call APIs from deployments\n * on LangSmith Deployment.\n *\n * `RemoteGraph` behaves the same way as a `StateGraph` and can be used directly as\n * a node in another `StateGraph`.\n *\n * @example\n * ```ts\n * import { RemoteGraph } from \"@langchain/langgraph/remote\";\n *\n * // Can also pass a LangGraph SDK client instance directly\n * const remoteGraph = new RemoteGraph({\n * graphId: process.env.LANGGRAPH_REMOTE_GRAPH_ID!,\n * apiKey: process.env.LANGGRAPH_REMOTE_GRAPH_API_KEY,\n * url: process.env.LANGGRAPH_REMOTE_GRAPH_API_URL,\n * });\n *\n * const input = {\n * messages: [\n * {\n * role: \"human\",\n * content: \"Hello world!\",\n * },\n * ],\n * };\n *\n * const config = {\n * configurable: { thread_id: \"threadId1\" },\n * };\n *\n * await remoteGraph.invoke(input, config);\n * ```\n */\nexport class RemoteGraph<\n Nn extends StrRecord<string, PregelNode> = StrRecord<string, PregelNode>,\n Cc extends StrRecord<string, BaseChannel> = StrRecord<string, BaseChannel>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ContextType extends Record<string, any> = StrRecord<string, any>\n >\n extends Runnable<\n PregelInputType,\n PregelOutputType,\n PregelOptions<Nn, Cc, ContextType>\n >\n implements PregelInterface<Nn, Cc, ContextType>\n{\n static lc_name() {\n return \"RemoteGraph\";\n }\n\n lc_namespace = [\"langgraph\", \"pregel\"];\n\n lg_is_pregel = true;\n\n config?: RunnableConfig;\n\n graphId: string;\n\n protected client: Client;\n\n protected interruptBefore?: Array<keyof Nn> | All;\n\n protected interruptAfter?: Array<keyof Nn> | All;\n\n protected streamResumable?: boolean;\n\n constructor(params: RemoteGraphParams) {\n super(params);\n\n this.graphId = params.graphId;\n this.client =\n params.client ??\n new Client({\n apiUrl: params.url,\n apiKey: params.apiKey,\n defaultHeaders: params.headers,\n });\n this.config = params.config;\n this.interruptBefore = params.interruptBefore;\n this.interruptAfter = params.interruptAfter;\n this.streamResumable = params.streamResumable;\n }\n\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore Remove ignore when we remove support for 0.2 versions of core\n override withConfig(config: RunnableConfig): typeof this {\n const mergedConfig = mergeConfigs(this.config, config);\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.constructor as any)({ ...this, config: mergedConfig });\n }\n\n protected _sanitizeConfig(config: RunnableConfig) {\n const reservedConfigurableKeys = new Set([\n \"callbacks\",\n \"checkpoint_map\",\n \"checkpoint_id\",\n \"checkpoint_ns\",\n ]);\n\n const sanitizeObj = <T>(obj: T): T => {\n try {\n // This will only throw if we're trying to serialize a circular reference\n // or trying to serialize a BigInt...\n JSON.stringify(obj);\n return obj;\n } catch {\n const seen = new WeakSet();\n return JSON.parse(\n JSON.stringify(obj, (_, value) => {\n if (typeof value === \"object\" && value != null) {\n if (seen.has(value)) return \"[Circular]\";\n seen.add(value);\n }\n\n if (typeof value === \"bigint\") return value.toString();\n return value;\n })\n );\n }\n };\n\n // Remove non-JSON serializable fields from the config\n const sanitizedConfig = sanitizeObj(config);\n\n // Only include configurable keys that are not reserved and\n // not starting with \"__pregel_\" prefix\n const newConfigurable = Object.fromEntries(\n Object.entries(sanitizedConfig.configurable ?? {}).filter(\n ([k]) => !reservedConfigurableKeys.has(k) && !k.startsWith(\"__pregel_\")\n )\n );\n\n return {\n tags: sanitizedConfig.tags ?? [],\n metadata: sanitizedConfig.metadata ?? {},\n configurable: newConfigurable,\n recursion_limit: sanitizedConfig.recursionLimit,\n };\n }\n\n protected _getConfig(checkpoint: Record<string, unknown>): RunnableConfig {\n return {\n configurable: {\n thread_id: checkpoint.thread_id,\n checkpoint_ns: checkpoint.checkpoint_ns,\n checkpoint_id: checkpoint.checkpoint_id,\n checkpoint_map: checkpoint.checkpoint_map ?? {},\n },\n };\n }\n\n protected _getCheckpoint(config?: RunnableConfig): Checkpoint | undefined {\n if (config?.configurable === undefined) {\n return undefined;\n }\n\n const checkpointKeys = [\n \"thread_id\",\n \"checkpoint_ns\",\n \"checkpoint_id\",\n \"checkpoint_map\",\n ] as const;\n\n const checkpoint = Object.fromEntries(\n checkpointKeys\n .map((key) => [key, config.configurable![key]])\n .filter(([_, value]) => value !== undefined)\n );\n\n return Object.keys(checkpoint).length > 0 ? checkpoint : undefined;\n }\n\n protected _createStateSnapshot(state: ThreadState): StateSnapshot {\n const tasks: PregelTaskDescription[] = state.tasks.map((task) => {\n return {\n id: task.id,\n name: task.name,\n error: task.error ? { message: task.error } : undefined,\n // TODO: remove in LangGraph.js 0.4\n interrupts: task.interrupts.map(({ id, ...rest }) => ({\n interrupt_id: id,\n ...rest,\n })),\n // eslint-disable-next-line no-nested-ternary\n state: task.state\n ? this._createStateSnapshot(task.state)\n : task.checkpoint\n ? { configurable: task.checkpoint }\n : undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n result: (task as any).result,\n };\n });\n\n return {\n values: state.values,\n next: state.next ? [...state.next] : [],\n config: {\n configurable: {\n thread_id: state.checkpoint.thread_id,\n checkpoint_ns: state.checkpoint.checkpoint_ns,\n checkpoint_id: state.checkpoint.checkpoint_id,\n checkpoint_map: state.checkpoint.checkpoint_map ?? {},\n },\n },\n metadata: state.metadata\n ? (state.metadata as CheckpointMetadata)\n : undefined,\n createdAt: state.created_at ?? undefined,\n parentConfig: state.parent_checkpoint\n ? {\n configurable: {\n thread_id: state.parent_checkpoint.thread_id,\n checkpoint_ns: state.parent_checkpoint.checkpoint_ns,\n checkpoint_id: state.parent_checkpoint.checkpoint_id,\n checkpoint_map: state.parent_checkpoint.checkpoint_map ?? {},\n },\n }\n : undefined,\n tasks,\n };\n }\n\n override async invoke(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): Promise<PregelOutputType> {\n let lastValue;\n const stream = await this.stream(input, {\n ...options,\n streamMode: \"values\",\n });\n for await (const chunk of stream) {\n lastValue = chunk;\n }\n return lastValue;\n }\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n }\n ): IterableReadableStream<StreamEvent>;\n\n override streamEvents(\n input: PregelInputType,\n options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding: never;\n }\n ): IterableReadableStream<never>;\n\n override streamEvents(\n _input: PregelInputType,\n _options: Partial<PregelOptions<Nn, Cc, ContextType>> & {\n version: \"v1\" | \"v2\";\n encoding?: never;\n }\n ): IterableReadableStream<StreamEvent> {\n throw new Error(\"Not implemented.\");\n }\n\n override async *_streamIterator(\n input: PregelInputType,\n options?: Partial<PregelOptions<Nn, Cc, ContextType>>\n ): AsyncGenerator<PregelOutputType> {\n const mergedConfig = mergeConfigs(this.config, options);\n const sanitizedConfig = this._sanitizeConfig(mergedConfig);\n\n const streamProtocolInstance = options?.configurable?.[CONFIG_KEY_STREAM];\n\n const streamSubgraphs =\n options?.subgraphs ?? streamProtocolInstance !== undefined;\n\n const interruptBefore = options?.interruptBefore ?? this.interruptBefore;\n const interruptAfter = options?.interruptAfter ?? this.interruptAfter;\n\n const { updatedStreamModes, reqSingle, reqUpdates } = getStreamModes(\n options?.streamMode\n );\n\n const extendedStreamModes = [\n ...new Set([\n ...updatedStreamModes,\n ...(streamProtocolInstance?.modes ?? new Set()),\n ]),\n ].map((mode) => {\n if (mode === \"messages\") return \"messages-tuple\";\n return mode;\n });\n\n let command;\n let serializedInput;\n if (isCommand(input)) {\n // TODO: Remove cast when SDK type fix gets merged\n command = input.toJSON() as Record<string, unknown>;\n serializedInput = undefined;\n } else {\n serializedInput = _serializeInputs(input);\n }\n\n for await (const chunk of this.client.runs.stream(\n sanitizedConfig.configurable.thread_id as string,\n this.graphId,\n {\n command,\n input: serializedInput,\n config: sanitizedConfig,\n streamMode: extendedStreamModes,\n interruptBefore: interruptBefore as string[],\n interruptAfter: interruptAfter as string[],\n streamSubgraphs,\n ifNotExists: \"create\",\n signal: mergedConfig.signal,\n streamResumable: this.streamResumable,\n }\n )) {\n let mode;\n let namespace: string[];\n if (chunk.event.includes(CHECKPOINT_NAMESPACE_SEPARATOR)) {\n const eventComponents = chunk.event.split(\n CHECKPOINT_NAMESPACE_SEPARATOR\n );\n // eslint-disable-next-line prefer-destructuring\n mode = eventComponents[0];\n namespace = eventComponents.slice(1);\n } else {\n mode = chunk.event;\n namespace = [];\n }\n const callerNamespace = options?.configurable?.checkpoint_ns;\n if (typeof callerNamespace === \"string\") {\n namespace = callerNamespace\n .split(CHECKPOINT_NAMESPACE_SEPARATOR)\n .concat(namespace);\n }\n if (\n streamProtocolInstance !== undefined &&\n streamProtocolInstance.modes?.has(chunk.event)\n ) {\n streamProtocolInstance.push([namespace, mode, chunk.data]);\n }\n if (chunk.event.startsWith(\"updates\")) {\n if (\n typeof chunk.data === \"object\" &&\n chunk.data?.[INTERRUPT] !== undefined\n ) {\n throw new GraphInterrupt(chunk.data[INTERRUPT]);\n }\n if (!reqUpdates) {\n continue;\n }\n } else if (chunk.event?.startsWith(\"error\")) {\n throw new RemoteException(\n typeof chunk.data === \"string\"\n ? chunk.data\n : JSON.stringify(chunk.data)\n );\n }\n if (\n !updatedStreamModes.includes(\n chunk.event.split(CHECKPOINT_NAMESPACE_SEPARATOR)[0] as StreamMode\n )\n ) {\n continue;\n }\n if (options?.subgraphs) {\n if (reqSingle) {\n yield [namespace, chunk.data];\n } else {\n yield [namespace, mode, chunk.data];\n }\n } else if (reqSingle) {\n yield chunk.data;\n } else {\n yield [mode, chunk.data];\n }\n }\n }\n\n async updateState(\n inputConfig: LangGraphRunnableConfig,\n values: Record<string, unknown>,\n asNode?: string\n ): Promise<RunnableConfig> {\n const mergedConfig = mergeConfigs(this.config, inputConfig);\n const response = await this.client.threads.updateState(\n mergedConfig.configurable?.thread_id,\n { values, asNode, checkpoint: this._getCheckpoint(mergedConfig) }\n );\n // TODO: Fix SDK typing\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return this._getConfig((response as any).checkpoint);\n }\n\n async *getStateHistory(\n config: RunnableConfig,\n options?: CheckpointListOptions\n ): AsyncIterableIterator<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n const states = await this.client.threads.getHistory(\n mergedConfig.configurable?.thread_id,\n {\n limit: options?.limit ?? 10,\n // TODO: Fix type\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n before: this._getCheckpoint(options?.before) as any,\n metadata: options?.filter,\n checkpoint: this._getCheckpoint(mergedConfig),\n }\n );\n for (const state of states) {\n yield this._createStateSnapshot(state);\n }\n }\n\n protected _getDrawableNodes(\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>\n ): Record<string, DrawableNode> {\n const nodesMap: Record<string, DrawableNode> = {};\n for (const node of nodes) {\n const nodeId = node.id;\n nodesMap[nodeId] = {\n id: nodeId.toString(),\n name: typeof node.data === \"string\" ? node.data : node.data?.name ?? \"\",\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data: (node.data as any) ?? {},\n metadata:\n typeof node.data !== \"string\" ? node.data?.metadata ?? {} : {},\n };\n }\n return nodesMap;\n }\n\n async getState(\n config: RunnableConfig,\n options?: { subgraphs?: boolean }\n ): Promise<StateSnapshot> {\n const mergedConfig = mergeConfigs(this.config, config);\n\n const state = await this.client.threads.getState(\n mergedConfig.configurable?.thread_id,\n this._getCheckpoint(mergedConfig),\n options\n );\n return this._createStateSnapshot(state);\n }\n\n /** @deprecated Use getGraphAsync instead. The async method will become the default in the next minor release. */\n override getGraph(\n _?: RunnableConfig & { xray?: boolean | number }\n ): DrawableGraph {\n throw new Error(\n `The synchronous \"getGraph\" is not supported for this graph. Call \"getGraphAsync\" instead.`\n );\n }\n\n /**\n * Returns a drawable representation of the computation graph.\n */\n async getGraphAsync(config?: RunnableConfig & { xray?: boolean | number }) {\n const graph = await this.client.assistants.getGraph(this.graphId, {\n xray: config?.xray,\n });\n return new DrawableGraph({\n nodes: this._getDrawableNodes(graph.nodes),\n edges: graph.edges,\n });\n }\n\n /** @deprecated Use getSubgraphsAsync instead. The async method will become the default in the next minor release. */\n getSubgraphs(): Generator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n throw new Error(\n `The synchronous \"getSubgraphs\" method is not supported for this graph. Call \"getSubgraphsAsync\" instead.`\n );\n }\n\n async *getSubgraphsAsync(\n namespace?: string,\n recurse = false\n ): AsyncGenerator<[string, PregelInterface<Nn, Cc, ContextType>]> {\n const subgraphs = await this.client.assistants.getSubgraphs(this.graphId, {\n namespace,\n recurse,\n });\n\n for (const [ns, graphSchema] of Object.entries(subgraphs)) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const remoteSubgraph = new (this.constructor as any)({\n ...this,\n graphId: graphSchema.graph_id,\n });\n yield [ns, remoteSubgraph];\n }\n }\n}\n"],"mappings":";;;;;;;;;AA2DA,MAAM,oBAAoB,QAAkB;AAC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