@langchain/langgraph 1.0.7 → 1.0.12
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/package.json +7 -7
- package/CHANGELOG.md +0 -286
- package/dist/_virtual/rolldown_runtime.cjs +0 -25
- package/dist/channels/any_value.cjs +0 -46
- package/dist/channels/any_value.cjs.map +0 -1
- package/dist/channels/any_value.d.cts +0 -24
- package/dist/channels/any_value.d.cts.map +0 -1
- package/dist/channels/any_value.d.ts +0 -24
- package/dist/channels/any_value.d.ts.map +0 -1
- package/dist/channels/any_value.js +0 -46
- package/dist/channels/any_value.js.map +0 -1
- package/dist/channels/base.cjs +0 -102
- package/dist/channels/base.cjs.map +0 -1
- package/dist/channels/base.d.cts +0 -79
- package/dist/channels/base.d.cts.map +0 -1
- package/dist/channels/base.d.ts +0 -79
- package/dist/channels/base.d.ts.map +0 -1
- package/dist/channels/base.js +0 -97
- package/dist/channels/base.js.map +0 -1
- package/dist/channels/binop.cjs +0 -49
- package/dist/channels/binop.cjs.map +0 -1
- package/dist/channels/binop.d.cts +0 -22
- package/dist/channels/binop.d.cts.map +0 -1
- package/dist/channels/binop.d.ts +0 -22
- package/dist/channels/binop.d.ts.map +0 -1
- package/dist/channels/binop.js +0 -49
- package/dist/channels/binop.js.map +0 -1
- package/dist/channels/dynamic_barrier_value.cjs +0 -76
- package/dist/channels/dynamic_barrier_value.cjs.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.cts +0 -42
- package/dist/channels/dynamic_barrier_value.d.cts.map +0 -1
- package/dist/channels/dynamic_barrier_value.d.ts +0 -42
- package/dist/channels/dynamic_barrier_value.d.ts.map +0 -1
- package/dist/channels/dynamic_barrier_value.js +0 -76
- package/dist/channels/dynamic_barrier_value.js.map +0 -1
- package/dist/channels/ephemeral_value.cjs +0 -46
- package/dist/channels/ephemeral_value.cjs.map +0 -1
- package/dist/channels/ephemeral_value.d.cts +0 -22
- package/dist/channels/ephemeral_value.d.cts.map +0 -1
- package/dist/channels/ephemeral_value.d.ts +0 -22
- package/dist/channels/ephemeral_value.d.ts.map +0 -1
- package/dist/channels/ephemeral_value.js +0 -46
- package/dist/channels/ephemeral_value.js.map +0 -1
- package/dist/channels/index.cjs +0 -21
- package/dist/channels/index.d.cts +0 -9
- package/dist/channels/index.d.ts +0 -9
- package/dist/channels/index.js +0 -10
- package/dist/channels/last_value.cjs +0 -98
- package/dist/channels/last_value.cjs.map +0 -1
- package/dist/channels/last_value.d.cts +0 -44
- package/dist/channels/last_value.d.cts.map +0 -1
- package/dist/channels/last_value.d.ts +0 -44
- package/dist/channels/last_value.d.ts.map +0 -1
- package/dist/channels/last_value.js +0 -97
- package/dist/channels/last_value.js.map +0 -1
- package/dist/channels/named_barrier_value.cjs +0 -118
- package/dist/channels/named_barrier_value.cjs.map +0 -1
- package/dist/channels/named_barrier_value.d.cts +0 -46
- package/dist/channels/named_barrier_value.d.cts.map +0 -1
- package/dist/channels/named_barrier_value.d.ts +0 -46
- package/dist/channels/named_barrier_value.d.ts.map +0 -1
- package/dist/channels/named_barrier_value.js +0 -116
- package/dist/channels/named_barrier_value.js.map +0 -1
- package/dist/channels/topic.cjs +0 -65
- package/dist/channels/topic.cjs.map +0 -1
- package/dist/channels/topic.d.cts +0 -32
- package/dist/channels/topic.d.cts.map +0 -1
- package/dist/channels/topic.d.ts +0 -32
- package/dist/channels/topic.d.ts.map +0 -1
- package/dist/channels/topic.js +0 -65
- package/dist/channels/topic.js.map +0 -1
- package/dist/constants.cjs +0 -406
- package/dist/constants.cjs.map +0 -1
- package/dist/constants.d.cts +0 -285
- package/dist/constants.d.cts.map +0 -1
- package/dist/constants.d.ts +0 -285
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -362
- package/dist/constants.js.map +0 -1
- package/dist/errors.cjs +0 -163
- package/dist/errors.cjs.map +0 -1
- package/dist/errors.d.cts +0 -81
- package/dist/errors.d.cts.map +0 -1
- package/dist/errors.d.ts +0 -81
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -146
- package/dist/errors.js.map +0 -1
- package/dist/func/index.cjs +0 -301
- package/dist/func/index.cjs.map +0 -1
- package/dist/func/index.d.cts +0 -293
- package/dist/func/index.d.cts.map +0 -1
- package/dist/func/index.d.ts +0 -293
- package/dist/func/index.d.ts.map +0 -1
- package/dist/func/index.js +0 -298
- package/dist/func/index.js.map +0 -1
- package/dist/func/types.d.cts +0 -64
- package/dist/func/types.d.cts.map +0 -1
- package/dist/func/types.d.ts +0 -64
- package/dist/func/types.d.ts.map +0 -1
- package/dist/graph/annotation.cjs +0 -101
- package/dist/graph/annotation.cjs.map +0 -1
- package/dist/graph/annotation.d.cts +0 -116
- package/dist/graph/annotation.d.cts.map +0 -1
- package/dist/graph/annotation.d.ts +0 -116
- package/dist/graph/annotation.d.ts.map +0 -1
- package/dist/graph/annotation.js +0 -99
- package/dist/graph/annotation.js.map +0 -1
- package/dist/graph/graph.cjs +0 -423
- package/dist/graph/graph.cjs.map +0 -1
- package/dist/graph/graph.d.cts +0 -132
- package/dist/graph/graph.d.cts.map +0 -1
- package/dist/graph/graph.d.ts +0 -132
- package/dist/graph/graph.d.ts.map +0 -1
- package/dist/graph/graph.js +0 -420
- package/dist/graph/graph.js.map +0 -1
- package/dist/graph/index.cjs +0 -5
- package/dist/graph/index.js +0 -7
- package/dist/graph/message.cjs +0 -99
- package/dist/graph/message.cjs.map +0 -1
- package/dist/graph/message.d.cts +0 -40
- package/dist/graph/message.d.cts.map +0 -1
- package/dist/graph/message.d.ts +0 -40
- package/dist/graph/message.d.ts.map +0 -1
- package/dist/graph/message.js +0 -95
- package/dist/graph/message.js.map +0 -1
- package/dist/graph/messages_annotation.cjs +0 -110
- package/dist/graph/messages_annotation.cjs.map +0 -1
- package/dist/graph/messages_annotation.d.cts +0 -112
- package/dist/graph/messages_annotation.d.cts.map +0 -1
- package/dist/graph/messages_annotation.d.ts +0 -112
- package/dist/graph/messages_annotation.d.ts.map +0 -1
- package/dist/graph/messages_annotation.js +0 -107
- package/dist/graph/messages_annotation.js.map +0 -1
- package/dist/graph/state.cjs +0 -501
- package/dist/graph/state.cjs.map +0 -1
- package/dist/graph/state.d.cts +0 -236
- package/dist/graph/state.d.cts.map +0 -1
- package/dist/graph/state.d.ts +0 -236
- package/dist/graph/state.d.ts.map +0 -1
- package/dist/graph/state.js +0 -499
- package/dist/graph/state.js.map +0 -1
- package/dist/graph/zod/index.cjs +0 -10
- package/dist/graph/zod/index.d.cts +0 -3
- package/dist/graph/zod/index.d.ts +0 -3
- package/dist/graph/zod/index.js +0 -5
- package/dist/graph/zod/meta.cjs +0 -145
- package/dist/graph/zod/meta.cjs.map +0 -1
- package/dist/graph/zod/meta.d.cts +0 -116
- package/dist/graph/zod/meta.d.cts.map +0 -1
- package/dist/graph/zod/meta.d.ts +0 -116
- package/dist/graph/zod/meta.d.ts.map +0 -1
- package/dist/graph/zod/meta.js +0 -141
- package/dist/graph/zod/meta.js.map +0 -1
- package/dist/graph/zod/plugin.cjs +0 -41
- package/dist/graph/zod/plugin.cjs.map +0 -1
- package/dist/graph/zod/plugin.js +0 -41
- package/dist/graph/zod/plugin.js.map +0 -1
- package/dist/graph/zod/schema.cjs +0 -99
- package/dist/graph/zod/schema.cjs.map +0 -1
- package/dist/graph/zod/schema.d.cts +0 -38
- package/dist/graph/zod/schema.d.cts.map +0 -1
- package/dist/graph/zod/schema.d.ts +0 -38
- package/dist/graph/zod/schema.d.ts.map +0 -1
- package/dist/graph/zod/schema.js +0 -94
- package/dist/graph/zod/schema.js.map +0 -1
- package/dist/graph/zod/zod-registry.cjs +0 -43
- package/dist/graph/zod/zod-registry.cjs.map +0 -1
- package/dist/graph/zod/zod-registry.d.cts +0 -51
- package/dist/graph/zod/zod-registry.d.cts.map +0 -1
- package/dist/graph/zod/zod-registry.d.ts +0 -51
- package/dist/graph/zod/zod-registry.d.ts.map +0 -1
- package/dist/graph/zod/zod-registry.js +0 -41
- package/dist/graph/zod/zod-registry.js.map +0 -1
- package/dist/hash.cjs +0 -271
- package/dist/hash.cjs.map +0 -1
- package/dist/hash.js +0 -269
- package/dist/hash.js.map +0 -1
- package/dist/index.cjs +0 -112
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -26
- package/dist/index.d.ts +0 -26
- package/dist/index.js +0 -22
- package/dist/index.js.map +0 -1
- package/dist/interrupt.cjs +0 -82
- package/dist/interrupt.cjs.map +0 -1
- package/dist/interrupt.d.cts +0 -58
- package/dist/interrupt.d.cts.map +0 -1
- package/dist/interrupt.d.ts +0 -58
- package/dist/interrupt.d.ts.map +0 -1
- package/dist/interrupt.js +0 -81
- package/dist/interrupt.js.map +0 -1
- package/dist/prebuilt/agentName.cjs +0 -153
- package/dist/prebuilt/agentName.cjs.map +0 -1
- package/dist/prebuilt/agentName.d.cts +0 -42
- package/dist/prebuilt/agentName.d.cts.map +0 -1
- package/dist/prebuilt/agentName.d.ts +0 -42
- package/dist/prebuilt/agentName.d.ts.map +0 -1
- package/dist/prebuilt/agentName.js +0 -152
- package/dist/prebuilt/agentName.js.map +0 -1
- package/dist/prebuilt/agent_executor.cjs +0 -44
- package/dist/prebuilt/agent_executor.cjs.map +0 -1
- package/dist/prebuilt/agent_executor.d.cts +0 -58
- package/dist/prebuilt/agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/agent_executor.d.ts +0 -58
- package/dist/prebuilt/agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/agent_executor.js +0 -44
- package/dist/prebuilt/agent_executor.js.map +0 -1
- package/dist/prebuilt/chat_agent_executor.cjs +0 -68
- package/dist/prebuilt/chat_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.cts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.d.ts +0 -23
- package/dist/prebuilt/chat_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/chat_agent_executor.js +0 -67
- package/dist/prebuilt/chat_agent_executor.js.map +0 -1
- package/dist/prebuilt/index.cjs +0 -15
- package/dist/prebuilt/index.d.cts +0 -8
- package/dist/prebuilt/index.d.ts +0 -8
- package/dist/prebuilt/index.js +0 -8
- package/dist/prebuilt/interrupt.d.cts +0 -61
- package/dist/prebuilt/interrupt.d.cts.map +0 -1
- package/dist/prebuilt/interrupt.d.ts +0 -61
- package/dist/prebuilt/interrupt.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.cjs +0 -344
- package/dist/prebuilt/react_agent_executor.cjs.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.cts +0 -230
- package/dist/prebuilt/react_agent_executor.d.cts.map +0 -1
- package/dist/prebuilt/react_agent_executor.d.ts +0 -230
- package/dist/prebuilt/react_agent_executor.d.ts.map +0 -1
- package/dist/prebuilt/react_agent_executor.js +0 -342
- package/dist/prebuilt/react_agent_executor.js.map +0 -1
- package/dist/prebuilt/tool_executor.cjs +0 -48
- package/dist/prebuilt/tool_executor.cjs.map +0 -1
- package/dist/prebuilt/tool_executor.d.cts +0 -42
- package/dist/prebuilt/tool_executor.d.cts.map +0 -1
- package/dist/prebuilt/tool_executor.d.ts +0 -42
- package/dist/prebuilt/tool_executor.d.ts.map +0 -1
- package/dist/prebuilt/tool_executor.js +0 -47
- package/dist/prebuilt/tool_executor.js.map +0 -1
- package/dist/prebuilt/tool_node.cjs +0 -248
- package/dist/prebuilt/tool_node.cjs.map +0 -1
- package/dist/prebuilt/tool_node.d.cts +0 -182
- package/dist/prebuilt/tool_node.d.cts.map +0 -1
- package/dist/prebuilt/tool_node.d.ts +0 -182
- package/dist/prebuilt/tool_node.d.ts.map +0 -1
- package/dist/prebuilt/tool_node.js +0 -246
- package/dist/prebuilt/tool_node.js.map +0 -1
- package/dist/pregel/algo.cjs +0 -573
- package/dist/pregel/algo.cjs.map +0 -1
- package/dist/pregel/algo.d.cts +0 -13
- package/dist/pregel/algo.d.cts.map +0 -1
- package/dist/pregel/algo.d.ts +0 -13
- package/dist/pregel/algo.d.ts.map +0 -1
- package/dist/pregel/algo.js +0 -567
- package/dist/pregel/algo.js.map +0 -1
- package/dist/pregel/call.cjs +0 -53
- package/dist/pregel/call.cjs.map +0 -1
- package/dist/pregel/call.js +0 -50
- package/dist/pregel/call.js.map +0 -1
- package/dist/pregel/debug.cjs +0 -175
- package/dist/pregel/debug.cjs.map +0 -1
- package/dist/pregel/debug.js +0 -169
- package/dist/pregel/debug.js.map +0 -1
- package/dist/pregel/index.cjs +0 -1170
- package/dist/pregel/index.cjs.map +0 -1
- package/dist/pregel/index.d.cts +0 -546
- package/dist/pregel/index.d.cts.map +0 -1
- package/dist/pregel/index.d.ts +0 -546
- package/dist/pregel/index.d.ts.map +0 -1
- package/dist/pregel/index.js +0 -1168
- package/dist/pregel/index.js.map +0 -1
- package/dist/pregel/io.cjs +0 -140
- package/dist/pregel/io.cjs.map +0 -1
- package/dist/pregel/io.js +0 -135
- package/dist/pregel/io.js.map +0 -1
- package/dist/pregel/loop.cjs +0 -548
- package/dist/pregel/loop.cjs.map +0 -1
- package/dist/pregel/loop.js +0 -547
- package/dist/pregel/loop.js.map +0 -1
- package/dist/pregel/messages.cjs +0 -108
- package/dist/pregel/messages.cjs.map +0 -1
- package/dist/pregel/messages.js +0 -107
- package/dist/pregel/messages.js.map +0 -1
- package/dist/pregel/read.cjs +0 -152
- package/dist/pregel/read.cjs.map +0 -1
- package/dist/pregel/read.d.cts +0 -51
- package/dist/pregel/read.d.cts.map +0 -1
- package/dist/pregel/read.d.ts +0 -51
- package/dist/pregel/read.d.ts.map +0 -1
- package/dist/pregel/read.js +0 -150
- package/dist/pregel/read.js.map +0 -1
- package/dist/pregel/remote.cjs +0 -349
- package/dist/pregel/remote.cjs.map +0 -1
- package/dist/pregel/remote.d.cts +0 -123
- package/dist/pregel/remote.d.cts.map +0 -1
- package/dist/pregel/remote.d.ts +0 -123
- package/dist/pregel/remote.d.ts.map +0 -1
- package/dist/pregel/remote.js +0 -348
- package/dist/pregel/remote.js.map +0 -1
- package/dist/pregel/retry.cjs +0 -92
- package/dist/pregel/retry.cjs.map +0 -1
- package/dist/pregel/retry.js +0 -92
- package/dist/pregel/retry.js.map +0 -1
- package/dist/pregel/runnable_types.d.cts +0 -49
- package/dist/pregel/runnable_types.d.cts.map +0 -1
- package/dist/pregel/runnable_types.d.ts +0 -49
- package/dist/pregel/runnable_types.d.ts.map +0 -1
- package/dist/pregel/runner.cjs +0 -228
- package/dist/pregel/runner.cjs.map +0 -1
- package/dist/pregel/runner.js +0 -228
- package/dist/pregel/runner.js.map +0 -1
- package/dist/pregel/stream.cjs +0 -199
- package/dist/pregel/stream.cjs.map +0 -1
- package/dist/pregel/stream.js +0 -196
- package/dist/pregel/stream.js.map +0 -1
- package/dist/pregel/types.cjs +0 -27
- package/dist/pregel/types.cjs.map +0 -1
- package/dist/pregel/types.d.cts +0 -453
- package/dist/pregel/types.d.cts.map +0 -1
- package/dist/pregel/types.d.ts +0 -453
- package/dist/pregel/types.d.ts.map +0 -1
- package/dist/pregel/types.js +0 -25
- package/dist/pregel/types.js.map +0 -1
- package/dist/pregel/utils/config.cjs +0 -122
- package/dist/pregel/utils/config.cjs.map +0 -1
- package/dist/pregel/utils/config.d.cts +0 -36
- package/dist/pregel/utils/config.d.cts.map +0 -1
- package/dist/pregel/utils/config.d.ts +0 -36
- package/dist/pregel/utils/config.d.ts.map +0 -1
- package/dist/pregel/utils/config.js +0 -115
- package/dist/pregel/utils/config.js.map +0 -1
- package/dist/pregel/utils/index.cjs +0 -103
- package/dist/pregel/utils/index.cjs.map +0 -1
- package/dist/pregel/utils/index.d.cts +0 -51
- package/dist/pregel/utils/index.d.cts.map +0 -1
- package/dist/pregel/utils/index.d.ts +0 -51
- package/dist/pregel/utils/index.d.ts.map +0 -1
- package/dist/pregel/utils/index.js +0 -97
- package/dist/pregel/utils/index.js.map +0 -1
- package/dist/pregel/utils/subgraph.cjs +0 -19
- package/dist/pregel/utils/subgraph.cjs.map +0 -1
- package/dist/pregel/utils/subgraph.js +0 -17
- package/dist/pregel/utils/subgraph.js.map +0 -1
- package/dist/pregel/validate.cjs +0 -45
- package/dist/pregel/validate.cjs.map +0 -1
- package/dist/pregel/validate.js +0 -44
- package/dist/pregel/validate.js.map +0 -1
- package/dist/pregel/write.cjs +0 -97
- package/dist/pregel/write.cjs.map +0 -1
- package/dist/pregel/write.d.cts +0 -35
- package/dist/pregel/write.d.cts.map +0 -1
- package/dist/pregel/write.d.ts +0 -35
- package/dist/pregel/write.d.ts.map +0 -1
- package/dist/pregel/write.js +0 -95
- package/dist/pregel/write.js.map +0 -1
- package/dist/remote.cjs +0 -3
- package/dist/remote.d.cts +0 -2
- package/dist/remote.d.ts +0 -2
- package/dist/remote.js +0 -3
- package/dist/setup/async_local_storage.cjs +0 -12
- package/dist/setup/async_local_storage.cjs.map +0 -1
- package/dist/setup/async_local_storage.js +0 -11
- package/dist/setup/async_local_storage.js.map +0 -1
- package/dist/utils.cjs +0 -88
- package/dist/utils.cjs.map +0 -1
- package/dist/utils.d.cts +0 -32
- package/dist/utils.d.cts.map +0 -1
- package/dist/utils.d.ts +0 -32
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -81
- package/dist/utils.js.map +0 -1
- package/dist/web.cjs +0 -96
- package/dist/web.d.cts +0 -23
- package/dist/web.d.ts +0 -23
- package/dist/web.js +0 -15
- package/dist/writer.cjs +0 -15
- package/dist/writer.cjs.map +0 -1
- package/dist/writer.d.cts +0 -7
- package/dist/writer.d.cts.map +0 -1
- package/dist/writer.d.ts +0 -7
- package/dist/writer.d.ts.map +0 -1
- package/dist/writer.js +0 -14
- package/dist/writer.js.map +0 -1
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const __langchain_core_runnables = require_rolldown_runtime.__toESM(require("@langchain/core/runnables"));
|
|
3
|
-
const __langchain_core_messages = require_rolldown_runtime.__toESM(require("@langchain/core/messages"));
|
|
4
|
-
|
|
5
|
-
//#region src/prebuilt/agentName.ts
|
|
6
|
-
const NAME_PATTERN = /<name>(.*?)<\/name>/s;
|
|
7
|
-
const CONTENT_PATTERN = /<content>(.*?)<\/content>/s;
|
|
8
|
-
/**
|
|
9
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
10
|
-
*
|
|
11
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
12
|
-
*
|
|
13
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
14
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
15
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
16
|
-
*
|
|
17
|
-
* @deprecated migrated to `langchain` package.
|
|
18
|
-
*
|
|
19
|
-
* @param message - Message to add agent name formatting to
|
|
20
|
-
* @returns Message with agent name formatting
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
function _addInlineAgentName(message) {
|
|
25
|
-
const isAI = (0, __langchain_core_messages.isBaseMessage)(message) && ((0, __langchain_core_messages.isAIMessage)(message) || (0, __langchain_core_messages.isBaseMessageChunk)(message) && (0, __langchain_core_messages.isAIMessageChunk)(message));
|
|
26
|
-
if (!isAI || !message.name) return message;
|
|
27
|
-
const { name } = message;
|
|
28
|
-
if (typeof message.content === "string") {
|
|
29
|
-
const fields = Object.keys(message.lc_kwargs ?? {}).length > 0 ? message.lc_kwargs : message;
|
|
30
|
-
return new __langchain_core_messages.AIMessage({
|
|
31
|
-
...fields,
|
|
32
|
-
content: `<name>${name}</name><content>${message.content}</content>`,
|
|
33
|
-
name: void 0
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
const updatedContent = [];
|
|
37
|
-
let textBlockCount = 0;
|
|
38
|
-
for (const contentBlock of message.content) if (typeof contentBlock === "string") {
|
|
39
|
-
textBlockCount += 1;
|
|
40
|
-
updatedContent.push(`<name>${name}</name><content>${contentBlock}</content>`);
|
|
41
|
-
} else if (typeof contentBlock === "object" && "type" in contentBlock && contentBlock.type === "text") {
|
|
42
|
-
textBlockCount += 1;
|
|
43
|
-
updatedContent.push({
|
|
44
|
-
...contentBlock,
|
|
45
|
-
text: `<name>${name}</name><content>${contentBlock.text}</content>`
|
|
46
|
-
});
|
|
47
|
-
} else updatedContent.push(contentBlock);
|
|
48
|
-
if (!textBlockCount) updatedContent.unshift({
|
|
49
|
-
type: "text",
|
|
50
|
-
text: `<name>${name}</name><content></content>`
|
|
51
|
-
});
|
|
52
|
-
return new __langchain_core_messages.AIMessage({
|
|
53
|
-
...message.lc_kwargs,
|
|
54
|
-
content: updatedContent,
|
|
55
|
-
name: void 0
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Remove explicit name and content XML tags from the AI message content.
|
|
60
|
-
*
|
|
61
|
-
* @deprecated migrated to `langchain` package.
|
|
62
|
-
*
|
|
63
|
-
* Examples:
|
|
64
|
-
*
|
|
65
|
-
* @example
|
|
66
|
-
* ```typescript
|
|
67
|
-
* removeInlineAgentName(new AIMessage({ content: "<name>assistant</name><content>Hello</content>", name: "assistant" }))
|
|
68
|
-
* // AIMessage with content: "Hello"
|
|
69
|
-
*
|
|
70
|
-
* removeInlineAgentName(new AIMessage({ content: [{type: "text", text: "<name>assistant</name><content>Hello</content>"}], name: "assistant" }))
|
|
71
|
-
* // AIMessage with content: [{type: "text", text: "Hello"}]
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* @internal
|
|
75
|
-
*/
|
|
76
|
-
function _removeInlineAgentName(message) {
|
|
77
|
-
if (!(0, __langchain_core_messages.isAIMessage)(message) || !message.content) return message;
|
|
78
|
-
let updatedContent = [];
|
|
79
|
-
let updatedName;
|
|
80
|
-
if (Array.isArray(message.content)) updatedContent = message.content.filter((block) => {
|
|
81
|
-
if (block.type === "text" && typeof block.text === "string") {
|
|
82
|
-
const nameMatch = block.text.match(NAME_PATTERN);
|
|
83
|
-
const contentMatch = block.text.match(CONTENT_PATTERN);
|
|
84
|
-
if (nameMatch && (!contentMatch || contentMatch[1] === "")) {
|
|
85
|
-
updatedName = nameMatch[1];
|
|
86
|
-
return false;
|
|
87
|
-
}
|
|
88
|
-
return true;
|
|
89
|
-
}
|
|
90
|
-
return true;
|
|
91
|
-
}).map((block) => {
|
|
92
|
-
if (block.type === "text" && typeof block.text === "string") {
|
|
93
|
-
const nameMatch = block.text.match(NAME_PATTERN);
|
|
94
|
-
const contentMatch = block.text.match(CONTENT_PATTERN);
|
|
95
|
-
if (!nameMatch || !contentMatch) return block;
|
|
96
|
-
updatedName = nameMatch[1];
|
|
97
|
-
return {
|
|
98
|
-
...block,
|
|
99
|
-
text: contentMatch[1]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
return block;
|
|
103
|
-
});
|
|
104
|
-
else {
|
|
105
|
-
const content = message.content;
|
|
106
|
-
const nameMatch = content.match(NAME_PATTERN);
|
|
107
|
-
const contentMatch = content.match(CONTENT_PATTERN);
|
|
108
|
-
if (!nameMatch || !contentMatch) return message;
|
|
109
|
-
updatedName = nameMatch[1];
|
|
110
|
-
updatedContent = contentMatch[1];
|
|
111
|
-
}
|
|
112
|
-
return new __langchain_core_messages.AIMessage({
|
|
113
|
-
...Object.keys(message.lc_kwargs ?? {}).length > 0 ? message.lc_kwargs : message,
|
|
114
|
-
content: updatedContent,
|
|
115
|
-
name: updatedName
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
120
|
-
*
|
|
121
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
122
|
-
*
|
|
123
|
-
* * @deprecated migrated to `langchain` package.
|
|
124
|
-
*
|
|
125
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
126
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
127
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
128
|
-
*
|
|
129
|
-
* @param model - Language model to add agent name formatting to
|
|
130
|
-
* @param agentNameMode - How to expose the agent name to the LLM
|
|
131
|
-
* - "inline": Add the agent name directly into the content field of the AI message using XML-style tags.
|
|
132
|
-
* Example: "How can I help you" -> "<name>agent_name</name><content>How can I help you?</content>".
|
|
133
|
-
*/
|
|
134
|
-
function withAgentName(model, agentNameMode) {
|
|
135
|
-
let processInputMessage;
|
|
136
|
-
let processOutputMessage;
|
|
137
|
-
if (agentNameMode === "inline") {
|
|
138
|
-
processInputMessage = _addInlineAgentName;
|
|
139
|
-
processOutputMessage = _removeInlineAgentName;
|
|
140
|
-
} else throw new Error(`Invalid agent name mode: ${agentNameMode}. Needs to be one of: "inline"`);
|
|
141
|
-
function processInputMessages(messages) {
|
|
142
|
-
return messages.map(processInputMessage);
|
|
143
|
-
}
|
|
144
|
-
return __langchain_core_runnables.RunnableSequence.from([
|
|
145
|
-
__langchain_core_runnables.RunnableLambda.from(processInputMessages),
|
|
146
|
-
model,
|
|
147
|
-
__langchain_core_runnables.RunnableLambda.from(processOutputMessage)
|
|
148
|
-
]);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
//#endregion
|
|
152
|
-
exports.withAgentName = withAgentName;
|
|
153
|
-
//# sourceMappingURL=agentName.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentName.cjs","names":["AIMessage","updatedContent: MessageContent","updatedName: string | undefined","processInputMessage: (message: BaseMessageLike) => BaseMessageLike","processOutputMessage: (message: BaseMessage) => BaseMessage","RunnableSequence","RunnableLambda"],"sources":["../../src/prebuilt/agentName.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n AIMessage,\n AIMessageFields,\n BaseMessage,\n BaseMessageLike,\n isAIMessage,\n isAIMessageChunk,\n isBaseMessage,\n isBaseMessageChunk,\n MessageContent,\n} from \"@langchain/core/messages\";\nimport { RunnableLambda, RunnableSequence } from \"@langchain/core/runnables\";\n\nconst NAME_PATTERN = /<name>(.*?)<\\/name>/s;\nconst CONTENT_PATTERN = /<content>(.*?)<\\/content>/s;\n\nexport type AgentNameMode = \"inline\";\n\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @deprecated migrated to `langchain` package.\n *\n * @param message - Message to add agent name formatting to\n * @returns Message with agent name formatting\n *\n * @internal\n */\nexport function _addInlineAgentName<T extends BaseMessageLike>(\n message: T\n): T | AIMessage {\n const isAI =\n isBaseMessage(message) &&\n (isAIMessage(message) ||\n (isBaseMessageChunk(message) && isAIMessageChunk(message)));\n\n if (!isAI || !message.name) {\n return message;\n }\n\n const { name } = message;\n\n if (typeof message.content === \"string\") {\n const fields = (\n Object.keys(message.lc_kwargs ?? {}).length > 0\n ? message.lc_kwargs\n : message\n ) as AIMessageFields;\n\n return new AIMessage({\n ...fields,\n content: `<name>${name}</name><content>${message.content}</content>`,\n name: undefined,\n });\n }\n\n const updatedContent = [];\n let textBlockCount = 0;\n\n for (const contentBlock of message.content) {\n if (typeof contentBlock === \"string\") {\n textBlockCount += 1;\n updatedContent.push(\n `<name>${name}</name><content>${contentBlock}</content>`\n );\n } else if (\n typeof contentBlock === \"object\" &&\n \"type\" in contentBlock &&\n contentBlock.type === \"text\"\n ) {\n textBlockCount += 1;\n updatedContent.push({\n ...contentBlock,\n text: `<name>${name}</name><content>${contentBlock.text}</content>`,\n });\n } else {\n updatedContent.push(contentBlock);\n }\n }\n\n if (!textBlockCount) {\n updatedContent.unshift({\n type: \"text\",\n text: `<name>${name}</name><content></content>`,\n });\n }\n return new AIMessage({\n ...message.lc_kwargs,\n content: updatedContent as MessageContent,\n name: undefined,\n });\n}\n\n/**\n * Remove explicit name and content XML tags from the AI message content.\n *\n * @deprecated migrated to `langchain` package.\n *\n * Examples:\n *\n * @example\n * ```typescript\n * removeInlineAgentName(new AIMessage({ content: \"<name>assistant</name><content>Hello</content>\", name: \"assistant\" }))\n * // AIMessage with content: \"Hello\"\n *\n * removeInlineAgentName(new AIMessage({ content: [{type: \"text\", text: \"<name>assistant</name><content>Hello</content>\"}], name: \"assistant\" }))\n * // AIMessage with content: [{type: \"text\", text: \"Hello\"}]\n * ```\n *\n * @internal\n */\nexport function _removeInlineAgentName<T extends BaseMessage>(message: T): T {\n if (!isAIMessage(message) || !message.content) {\n return message;\n }\n\n let updatedContent: MessageContent = [];\n let updatedName: string | undefined;\n\n if (Array.isArray(message.content)) {\n updatedContent = message.content\n .filter((block) => {\n if (block.type === \"text\" && typeof block.text === \"string\") {\n const nameMatch = block.text.match(NAME_PATTERN);\n const contentMatch = block.text.match(CONTENT_PATTERN);\n // don't include empty content blocks that were added because there was no text block to modify\n if (nameMatch && (!contentMatch || contentMatch[1] === \"\")) {\n // capture name from text block\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n return false;\n }\n return true;\n }\n return true;\n })\n .map((block) => {\n if (block.type === \"text\" && typeof block.text === \"string\") {\n const nameMatch = block.text.match(NAME_PATTERN);\n const contentMatch = block.text.match(CONTENT_PATTERN);\n\n if (!nameMatch || !contentMatch) {\n return block;\n }\n\n // capture name from text block\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n\n return {\n ...block,\n text: contentMatch[1],\n };\n }\n return block;\n });\n } else {\n const content = message.content as string;\n const nameMatch = content.match(NAME_PATTERN);\n const contentMatch = content.match(CONTENT_PATTERN);\n\n if (!nameMatch || !contentMatch) {\n return message;\n }\n\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n // eslint-disable-next-line prefer-destructuring\n updatedContent = contentMatch[1];\n }\n\n return new AIMessage({\n ...(Object.keys(message.lc_kwargs ?? {}).length > 0\n ? message.lc_kwargs\n : message),\n content: updatedContent,\n name: updatedName,\n }) as T;\n}\n\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * * @deprecated migrated to `langchain` package.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @param model - Language model to add agent name formatting to\n * @param agentNameMode - How to expose the agent name to the LLM\n * - \"inline\": Add the agent name directly into the content field of the AI message using XML-style tags.\n * Example: \"How can I help you\" -> \"<name>agent_name</name><content>How can I help you?</content>\".\n */\nexport function withAgentName(\n model: LanguageModelLike,\n agentNameMode: AgentNameMode\n): LanguageModelLike {\n let processInputMessage: (message: BaseMessageLike) => BaseMessageLike;\n let processOutputMessage: (message: BaseMessage) => BaseMessage;\n\n if (agentNameMode === \"inline\") {\n processInputMessage = _addInlineAgentName;\n processOutputMessage = _removeInlineAgentName;\n } else {\n throw new Error(\n `Invalid agent name mode: ${agentNameMode}. Needs to be one of: \"inline\"`\n );\n }\n\n function processInputMessages(\n messages: BaseMessageLike[]\n ): BaseMessageLike[] {\n return messages.map(processInputMessage);\n }\n\n return RunnableSequence.from([\n RunnableLambda.from(processInputMessages),\n model,\n RunnableLambda.from(processOutputMessage),\n ]);\n}\n"],"mappings":";;;;;AAcA,MAAM,eAAe;AACrB,MAAM,kBAAkB;;;;;;;;;;;;;;;;;AAoBxB,SAAgB,oBACd,SACe;CACf,MAAM,oDACU,wDACD,8DACS,4DAA6B;AAErD,KAAI,CAAC,QAAQ,CAAC,QAAQ,KACpB,QAAO;CAGT,MAAM,EAAE,SAAS;AAEjB,KAAI,OAAO,QAAQ,YAAY,UAAU;EACvC,MAAM,SACJ,OAAO,KAAK,QAAQ,aAAa,IAAI,SAAS,IAC1C,QAAQ,YACR;AAGN,SAAO,IAAIA,oCAAU;GACnB,GAAG;GACH,SAAS,SAAS,KAAK,kBAAkB,QAAQ,QAAQ;GACzD,MAAM;;;CAIV,MAAM,iBAAiB;CACvB,IAAI,iBAAiB;AAErB,MAAK,MAAM,gBAAgB,QAAQ,QACjC,KAAI,OAAO,iBAAiB,UAAU;AACpC,oBAAkB;AAClB,iBAAe,KACb,SAAS,KAAK,kBAAkB,aAAa;YAG/C,OAAO,iBAAiB,YACxB,UAAU,gBACV,aAAa,SAAS,QACtB;AACA,oBAAkB;AAClB,iBAAe,KAAK;GAClB,GAAG;GACH,MAAM,SAAS,KAAK,kBAAkB,aAAa,KAAK;;OAG1D,gBAAe,KAAK;AAIxB,KAAI,CAAC,eACH,gBAAe,QAAQ;EACrB,MAAM;EACN,MAAM,SAAS,KAAK;;AAGxB,QAAO,IAAIA,oCAAU;EACnB,GAAG,QAAQ;EACX,SAAS;EACT,MAAM;;;;;;;;;;;;;;;;;;;;;AAsBV,SAAgB,uBAA8C,SAAe;AAC3E,KAAI,4CAAa,YAAY,CAAC,QAAQ,QACpC,QAAO;CAGT,IAAIC,iBAAiC;CACrC,IAAIC;AAEJ,KAAI,MAAM,QAAQ,QAAQ,SACxB,kBAAiB,QAAQ,QACtB,QAAQ,UAAU;AACjB,MAAI,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,UAAU;GAC3D,MAAM,YAAY,MAAM,KAAK,MAAM;GACnC,MAAM,eAAe,MAAM,KAAK,MAAM;AAEtC,OAAI,cAAc,CAAC,gBAAgB,aAAa,OAAO,KAAK;AAG1D,kBAAc,UAAU;AACxB,WAAO;;AAET,UAAO;;AAET,SAAO;IAER,KAAK,UAAU;AACd,MAAI,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,UAAU;GAC3D,MAAM,YAAY,MAAM,KAAK,MAAM;GACnC,MAAM,eAAe,MAAM,KAAK,MAAM;AAEtC,OAAI,CAAC,aAAa,CAAC,aACjB,QAAO;AAKT,iBAAc,UAAU;AAExB,UAAO;IACL,GAAG;IACH,MAAM,aAAa;;;AAGvB,SAAO;;MAEN;EACL,MAAM,UAAU,QAAQ;EACxB,MAAM,YAAY,QAAQ,MAAM;EAChC,MAAM,eAAe,QAAQ,MAAM;AAEnC,MAAI,CAAC,aAAa,CAAC,aACjB,QAAO;AAIT,gBAAc,UAAU;AAExB,mBAAiB,aAAa;;AAGhC,QAAO,IAAIF,oCAAU;EACnB,GAAI,OAAO,KAAK,QAAQ,aAAa,IAAI,SAAS,IAC9C,QAAQ,YACR;EACJ,SAAS;EACT,MAAM;;;;;;;;;;;;;;;;;;;AAoBV,SAAgB,cACd,OACA,eACmB;CACnB,IAAIG;CACJ,IAAIC;AAEJ,KAAI,kBAAkB,UAAU;AAC9B,wBAAsB;AACtB,yBAAuB;OAEvB,OAAM,IAAI,MACR,4BAA4B,cAAc;CAI9C,SAAS,qBACP,UACmB;AACnB,SAAO,SAAS,IAAI;;AAGtB,QAAOC,4CAAiB,KAAK;EAC3BC,0CAAe,KAAK;EACpB;EACAA,0CAAe,KAAK"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { BaseMessage, BaseMessageLike } from "@langchain/core/messages";
|
|
2
|
-
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
3
|
-
|
|
4
|
-
//#region src/prebuilt/agentName.d.ts
|
|
5
|
-
type AgentNameMode = "inline";
|
|
6
|
-
/**
|
|
7
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
8
|
-
*
|
|
9
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
10
|
-
*
|
|
11
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
12
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
13
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated migrated to `langchain` package.
|
|
16
|
-
*
|
|
17
|
-
* @param message - Message to add agent name formatting to
|
|
18
|
-
* @returns Message with agent name formatting
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
25
|
-
*
|
|
26
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
27
|
-
*
|
|
28
|
-
* * @deprecated migrated to `langchain` package.
|
|
29
|
-
*
|
|
30
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
31
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
32
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
33
|
-
*
|
|
34
|
-
* @param model - Language model to add agent name formatting to
|
|
35
|
-
* @param agentNameMode - How to expose the agent name to the LLM
|
|
36
|
-
* - "inline": Add the agent name directly into the content field of the AI message using XML-style tags.
|
|
37
|
-
* Example: "How can I help you" -> "<name>agent_name</name><content>How can I help you?</content>".
|
|
38
|
-
*/
|
|
39
|
-
declare function withAgentName(model: LanguageModelLike, agentNameMode: AgentNameMode): LanguageModelLike;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { AgentNameMode, withAgentName };
|
|
42
|
-
//# sourceMappingURL=agentName.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentName.d.cts","names":["LanguageModelLike","AIMessage","BaseMessage","BaseMessageLike","AgentNameMode","_addInlineAgentName","T","_removeInlineAgentName","withAgentName"],"sources":["../../src/prebuilt/agentName.d.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { AIMessage, BaseMessage, BaseMessageLike } from \"@langchain/core/messages\";\nexport type AgentNameMode = \"inline\";\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @deprecated migrated to `langchain` package.\n *\n * @param message - Message to add agent name formatting to\n * @returns Message with agent name formatting\n *\n * @internal\n */\nexport declare function _addInlineAgentName<T extends BaseMessageLike>(message: T): T | AIMessage;\n/**\n * Remove explicit name and content XML tags from the AI message content.\n *\n * @deprecated migrated to `langchain` package.\n *\n * Examples:\n *\n * @example\n * ```typescript\n * removeInlineAgentName(new AIMessage({ content: \"<name>assistant</name><content>Hello</content>\", name: \"assistant\" }))\n * // AIMessage with content: \"Hello\"\n *\n * removeInlineAgentName(new AIMessage({ content: [{type: \"text\", text: \"<name>assistant</name><content>Hello</content>\"}], name: \"assistant\" }))\n * // AIMessage with content: [{type: \"text\", text: \"Hello\"}]\n * ```\n *\n * @internal\n */\nexport declare function _removeInlineAgentName<T extends BaseMessage>(message: T): T;\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * * @deprecated migrated to `langchain` package.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @param model - Language model to add agent name formatting to\n * @param agentNameMode - How to expose the agent name to the LLM\n * - \"inline\": Add the agent name directly into the content field of the AI message using XML-style tags.\n * Example: \"How can I help you\" -> \"<name>agent_name</name><content>How can I help you?</content>\".\n */\nexport declare function withAgentName(model: LanguageModelLike, agentNameMode: AgentNameMode): LanguageModelLike;\n"],"mappings":";;;;KAEYI,aAAAA;;AAAZ;AAqDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwBI,aAAAA,QAAqBR,kCAAkCI,gBAAgBJ"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { AIMessage, BaseMessage, BaseMessageLike } from "@langchain/core/messages";
|
|
2
|
-
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
3
|
-
|
|
4
|
-
//#region src/prebuilt/agentName.d.ts
|
|
5
|
-
type AgentNameMode = "inline";
|
|
6
|
-
/**
|
|
7
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
8
|
-
*
|
|
9
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
10
|
-
*
|
|
11
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
12
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
13
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
14
|
-
*
|
|
15
|
-
* @deprecated migrated to `langchain` package.
|
|
16
|
-
*
|
|
17
|
-
* @param message - Message to add agent name formatting to
|
|
18
|
-
* @returns Message with agent name formatting
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
25
|
-
*
|
|
26
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
27
|
-
*
|
|
28
|
-
* * @deprecated migrated to `langchain` package.
|
|
29
|
-
*
|
|
30
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
31
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
32
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
33
|
-
*
|
|
34
|
-
* @param model - Language model to add agent name formatting to
|
|
35
|
-
* @param agentNameMode - How to expose the agent name to the LLM
|
|
36
|
-
* - "inline": Add the agent name directly into the content field of the AI message using XML-style tags.
|
|
37
|
-
* Example: "How can I help you" -> "<name>agent_name</name><content>How can I help you?</content>".
|
|
38
|
-
*/
|
|
39
|
-
declare function withAgentName(model: LanguageModelLike, agentNameMode: AgentNameMode): LanguageModelLike;
|
|
40
|
-
//#endregion
|
|
41
|
-
export { AgentNameMode, withAgentName };
|
|
42
|
-
//# sourceMappingURL=agentName.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentName.d.ts","names":["LanguageModelLike","AIMessage","BaseMessage","BaseMessageLike","AgentNameMode","_addInlineAgentName","T","_removeInlineAgentName","withAgentName"],"sources":["../../src/prebuilt/agentName.d.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { AIMessage, BaseMessage, BaseMessageLike } from \"@langchain/core/messages\";\nexport type AgentNameMode = \"inline\";\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @deprecated migrated to `langchain` package.\n *\n * @param message - Message to add agent name formatting to\n * @returns Message with agent name formatting\n *\n * @internal\n */\nexport declare function _addInlineAgentName<T extends BaseMessageLike>(message: T): T | AIMessage;\n/**\n * Remove explicit name and content XML tags from the AI message content.\n *\n * @deprecated migrated to `langchain` package.\n *\n * Examples:\n *\n * @example\n * ```typescript\n * removeInlineAgentName(new AIMessage({ content: \"<name>assistant</name><content>Hello</content>\", name: \"assistant\" }))\n * // AIMessage with content: \"Hello\"\n *\n * removeInlineAgentName(new AIMessage({ content: [{type: \"text\", text: \"<name>assistant</name><content>Hello</content>\"}], name: \"assistant\" }))\n * // AIMessage with content: [{type: \"text\", text: \"Hello\"}]\n * ```\n *\n * @internal\n */\nexport declare function _removeInlineAgentName<T extends BaseMessage>(message: T): T;\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * * @deprecated migrated to `langchain` package.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @param model - Language model to add agent name formatting to\n * @param agentNameMode - How to expose the agent name to the LLM\n * - \"inline\": Add the agent name directly into the content field of the AI message using XML-style tags.\n * Example: \"How can I help you\" -> \"<name>agent_name</name><content>How can I help you?</content>\".\n */\nexport declare function withAgentName(model: LanguageModelLike, agentNameMode: AgentNameMode): LanguageModelLike;\n"],"mappings":";;;;KAEYI,aAAAA;;AAAZ;AAqDA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwBI,aAAAA,QAAqBR,kCAAkCI,gBAAgBJ"}
|
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
import { RunnableLambda, RunnableSequence } from "@langchain/core/runnables";
|
|
2
|
-
import { AIMessage, isAIMessage, isAIMessageChunk, isBaseMessage, isBaseMessageChunk } from "@langchain/core/messages";
|
|
3
|
-
|
|
4
|
-
//#region src/prebuilt/agentName.ts
|
|
5
|
-
const NAME_PATTERN = /<name>(.*?)<\/name>/s;
|
|
6
|
-
const CONTENT_PATTERN = /<content>(.*?)<\/content>/s;
|
|
7
|
-
/**
|
|
8
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
9
|
-
*
|
|
10
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
11
|
-
*
|
|
12
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
13
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
14
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
15
|
-
*
|
|
16
|
-
* @deprecated migrated to `langchain` package.
|
|
17
|
-
*
|
|
18
|
-
* @param message - Message to add agent name formatting to
|
|
19
|
-
* @returns Message with agent name formatting
|
|
20
|
-
*
|
|
21
|
-
* @internal
|
|
22
|
-
*/
|
|
23
|
-
function _addInlineAgentName(message) {
|
|
24
|
-
const isAI = isBaseMessage(message) && (isAIMessage(message) || isBaseMessageChunk(message) && isAIMessageChunk(message));
|
|
25
|
-
if (!isAI || !message.name) return message;
|
|
26
|
-
const { name } = message;
|
|
27
|
-
if (typeof message.content === "string") {
|
|
28
|
-
const fields = Object.keys(message.lc_kwargs ?? {}).length > 0 ? message.lc_kwargs : message;
|
|
29
|
-
return new AIMessage({
|
|
30
|
-
...fields,
|
|
31
|
-
content: `<name>${name}</name><content>${message.content}</content>`,
|
|
32
|
-
name: void 0
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
const updatedContent = [];
|
|
36
|
-
let textBlockCount = 0;
|
|
37
|
-
for (const contentBlock of message.content) if (typeof contentBlock === "string") {
|
|
38
|
-
textBlockCount += 1;
|
|
39
|
-
updatedContent.push(`<name>${name}</name><content>${contentBlock}</content>`);
|
|
40
|
-
} else if (typeof contentBlock === "object" && "type" in contentBlock && contentBlock.type === "text") {
|
|
41
|
-
textBlockCount += 1;
|
|
42
|
-
updatedContent.push({
|
|
43
|
-
...contentBlock,
|
|
44
|
-
text: `<name>${name}</name><content>${contentBlock.text}</content>`
|
|
45
|
-
});
|
|
46
|
-
} else updatedContent.push(contentBlock);
|
|
47
|
-
if (!textBlockCount) updatedContent.unshift({
|
|
48
|
-
type: "text",
|
|
49
|
-
text: `<name>${name}</name><content></content>`
|
|
50
|
-
});
|
|
51
|
-
return new AIMessage({
|
|
52
|
-
...message.lc_kwargs,
|
|
53
|
-
content: updatedContent,
|
|
54
|
-
name: void 0
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Remove explicit name and content XML tags from the AI message content.
|
|
59
|
-
*
|
|
60
|
-
* @deprecated migrated to `langchain` package.
|
|
61
|
-
*
|
|
62
|
-
* Examples:
|
|
63
|
-
*
|
|
64
|
-
* @example
|
|
65
|
-
* ```typescript
|
|
66
|
-
* removeInlineAgentName(new AIMessage({ content: "<name>assistant</name><content>Hello</content>", name: "assistant" }))
|
|
67
|
-
* // AIMessage with content: "Hello"
|
|
68
|
-
*
|
|
69
|
-
* removeInlineAgentName(new AIMessage({ content: [{type: "text", text: "<name>assistant</name><content>Hello</content>"}], name: "assistant" }))
|
|
70
|
-
* // AIMessage with content: [{type: "text", text: "Hello"}]
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* @internal
|
|
74
|
-
*/
|
|
75
|
-
function _removeInlineAgentName(message) {
|
|
76
|
-
if (!isAIMessage(message) || !message.content) return message;
|
|
77
|
-
let updatedContent = [];
|
|
78
|
-
let updatedName;
|
|
79
|
-
if (Array.isArray(message.content)) updatedContent = message.content.filter((block) => {
|
|
80
|
-
if (block.type === "text" && typeof block.text === "string") {
|
|
81
|
-
const nameMatch = block.text.match(NAME_PATTERN);
|
|
82
|
-
const contentMatch = block.text.match(CONTENT_PATTERN);
|
|
83
|
-
if (nameMatch && (!contentMatch || contentMatch[1] === "")) {
|
|
84
|
-
updatedName = nameMatch[1];
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
}).map((block) => {
|
|
91
|
-
if (block.type === "text" && typeof block.text === "string") {
|
|
92
|
-
const nameMatch = block.text.match(NAME_PATTERN);
|
|
93
|
-
const contentMatch = block.text.match(CONTENT_PATTERN);
|
|
94
|
-
if (!nameMatch || !contentMatch) return block;
|
|
95
|
-
updatedName = nameMatch[1];
|
|
96
|
-
return {
|
|
97
|
-
...block,
|
|
98
|
-
text: contentMatch[1]
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
return block;
|
|
102
|
-
});
|
|
103
|
-
else {
|
|
104
|
-
const content = message.content;
|
|
105
|
-
const nameMatch = content.match(NAME_PATTERN);
|
|
106
|
-
const contentMatch = content.match(CONTENT_PATTERN);
|
|
107
|
-
if (!nameMatch || !contentMatch) return message;
|
|
108
|
-
updatedName = nameMatch[1];
|
|
109
|
-
updatedContent = contentMatch[1];
|
|
110
|
-
}
|
|
111
|
-
return new AIMessage({
|
|
112
|
-
...Object.keys(message.lc_kwargs ?? {}).length > 0 ? message.lc_kwargs : message,
|
|
113
|
-
content: updatedContent,
|
|
114
|
-
name: updatedName
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
/**
|
|
118
|
-
* Attach formatted agent names to the messages passed to and from a language model.
|
|
119
|
-
*
|
|
120
|
-
* This is useful for making a message history with multiple agents more coherent.
|
|
121
|
-
*
|
|
122
|
-
* * @deprecated migrated to `langchain` package.
|
|
123
|
-
*
|
|
124
|
-
* NOTE: agent name is consumed from the message.name field.
|
|
125
|
-
* If you're using an agent built with createReactAgent, name is automatically set.
|
|
126
|
-
* If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.
|
|
127
|
-
*
|
|
128
|
-
* @param model - Language model to add agent name formatting to
|
|
129
|
-
* @param agentNameMode - How to expose the agent name to the LLM
|
|
130
|
-
* - "inline": Add the agent name directly into the content field of the AI message using XML-style tags.
|
|
131
|
-
* Example: "How can I help you" -> "<name>agent_name</name><content>How can I help you?</content>".
|
|
132
|
-
*/
|
|
133
|
-
function withAgentName(model, agentNameMode) {
|
|
134
|
-
let processInputMessage;
|
|
135
|
-
let processOutputMessage;
|
|
136
|
-
if (agentNameMode === "inline") {
|
|
137
|
-
processInputMessage = _addInlineAgentName;
|
|
138
|
-
processOutputMessage = _removeInlineAgentName;
|
|
139
|
-
} else throw new Error(`Invalid agent name mode: ${agentNameMode}. Needs to be one of: "inline"`);
|
|
140
|
-
function processInputMessages(messages) {
|
|
141
|
-
return messages.map(processInputMessage);
|
|
142
|
-
}
|
|
143
|
-
return RunnableSequence.from([
|
|
144
|
-
RunnableLambda.from(processInputMessages),
|
|
145
|
-
model,
|
|
146
|
-
RunnableLambda.from(processOutputMessage)
|
|
147
|
-
]);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
//#endregion
|
|
151
|
-
export { withAgentName };
|
|
152
|
-
//# sourceMappingURL=agentName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentName.js","names":["updatedContent: MessageContent","updatedName: string | undefined","processInputMessage: (message: BaseMessageLike) => BaseMessageLike","processOutputMessage: (message: BaseMessage) => BaseMessage"],"sources":["../../src/prebuilt/agentName.ts"],"sourcesContent":["import { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport {\n AIMessage,\n AIMessageFields,\n BaseMessage,\n BaseMessageLike,\n isAIMessage,\n isAIMessageChunk,\n isBaseMessage,\n isBaseMessageChunk,\n MessageContent,\n} from \"@langchain/core/messages\";\nimport { RunnableLambda, RunnableSequence } from \"@langchain/core/runnables\";\n\nconst NAME_PATTERN = /<name>(.*?)<\\/name>/s;\nconst CONTENT_PATTERN = /<content>(.*?)<\\/content>/s;\n\nexport type AgentNameMode = \"inline\";\n\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @deprecated migrated to `langchain` package.\n *\n * @param message - Message to add agent name formatting to\n * @returns Message with agent name formatting\n *\n * @internal\n */\nexport function _addInlineAgentName<T extends BaseMessageLike>(\n message: T\n): T | AIMessage {\n const isAI =\n isBaseMessage(message) &&\n (isAIMessage(message) ||\n (isBaseMessageChunk(message) && isAIMessageChunk(message)));\n\n if (!isAI || !message.name) {\n return message;\n }\n\n const { name } = message;\n\n if (typeof message.content === \"string\") {\n const fields = (\n Object.keys(message.lc_kwargs ?? {}).length > 0\n ? message.lc_kwargs\n : message\n ) as AIMessageFields;\n\n return new AIMessage({\n ...fields,\n content: `<name>${name}</name><content>${message.content}</content>`,\n name: undefined,\n });\n }\n\n const updatedContent = [];\n let textBlockCount = 0;\n\n for (const contentBlock of message.content) {\n if (typeof contentBlock === \"string\") {\n textBlockCount += 1;\n updatedContent.push(\n `<name>${name}</name><content>${contentBlock}</content>`\n );\n } else if (\n typeof contentBlock === \"object\" &&\n \"type\" in contentBlock &&\n contentBlock.type === \"text\"\n ) {\n textBlockCount += 1;\n updatedContent.push({\n ...contentBlock,\n text: `<name>${name}</name><content>${contentBlock.text}</content>`,\n });\n } else {\n updatedContent.push(contentBlock);\n }\n }\n\n if (!textBlockCount) {\n updatedContent.unshift({\n type: \"text\",\n text: `<name>${name}</name><content></content>`,\n });\n }\n return new AIMessage({\n ...message.lc_kwargs,\n content: updatedContent as MessageContent,\n name: undefined,\n });\n}\n\n/**\n * Remove explicit name and content XML tags from the AI message content.\n *\n * @deprecated migrated to `langchain` package.\n *\n * Examples:\n *\n * @example\n * ```typescript\n * removeInlineAgentName(new AIMessage({ content: \"<name>assistant</name><content>Hello</content>\", name: \"assistant\" }))\n * // AIMessage with content: \"Hello\"\n *\n * removeInlineAgentName(new AIMessage({ content: [{type: \"text\", text: \"<name>assistant</name><content>Hello</content>\"}], name: \"assistant\" }))\n * // AIMessage with content: [{type: \"text\", text: \"Hello\"}]\n * ```\n *\n * @internal\n */\nexport function _removeInlineAgentName<T extends BaseMessage>(message: T): T {\n if (!isAIMessage(message) || !message.content) {\n return message;\n }\n\n let updatedContent: MessageContent = [];\n let updatedName: string | undefined;\n\n if (Array.isArray(message.content)) {\n updatedContent = message.content\n .filter((block) => {\n if (block.type === \"text\" && typeof block.text === \"string\") {\n const nameMatch = block.text.match(NAME_PATTERN);\n const contentMatch = block.text.match(CONTENT_PATTERN);\n // don't include empty content blocks that were added because there was no text block to modify\n if (nameMatch && (!contentMatch || contentMatch[1] === \"\")) {\n // capture name from text block\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n return false;\n }\n return true;\n }\n return true;\n })\n .map((block) => {\n if (block.type === \"text\" && typeof block.text === \"string\") {\n const nameMatch = block.text.match(NAME_PATTERN);\n const contentMatch = block.text.match(CONTENT_PATTERN);\n\n if (!nameMatch || !contentMatch) {\n return block;\n }\n\n // capture name from text block\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n\n return {\n ...block,\n text: contentMatch[1],\n };\n }\n return block;\n });\n } else {\n const content = message.content as string;\n const nameMatch = content.match(NAME_PATTERN);\n const contentMatch = content.match(CONTENT_PATTERN);\n\n if (!nameMatch || !contentMatch) {\n return message;\n }\n\n // eslint-disable-next-line prefer-destructuring\n updatedName = nameMatch[1];\n // eslint-disable-next-line prefer-destructuring\n updatedContent = contentMatch[1];\n }\n\n return new AIMessage({\n ...(Object.keys(message.lc_kwargs ?? {}).length > 0\n ? message.lc_kwargs\n : message),\n content: updatedContent,\n name: updatedName,\n }) as T;\n}\n\n/**\n * Attach formatted agent names to the messages passed to and from a language model.\n *\n * This is useful for making a message history with multiple agents more coherent.\n *\n * * @deprecated migrated to `langchain` package.\n *\n * NOTE: agent name is consumed from the message.name field.\n * If you're using an agent built with createReactAgent, name is automatically set.\n * If you're building a custom agent, make sure to set the name on the AI message returned by the LLM.\n *\n * @param model - Language model to add agent name formatting to\n * @param agentNameMode - How to expose the agent name to the LLM\n * - \"inline\": Add the agent name directly into the content field of the AI message using XML-style tags.\n * Example: \"How can I help you\" -> \"<name>agent_name</name><content>How can I help you?</content>\".\n */\nexport function withAgentName(\n model: LanguageModelLike,\n agentNameMode: AgentNameMode\n): LanguageModelLike {\n let processInputMessage: (message: BaseMessageLike) => BaseMessageLike;\n let processOutputMessage: (message: BaseMessage) => BaseMessage;\n\n if (agentNameMode === \"inline\") {\n processInputMessage = _addInlineAgentName;\n processOutputMessage = _removeInlineAgentName;\n } else {\n throw new Error(\n `Invalid agent name mode: ${agentNameMode}. Needs to be one of: \"inline\"`\n );\n }\n\n function processInputMessages(\n messages: BaseMessageLike[]\n ): BaseMessageLike[] {\n return messages.map(processInputMessage);\n }\n\n return RunnableSequence.from([\n RunnableLambda.from(processInputMessages),\n model,\n RunnableLambda.from(processOutputMessage),\n ]);\n}\n"],"mappings":";;;;AAcA,MAAM,eAAe;AACrB,MAAM,kBAAkB;;;;;;;;;;;;;;;;;AAoBxB,SAAgB,oBACd,SACe;CACf,MAAM,OACJ,cAAc,aACb,YAAY,YACV,mBAAmB,YAAY,iBAAiB;AAErD,KAAI,CAAC,QAAQ,CAAC,QAAQ,KACpB,QAAO;CAGT,MAAM,EAAE,SAAS;AAEjB,KAAI,OAAO,QAAQ,YAAY,UAAU;EACvC,MAAM,SACJ,OAAO,KAAK,QAAQ,aAAa,IAAI,SAAS,IAC1C,QAAQ,YACR;AAGN,SAAO,IAAI,UAAU;GACnB,GAAG;GACH,SAAS,SAAS,KAAK,kBAAkB,QAAQ,QAAQ;GACzD,MAAM;;;CAIV,MAAM,iBAAiB;CACvB,IAAI,iBAAiB;AAErB,MAAK,MAAM,gBAAgB,QAAQ,QACjC,KAAI,OAAO,iBAAiB,UAAU;AACpC,oBAAkB;AAClB,iBAAe,KACb,SAAS,KAAK,kBAAkB,aAAa;YAG/C,OAAO,iBAAiB,YACxB,UAAU,gBACV,aAAa,SAAS,QACtB;AACA,oBAAkB;AAClB,iBAAe,KAAK;GAClB,GAAG;GACH,MAAM,SAAS,KAAK,kBAAkB,aAAa,KAAK;;OAG1D,gBAAe,KAAK;AAIxB,KAAI,CAAC,eACH,gBAAe,QAAQ;EACrB,MAAM;EACN,MAAM,SAAS,KAAK;;AAGxB,QAAO,IAAI,UAAU;EACnB,GAAG,QAAQ;EACX,SAAS;EACT,MAAM;;;;;;;;;;;;;;;;;;;;;AAsBV,SAAgB,uBAA8C,SAAe;AAC3E,KAAI,CAAC,YAAY,YAAY,CAAC,QAAQ,QACpC,QAAO;CAGT,IAAIA,iBAAiC;CACrC,IAAIC;AAEJ,KAAI,MAAM,QAAQ,QAAQ,SACxB,kBAAiB,QAAQ,QACtB,QAAQ,UAAU;AACjB,MAAI,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,UAAU;GAC3D,MAAM,YAAY,MAAM,KAAK,MAAM;GACnC,MAAM,eAAe,MAAM,KAAK,MAAM;AAEtC,OAAI,cAAc,CAAC,gBAAgB,aAAa,OAAO,KAAK;AAG1D,kBAAc,UAAU;AACxB,WAAO;;AAET,UAAO;;AAET,SAAO;IAER,KAAK,UAAU;AACd,MAAI,MAAM,SAAS,UAAU,OAAO,MAAM,SAAS,UAAU;GAC3D,MAAM,YAAY,MAAM,KAAK,MAAM;GACnC,MAAM,eAAe,MAAM,KAAK,MAAM;AAEtC,OAAI,CAAC,aAAa,CAAC,aACjB,QAAO;AAKT,iBAAc,UAAU;AAExB,UAAO;IACL,GAAG;IACH,MAAM,aAAa;;;AAGvB,SAAO;;MAEN;EACL,MAAM,UAAU,QAAQ;EACxB,MAAM,YAAY,QAAQ,MAAM;EAChC,MAAM,eAAe,QAAQ,MAAM;AAEnC,MAAI,CAAC,aAAa,CAAC,aACjB,QAAO;AAIT,gBAAc,UAAU;AAExB,mBAAiB,aAAa;;AAGhC,QAAO,IAAI,UAAU;EACnB,GAAI,OAAO,KAAK,QAAQ,aAAa,IAAI,SAAS,IAC9C,QAAQ,YACR;EACJ,SAAS;EACT,MAAM;;;;;;;;;;;;;;;;;;;AAoBV,SAAgB,cACd,OACA,eACmB;CACnB,IAAIC;CACJ,IAAIC;AAEJ,KAAI,kBAAkB,UAAU;AAC9B,wBAAsB;AACtB,yBAAuB;OAEvB,OAAM,IAAI,MACR,4BAA4B,cAAc;CAI9C,SAAS,qBACP,UACmB;AACnB,SAAO,SAAS,IAAI;;AAGtB,QAAO,iBAAiB,KAAK;EAC3B,eAAe,KAAK;EACpB;EACA,eAAe,KAAK"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const require_constants = require('../constants.cjs');
|
|
2
|
-
const require_state = require('../graph/state.cjs');
|
|
3
|
-
const require_tool_executor = require('./tool_executor.cjs');
|
|
4
|
-
|
|
5
|
-
//#region src/prebuilt/agent_executor.ts
|
|
6
|
-
/** @ignore */
|
|
7
|
-
function createAgentExecutor({ agentRunnable, tools }) {
|
|
8
|
-
let toolExecutor;
|
|
9
|
-
if (!Array.isArray(tools)) toolExecutor = tools;
|
|
10
|
-
else toolExecutor = new require_tool_executor.ToolExecutor({ tools });
|
|
11
|
-
const shouldContinue = (data) => {
|
|
12
|
-
if (data.agentOutcome && "returnValues" in data.agentOutcome) return "end";
|
|
13
|
-
return "continue";
|
|
14
|
-
};
|
|
15
|
-
const runAgent = async (data, config) => {
|
|
16
|
-
const agentOutcome = await agentRunnable.invoke(data, config);
|
|
17
|
-
return { agentOutcome };
|
|
18
|
-
};
|
|
19
|
-
const executeTools = async (data, config) => {
|
|
20
|
-
const agentAction = data.agentOutcome;
|
|
21
|
-
if (!agentAction || "returnValues" in agentAction) throw new Error("Agent has not been run yet");
|
|
22
|
-
const output = await toolExecutor.invoke(agentAction, config);
|
|
23
|
-
return { steps: [{
|
|
24
|
-
action: agentAction,
|
|
25
|
-
observation: output
|
|
26
|
-
}] };
|
|
27
|
-
};
|
|
28
|
-
const workflow = new require_state.StateGraph({ channels: {
|
|
29
|
-
input: null,
|
|
30
|
-
agentOutcome: null,
|
|
31
|
-
steps: {
|
|
32
|
-
reducer: (x, y) => x.concat(y),
|
|
33
|
-
default: () => []
|
|
34
|
-
}
|
|
35
|
-
} }).addNode("agent", runAgent).addNode("action", executeTools).addEdge(require_constants.START, "agent").addConditionalEdges("agent", shouldContinue, {
|
|
36
|
-
continue: "action",
|
|
37
|
-
end: require_constants.END
|
|
38
|
-
}).addEdge("action", "agent");
|
|
39
|
-
return workflow.compile();
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
//#endregion
|
|
43
|
-
exports.createAgentExecutor = createAgentExecutor;
|
|
44
|
-
//# sourceMappingURL=agent_executor.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agent_executor.cjs","names":["toolExecutor: ToolExecutor","ToolExecutor","StateGraph","START","END"],"sources":["../../src/prebuilt/agent_executor.ts"],"sourcesContent":["import { AgentAction, AgentFinish } from \"@langchain/core/agents\";\nimport { BaseMessage } from \"@langchain/core/messages\";\nimport { Runnable, type RunnableConfig } from \"@langchain/core/runnables\";\nimport { Tool } from \"@langchain/core/tools\";\nimport { ToolExecutor } from \"./tool_executor.js\";\nimport { StateGraph } from \"../graph/state.js\";\nimport { END, START } from \"../constants.js\";\nimport type { BaseChannel } from \"../channels/base.js\";\n\ninterface Step {\n action: AgentAction | AgentFinish;\n observation: unknown;\n}\n\n/** @ignore */\nexport interface AgentExecutorState {\n agentOutcome?: AgentAction | AgentFinish;\n steps: Array<Step>;\n input: string;\n chatHistory?: BaseMessage[];\n}\n\n/** @ignore */\nexport function createAgentExecutor({\n agentRunnable,\n tools,\n}: {\n agentRunnable: Runnable;\n tools: Array<Tool> | ToolExecutor;\n}) {\n let toolExecutor: ToolExecutor;\n if (!Array.isArray(tools)) {\n toolExecutor = tools;\n } else {\n toolExecutor = new ToolExecutor({\n tools,\n });\n }\n\n // Define logic that will be used to determine which conditional edge to go down\n const shouldContinue = (data: AgentExecutorState) => {\n if (data.agentOutcome && \"returnValues\" in data.agentOutcome) {\n return \"end\";\n }\n return \"continue\";\n };\n\n const runAgent = async (\n data: AgentExecutorState,\n config?: RunnableConfig\n ) => {\n const agentOutcome = await agentRunnable.invoke(data, config);\n return {\n agentOutcome,\n };\n };\n\n const executeTools = async (\n data: AgentExecutorState,\n config?: RunnableConfig\n ): Promise<Partial<AgentExecutorState>> => {\n const agentAction = data.agentOutcome;\n if (!agentAction || \"returnValues\" in agentAction) {\n throw new Error(\"Agent has not been run yet\");\n }\n const output = await toolExecutor.invoke(agentAction, config);\n return {\n steps: [{ action: agentAction, observation: output }],\n };\n };\n\n // Define a new graph\n const workflow = new StateGraph<{\n [K in keyof AgentExecutorState]: BaseChannel<\n AgentExecutorState[K],\n AgentExecutorState[K]\n >;\n }>({\n channels: {\n input: null,\n agentOutcome: null,\n steps: {\n reducer: (x: Step[], y: Step[]) => x.concat(y),\n default: () => [] as Step[],\n },\n },\n })\n // Define the two nodes we will cycle between\n .addNode(\"agent\", runAgent)\n .addNode(\"action\", executeTools)\n // Set the entrypoint as `agent`\n // This means that this node is the first one called\n .addEdge(START, \"agent\")\n // We now add a conditional edge\n .addConditionalEdges(\n // First, we define the start node. We use `agent`.\n // This means these are the edges taken after the `agent` node is called.\n \"agent\",\n // Next, we pass in the function that will determine which node is called next.\n shouldContinue,\n // Finally we pass in a mapping.\n // The keys are strings, and the values are other nodes.\n // END is a special node marking that the graph should finish.\n // What will happen is we will call `should_continue`, and then the output of that\n // will be matched against the keys in this mapping.\n // Based on which one it matches, that node will then be called.\n {\n // If `tools`, then we call the tool node.\n continue: \"action\",\n // Otherwise we finish.\n end: END,\n }\n )\n // We now add a normal edge from `tools` to `agent`.\n // This means that after `tools` is called, `agent` node is called next.\n .addEdge(\"action\", \"agent\");\n\n return workflow.compile();\n}\n"],"mappings":";;;;;;AAuBA,SAAgB,oBAAoB,EAClC,eACA,SAIC;CACD,IAAIA;AACJ,KAAI,CAAC,MAAM,QAAQ,OACjB,gBAAe;KAEf,gBAAe,IAAIC,mCAAa,EAC9B;CAKJ,MAAM,kBAAkB,SAA6B;AACnD,MAAI,KAAK,gBAAgB,kBAAkB,KAAK,aAC9C,QAAO;AAET,SAAO;;CAGT,MAAM,WAAW,OACf,MACA,WACG;EACH,MAAM,eAAe,MAAM,cAAc,OAAO,MAAM;AACtD,SAAO,EACL;;CAIJ,MAAM,eAAe,OACnB,MACA,WACyC;EACzC,MAAM,cAAc,KAAK;AACzB,MAAI,CAAC,eAAe,kBAAkB,YACpC,OAAM,IAAI,MAAM;EAElB,MAAM,SAAS,MAAM,aAAa,OAAO,aAAa;AACtD,SAAO,EACL,OAAO,CAAC;GAAE,QAAQ;GAAa,aAAa;;;CAKhD,MAAM,WAAW,IAAIC,yBAKlB,EACD,UAAU;EACR,OAAO;EACP,cAAc;EACd,OAAO;GACL,UAAU,GAAW,MAAc,EAAE,OAAO;GAC5C,eAAe;;MAKlB,QAAQ,SAAS,UACjB,QAAQ,UAAU,cAGlB,QAAQC,yBAAO,SAEf,oBAGC,SAEA,gBAOA;EAEE,UAAU;EAEV,KAAKC;IAKR,QAAQ,UAAU;AAErB,QAAO,SAAS"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "../channels/base.cjs";
|
|
2
|
-
import { StateDefinition } from "../graph/annotation.cjs";
|
|
3
|
-
import { CompiledStateGraph } from "../graph/state.cjs";
|
|
4
|
-
import { ToolExecutor } from "./tool_executor.cjs";
|
|
5
|
-
import { Runnable } from "@langchain/core/runnables";
|
|
6
|
-
import * as _langchain_core_messages1 from "@langchain/core/messages";
|
|
7
|
-
import { BaseMessage } from "@langchain/core/messages";
|
|
8
|
-
import { AgentAction, AgentFinish } from "@langchain/core/agents";
|
|
9
|
-
import { Tool } from "@langchain/core/tools";
|
|
10
|
-
|
|
11
|
-
//#region src/prebuilt/agent_executor.d.ts
|
|
12
|
-
interface Step {
|
|
13
|
-
action: AgentAction | AgentFinish;
|
|
14
|
-
observation: unknown;
|
|
15
|
-
}
|
|
16
|
-
/** @ignore */
|
|
17
|
-
interface AgentExecutorState {
|
|
18
|
-
agentOutcome?: AgentAction | AgentFinish;
|
|
19
|
-
steps: Array<Step>;
|
|
20
|
-
input: string;
|
|
21
|
-
chatHistory?: BaseMessage[];
|
|
22
|
-
}
|
|
23
|
-
/** @ignore */
|
|
24
|
-
declare function createAgentExecutor({
|
|
25
|
-
agentRunnable,
|
|
26
|
-
tools
|
|
27
|
-
}: {
|
|
28
|
-
agentRunnable: Runnable;
|
|
29
|
-
tools: Array<Tool> | ToolExecutor;
|
|
30
|
-
}): CompiledStateGraph<{
|
|
31
|
-
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
32
|
-
steps: Step[];
|
|
33
|
-
input: string;
|
|
34
|
-
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
37
|
-
steps?: Step[] | undefined;
|
|
38
|
-
input?: string | undefined;
|
|
39
|
-
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
40
|
-
}, "__start__" | "action" | "agent", {
|
|
41
|
-
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
42
|
-
steps: BaseChannel<Step[], Step[], unknown>;
|
|
43
|
-
input: BaseChannel<string, string, unknown>;
|
|
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
|
-
}, {
|
|
46
|
-
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
47
|
-
steps: BaseChannel<Step[], Step[], unknown>;
|
|
48
|
-
input: BaseChannel<string, string, unknown>;
|
|
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
|
-
}, StateDefinition, {
|
|
51
|
-
action: Partial<AgentExecutorState>;
|
|
52
|
-
agent: {
|
|
53
|
-
agentOutcome: any;
|
|
54
|
-
};
|
|
55
|
-
}, unknown, unknown>;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AgentExecutorState, createAgentExecutor };
|
|
58
|
-
//# sourceMappingURL=agent_executor.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,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,OAAAA,EAAAA;cAENL,CAAAA,EAUAM,WAVAN,CAUYA,WAVZA,GAU0BC,WAV1BD,GAAAA,SAAAA,EAUmDA,WAVnDA,GAUiEC,WAVjED,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;OAAcC,EAWtBK,WAXsBL,CAWVM,IAXUN,EAAAA,EAWFM,IAXEN,EAAAA,EAAAA,OAAAA,CAAAA;OACtBM,EAWAD,WAXAC,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA;aAAIM,CAAAA,EAYGP,WAZHO,CAYeX,WAVmCY,CAS3CD,yBAAAA,CACuDC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAVjED,EAAAA,GAAAA,SAAAA,EAU6FZ,WAV7FY,CAUxBD,yBAAAA,CAAoKC,gBAAAA,EAAgBD,yBAAAA,CAAqCE,WAAAA,CAVjMD,EAAAA,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;;cAA/CZ,CAAAA,EAYCI,WAZDJ,CAYaF,WAZbE,GAY2BD,WAZ3BC,GAAAA,SAAAA,EAYoDF,WAZpDE,GAYkED,WAZlEC,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;OAECF,EAWRM,WAXQN,CAWIO,IAXJP,EAAAA,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"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { BaseChannel } from "../channels/base.js";
|
|
2
|
-
import { StateDefinition } from "../graph/annotation.js";
|
|
3
|
-
import { CompiledStateGraph } from "../graph/state.js";
|
|
4
|
-
import { ToolExecutor } from "./tool_executor.js";
|
|
5
|
-
import { Runnable } from "@langchain/core/runnables";
|
|
6
|
-
import * as _langchain_core_messages1 from "@langchain/core/messages";
|
|
7
|
-
import { BaseMessage } from "@langchain/core/messages";
|
|
8
|
-
import { AgentAction, AgentFinish } from "@langchain/core/agents";
|
|
9
|
-
import { Tool } from "@langchain/core/tools";
|
|
10
|
-
|
|
11
|
-
//#region src/prebuilt/agent_executor.d.ts
|
|
12
|
-
interface Step {
|
|
13
|
-
action: AgentAction | AgentFinish;
|
|
14
|
-
observation: unknown;
|
|
15
|
-
}
|
|
16
|
-
/** @ignore */
|
|
17
|
-
interface AgentExecutorState {
|
|
18
|
-
agentOutcome?: AgentAction | AgentFinish;
|
|
19
|
-
steps: Array<Step>;
|
|
20
|
-
input: string;
|
|
21
|
-
chatHistory?: BaseMessage[];
|
|
22
|
-
}
|
|
23
|
-
/** @ignore */
|
|
24
|
-
declare function createAgentExecutor({
|
|
25
|
-
agentRunnable,
|
|
26
|
-
tools
|
|
27
|
-
}: {
|
|
28
|
-
agentRunnable: Runnable;
|
|
29
|
-
tools: Array<Tool> | ToolExecutor;
|
|
30
|
-
}): CompiledStateGraph<{
|
|
31
|
-
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
32
|
-
steps: Step[];
|
|
33
|
-
input: string;
|
|
34
|
-
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
35
|
-
}, {
|
|
36
|
-
agentOutcome?: AgentAction | AgentFinish | undefined;
|
|
37
|
-
steps?: Step[] | undefined;
|
|
38
|
-
input?: string | undefined;
|
|
39
|
-
chatHistory?: BaseMessage<_langchain_core_messages1.MessageStructure, _langchain_core_messages1.MessageType>[] | undefined;
|
|
40
|
-
}, "__start__" | "action" | "agent", {
|
|
41
|
-
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
42
|
-
steps: BaseChannel<Step[], Step[], unknown>;
|
|
43
|
-
input: BaseChannel<string, string, unknown>;
|
|
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
|
-
}, {
|
|
46
|
-
agentOutcome?: BaseChannel<AgentAction | AgentFinish | undefined, AgentAction | AgentFinish | undefined, unknown> | undefined;
|
|
47
|
-
steps: BaseChannel<Step[], Step[], unknown>;
|
|
48
|
-
input: BaseChannel<string, string, unknown>;
|
|
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
|
-
}, StateDefinition, {
|
|
51
|
-
action: Partial<AgentExecutorState>;
|
|
52
|
-
agent: {
|
|
53
|
-
agentOutcome: any;
|
|
54
|
-
};
|
|
55
|
-
}, unknown, unknown>;
|
|
56
|
-
//#endregion
|
|
57
|
-
export { AgentExecutorState, createAgentExecutor };
|
|
58
|
-
//# sourceMappingURL=agent_executor.d.ts.map
|