langchain 1.0.0-alpha.8 → 1.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +6 -6
- package/dist/agents/ReactAgent.cjs +497 -104
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.d.cts +140 -17
- package/dist/agents/ReactAgent.d.cts.map +1 -1
- package/dist/agents/ReactAgent.d.ts +140 -17
- package/dist/agents/ReactAgent.d.ts.map +1 -1
- package/dist/agents/ReactAgent.js +500 -107
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/annotation.cjs +32 -149
- package/dist/agents/annotation.cjs.map +1 -1
- package/dist/agents/annotation.js +34 -147
- package/dist/agents/annotation.js.map +1 -1
- package/dist/agents/constants.cjs.map +1 -1
- package/dist/agents/constants.d.cts +9 -0
- package/dist/agents/constants.d.cts.map +1 -0
- package/dist/agents/constants.d.ts +9 -0
- package/dist/agents/constants.d.ts.map +1 -0
- package/dist/agents/constants.js.map +1 -1
- package/dist/agents/errors.cjs +2 -1
- package/dist/agents/errors.cjs.map +1 -1
- package/dist/agents/errors.js +2 -1
- package/dist/agents/errors.js.map +1 -1
- package/dist/agents/index.cjs +5 -29
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +157 -128
- package/dist/agents/index.d.cts.map +1 -1
- package/dist/agents/index.d.ts +157 -128
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +5 -27
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.cjs +2 -2
- package/dist/agents/middleware/callLimit.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.cts +3 -3
- package/dist/agents/middleware/callLimit.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.d.ts +3 -3
- package/dist/agents/middleware/callLimit.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/callLimit.js +1 -1
- package/dist/agents/middleware/callLimit.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.cjs +5 -5
- package/dist/agents/middleware/contextEditing.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.cts +2 -2
- package/dist/agents/middleware/contextEditing.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.d.ts +2 -2
- package/dist/agents/middleware/contextEditing.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/contextEditing.js +4 -4
- package/dist/agents/middleware/contextEditing.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.cjs +6 -6
- package/dist/agents/middleware/dynamicSystemPrompt.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.cts +3 -2
- package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.d.ts +3 -2
- package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/dynamicSystemPrompt.js +6 -6
- package/dist/agents/middleware/dynamicSystemPrompt.js.map +1 -0
- package/dist/agents/middleware/hitl.cjs +404 -0
- package/dist/agents/middleware/hitl.cjs.map +1 -0
- package/dist/agents/middleware/hitl.d.cts +611 -0
- package/dist/agents/middleware/hitl.d.cts.map +1 -0
- package/dist/agents/middleware/hitl.d.ts +611 -0
- package/dist/agents/middleware/hitl.d.ts.map +1 -0
- package/dist/agents/middleware/hitl.js +403 -0
- package/dist/agents/middleware/hitl.js.map +1 -0
- package/dist/agents/middleware/index.cjs +12 -0
- package/dist/agents/middleware/index.js +12 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.cjs +7 -7
- package/dist/agents/middleware/llmToolSelector.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.cts +2 -2
- package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.d.ts +2 -2
- package/dist/agents/middleware/llmToolSelector.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/llmToolSelector.js +6 -6
- package/dist/agents/middleware/llmToolSelector.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.cjs +28 -21
- package/dist/agents/middleware/modelFallback.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.cts +2 -2
- package/dist/agents/middleware/modelFallback.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.d.ts +2 -2
- package/dist/agents/middleware/modelFallback.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/modelFallback.js +28 -21
- package/dist/agents/middleware/modelFallback.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.cjs +12 -12
- package/dist/agents/middleware/piiRedaction.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.cts +4 -4
- package/dist/agents/middleware/piiRedaction.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.d.ts +4 -4
- package/dist/agents/middleware/piiRedaction.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/piiRedaction.js +10 -10
- package/dist/agents/middleware/piiRedaction.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.cjs +27 -24
- package/dist/agents/middleware/promptCaching.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.cts +3 -3
- package/dist/agents/middleware/promptCaching.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.d.ts +3 -3
- package/dist/agents/middleware/promptCaching.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/promptCaching.js +26 -23
- package/dist/agents/middleware/promptCaching.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.cjs +7 -12
- package/dist/agents/middleware/summarization.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.cts +3 -3
- package/dist/agents/middleware/summarization.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.d.ts +3 -3
- package/dist/agents/middleware/summarization.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/summarization.js +4 -9
- package/dist/agents/middleware/summarization.js.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.cjs +314 -0
- package/dist/agents/middleware/todoListMiddleware.cjs.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.d.cts +75 -0
- package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.d.ts +75 -0
- package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -0
- package/dist/agents/middleware/todoListMiddleware.js +312 -0
- package/dist/agents/middleware/todoListMiddleware.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.cjs +2 -2
- package/dist/agents/middleware/toolCallLimit.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.cts +3 -3
- package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.d.ts +3 -3
- package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/toolCallLimit.js +1 -1
- package/dist/agents/middleware/toolCallLimit.js.map +1 -0
- package/dist/agents/middleware/types.d.cts +208 -0
- package/dist/agents/middleware/types.d.cts.map +1 -0
- package/dist/agents/middleware/types.d.ts +208 -0
- package/dist/agents/middleware/types.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/utils.cjs +1 -1
- package/dist/agents/middleware/utils.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.cts +1 -1
- package/dist/agents/middleware/utils.d.cts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/utils.d.ts +1 -1
- package/dist/agents/middleware/utils.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware → middleware}/utils.js +1 -1
- package/dist/agents/middleware/utils.js.map +1 -0
- package/dist/agents/{middlewareAgent/middleware.cjs → middleware.cjs} +11 -4
- package/dist/agents/middleware.cjs.map +1 -0
- package/dist/agents/middleware.d.cts +205 -0
- package/dist/agents/middleware.d.cts.map +1 -0
- package/dist/agents/middleware.d.ts +205 -0
- package/dist/agents/middleware.d.ts.map +1 -0
- package/dist/agents/{middlewareAgent/middleware.js → middleware.js} +11 -4
- package/dist/agents/middleware.js.map +1 -0
- package/dist/agents/nodes/AfterAgentNode.cjs +27 -0
- package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -0
- package/dist/agents/nodes/AfterAgentNode.js +27 -0
- package/dist/agents/nodes/AfterAgentNode.js.map +1 -0
- package/dist/agents/{middlewareAgent/nodes/AfterModalNode.cjs → nodes/AfterModelNode.cjs} +3 -5
- package/dist/agents/nodes/AfterModelNode.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/nodes/AfterModalNode.js → nodes/AfterModelNode.js} +3 -5
- package/dist/agents/nodes/AfterModelNode.js.map +1 -0
- package/dist/agents/nodes/AgentNode.cjs +202 -71
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +204 -73
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/nodes/BeforeAgentNode.cjs +27 -0
- package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -0
- package/dist/agents/nodes/BeforeAgentNode.js +27 -0
- package/dist/agents/nodes/BeforeAgentNode.js.map +1 -0
- package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.cjs → nodes/BeforeModelNode.cjs} +3 -3
- package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/nodes/BeforeModalNode.js → nodes/BeforeModelNode.js} +3 -3
- package/dist/agents/nodes/BeforeModelNode.js.map +1 -0
- package/dist/agents/nodes/ToolNode.cjs +157 -47
- package/dist/agents/nodes/ToolNode.cjs.map +1 -1
- package/dist/agents/nodes/ToolNode.js +158 -48
- package/dist/agents/nodes/ToolNode.js.map +1 -1
- package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.cjs +35 -10
- package/dist/agents/nodes/middleware.cjs.map +1 -0
- package/dist/agents/{middlewareAgent/nodes → nodes}/middleware.js +34 -9
- package/dist/agents/nodes/middleware.js.map +1 -0
- package/dist/agents/nodes/types.d.cts +57 -0
- package/dist/agents/nodes/types.d.cts.map +1 -0
- package/dist/agents/nodes/types.d.ts +57 -0
- package/dist/agents/nodes/types.d.ts.map +1 -0
- package/dist/agents/nodes/utils.cjs +64 -0
- package/dist/agents/nodes/utils.cjs.map +1 -1
- package/dist/agents/nodes/utils.js +62 -1
- package/dist/agents/nodes/utils.js.map +1 -1
- package/dist/agents/responses.cjs +1 -1
- package/dist/agents/responses.cjs.map +1 -1
- package/dist/agents/responses.d.cts +9 -2
- package/dist/agents/responses.d.cts.map +1 -1
- package/dist/agents/responses.d.ts +8 -1
- package/dist/agents/responses.d.ts.map +1 -1
- package/dist/agents/responses.js +1 -1
- package/dist/agents/responses.js.map +1 -1
- package/dist/agents/runtime.d.cts +123 -0
- package/dist/agents/runtime.d.cts.map +1 -0
- package/dist/agents/runtime.d.ts +123 -0
- package/dist/agents/runtime.d.ts.map +1 -0
- package/dist/agents/tests/utils.cjs +13 -5
- package/dist/agents/tests/utils.cjs.map +1 -1
- package/dist/agents/tests/utils.d.cts +17 -8
- package/dist/agents/tests/utils.d.cts.map +1 -1
- package/dist/agents/tests/utils.d.ts +14 -5
- package/dist/agents/tests/utils.d.ts.map +1 -1
- package/dist/agents/tests/utils.js +13 -5
- package/dist/agents/tests/utils.js.map +1 -1
- package/dist/agents/tools.d.cts +9 -0
- package/dist/agents/tools.d.cts.map +1 -0
- package/dist/agents/tools.d.ts +9 -0
- package/dist/agents/tools.d.ts.map +1 -0
- package/dist/agents/types.d.cts +125 -126
- package/dist/agents/types.d.cts.map +1 -1
- package/dist/agents/types.d.ts +125 -126
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/utils.cjs +141 -38
- package/dist/agents/utils.cjs.map +1 -1
- package/dist/agents/utils.js +142 -40
- package/dist/agents/utils.js.map +1 -1
- package/dist/chat_models/universal.cjs +4 -0
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.d.cts +6 -2
- package/dist/chat_models/universal.d.cts.map +1 -1
- package/dist/chat_models/universal.d.ts +4 -0
- package/dist/chat_models/universal.d.ts.map +1 -1
- package/dist/chat_models/universal.js +4 -0
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/hub/base.cjs +4 -3
- package/dist/hub/base.cjs.map +1 -1
- package/dist/hub/base.d.cts +0 -4
- package/dist/hub/base.d.cts.map +1 -1
- package/dist/hub/base.d.ts +0 -4
- package/dist/hub/base.d.ts.map +1 -1
- package/dist/hub/base.js +4 -3
- package/dist/hub/base.js.map +1 -1
- package/dist/index.cjs +18 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -21
- package/dist/index.d.ts +21 -21
- package/dist/index.js +17 -26
- package/dist/index.js.map +1 -1
- package/dist/load/import_map.cjs +0 -2
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +0 -2
- package/dist/load/import_map.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.cjs +74 -18
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/client.js +75 -19
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/env.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/constants.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/experimental/otel/translator.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs +2 -2
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js +2 -2
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.cjs +7 -5
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/run_trees.js +7 -5
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/constants.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/fetch.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/singletons/otel.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/_uuid.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/async_caller.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.cjs +19 -23
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/env.js +19 -23
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.cjs +16 -3
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/error.js +16 -3
- package/dist/node_modules/.pnpm/langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +1 -0
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/fast-safe-stringify/index.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/messages.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/project.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/prompts.js.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.cjs.map +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js +1 -1
- package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/dist/utils/warn.js.map +1 -1
- package/package.json +4 -18
- package/dist/agents/RunnableCallable.d.cts +0 -41
- package/dist/agents/RunnableCallable.d.cts.map +0 -1
- package/dist/agents/RunnableCallable.d.ts +0 -41
- package/dist/agents/RunnableCallable.d.ts.map +0 -1
- package/dist/agents/annotation.d.cts +0 -52
- package/dist/agents/annotation.d.cts.map +0 -1
- package/dist/agents/annotation.d.ts +0 -52
- package/dist/agents/annotation.d.ts.map +0 -1
- package/dist/agents/createAgent.cjs +0 -10
- package/dist/agents/createAgent.cjs.map +0 -1
- package/dist/agents/createAgent.js +0 -10
- package/dist/agents/createAgent.js.map +0 -1
- package/dist/agents/interrupt.cjs +0 -2
- package/dist/agents/interrupt.d.cts +0 -81
- package/dist/agents/interrupt.d.cts.map +0 -1
- package/dist/agents/interrupt.d.ts +0 -81
- package/dist/agents/interrupt.d.ts.map +0 -1
- package/dist/agents/interrupt.js +0 -3
- package/dist/agents/middlewareAgent/ReactAgent.cjs +0 -579
- package/dist/agents/middlewareAgent/ReactAgent.cjs.map +0 -1
- package/dist/agents/middlewareAgent/ReactAgent.d.cts +0 -234
- package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/ReactAgent.d.ts +0 -234
- package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/ReactAgent.js +0 -578
- package/dist/agents/middlewareAgent/ReactAgent.js.map +0 -1
- package/dist/agents/middlewareAgent/annotation.cjs +0 -45
- package/dist/agents/middlewareAgent/annotation.cjs.map +0 -1
- package/dist/agents/middlewareAgent/annotation.js +0 -44
- package/dist/agents/middlewareAgent/annotation.js.map +0 -1
- package/dist/agents/middlewareAgent/constants.d.cts +0 -5
- package/dist/agents/middlewareAgent/constants.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/constants.d.ts +0 -5
- package/dist/agents/middlewareAgent/constants.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/index.cjs +0 -11
- package/dist/agents/middlewareAgent/index.cjs.map +0 -1
- package/dist/agents/middlewareAgent/index.js +0 -11
- package/dist/agents/middlewareAgent/index.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/callLimit.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/hitl.cjs +0 -341
- package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/hitl.d.cts +0 -524
- package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/hitl.d.ts +0 -524
- package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/hitl.js +0 -340
- package/dist/agents/middlewareAgent/middleware/hitl.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/index.cjs +0 -52
- package/dist/agents/middlewareAgent/middleware/index.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/index.d.cts +0 -13
- package/dist/agents/middlewareAgent/middleware/index.d.ts +0 -13
- package/dist/agents/middlewareAgent/middleware/index.js +0 -34
- package/dist/agents/middlewareAgent/middleware/index.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/summarization.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware/utils.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware/utils.js.map +0 -1
- package/dist/agents/middlewareAgent/middleware.cjs.map +0 -1
- package/dist/agents/middlewareAgent/middleware.d.cts +0 -117
- package/dist/agents/middlewareAgent/middleware.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/middleware.d.ts +0 -117
- package/dist/agents/middlewareAgent/middleware.d.ts.map +0 -1
- package/dist/agents/middlewareAgent/middleware.js.map +0 -1
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +0 -1
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +0 -1
- package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +0 -468
- package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +0 -1
- package/dist/agents/middlewareAgent/nodes/AgentNode.js +0 -467
- package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +0 -1
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +0 -1
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +0 -1
- package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +0 -1
- package/dist/agents/middlewareAgent/nodes/middleware.js.map +0 -1
- package/dist/agents/middlewareAgent/nodes/utils.cjs +0 -66
- package/dist/agents/middlewareAgent/nodes/utils.cjs.map +0 -1
- package/dist/agents/middlewareAgent/nodes/utils.js +0 -63
- package/dist/agents/middlewareAgent/nodes/utils.js.map +0 -1
- package/dist/agents/middlewareAgent/types.d.cts +0 -472
- package/dist/agents/middlewareAgent/types.d.cts.map +0 -1
- package/dist/agents/middlewareAgent/types.d.ts +0 -472
- package/dist/agents/middlewareAgent/types.d.ts.map +0 -1
- package/dist/agents/nodes/ToolNode.d.cts +0 -97
- package/dist/agents/nodes/ToolNode.d.cts.map +0 -1
- package/dist/agents/nodes/ToolNode.d.ts +0 -97
- package/dist/agents/nodes/ToolNode.d.ts.map +0 -1
- package/dist/agents/types.cjs +0 -7
- package/dist/agents/types.cjs.map +0 -1
- package/dist/agents/types.js +0 -6
- package/dist/agents/types.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.cjs.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/client.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.cjs.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/run_trees.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.cjs.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/env.js.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.cjs.map +0 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/error.js.map +0 -1
- /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.cjs +0 -0
- /package/dist/node_modules/.pnpm/{langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_ → langsmith@0.3.74_@opentelemetry_api@1.9.0_openai@5.12.2_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_}/node_modules/langsmith/index.js +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
|
|
3
|
+
import { PregelOptions, Runtime } from "@langchain/langgraph";
|
|
4
|
+
|
|
5
|
+
//#region src/agents/runtime.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Type for the agent's built-in state properties.
|
|
9
|
+
*/
|
|
10
|
+
type AgentBuiltInState = {
|
|
11
|
+
/**
|
|
12
|
+
* Array of messages representing the conversation history.
|
|
13
|
+
*
|
|
14
|
+
* This includes all messages exchanged during the agent's execution:
|
|
15
|
+
* - Human messages: Input from the user
|
|
16
|
+
* - AI messages: Responses from the language model
|
|
17
|
+
* - Tool messages: Results from tool executions
|
|
18
|
+
* - System messages: System-level instructions or information
|
|
19
|
+
*
|
|
20
|
+
* Messages are accumulated throughout the agent's lifecycle and can be
|
|
21
|
+
* accessed or modified by middleware hooks during execution.
|
|
22
|
+
*/
|
|
23
|
+
messages: BaseMessage[];
|
|
24
|
+
/**
|
|
25
|
+
* Structured response data returned by the agent when a `responseFormat` is configured.
|
|
26
|
+
*
|
|
27
|
+
* This property is only populated when you provide a `responseFormat` schema
|
|
28
|
+
* (as Zod or JSON schema) to the agent configuration. The agent will format
|
|
29
|
+
* its final output to match the specified schema and store it in this property.
|
|
30
|
+
*
|
|
31
|
+
* Note: The type is specified as `Record<string, unknown>` because TypeScript cannot
|
|
32
|
+
* infer the actual response format type in contexts like middleware, where the agent's
|
|
33
|
+
* generic type parameters are not accessible. You may need to cast this to your specific
|
|
34
|
+
* response type when accessing it.
|
|
35
|
+
*/
|
|
36
|
+
structuredResponse?: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Type helper to check if TContext is an optional Zod schema
|
|
40
|
+
*/
|
|
41
|
+
type IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;
|
|
42
|
+
type IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;
|
|
43
|
+
type WithMaybeContext<TContext> = undefined extends TContext ? {
|
|
44
|
+
readonly context?: TContext;
|
|
45
|
+
} : IsOptionalZodObject<TContext> extends true ? {
|
|
46
|
+
readonly context?: TContext;
|
|
47
|
+
} : IsDefaultZodObject<TContext> extends true ? {
|
|
48
|
+
readonly context?: TContext;
|
|
49
|
+
} : {
|
|
50
|
+
readonly context: TContext;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Runtime information available to middleware (readonly).
|
|
54
|
+
*/
|
|
55
|
+
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> & PrivateState & {
|
|
56
|
+
configurable?: {
|
|
57
|
+
thread_id?: string;
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
interface RunLevelPrivateState {
|
|
62
|
+
/**
|
|
63
|
+
* The number of times the model has been called at the run level.
|
|
64
|
+
* This includes multiple agent invocations.
|
|
65
|
+
*/
|
|
66
|
+
runModelCallCount: number;
|
|
67
|
+
}
|
|
68
|
+
interface ThreadLevelPrivateState {
|
|
69
|
+
/**
|
|
70
|
+
* The number of times the model has been called at the thread level.
|
|
71
|
+
* This includes multiple agent invocations within different environments
|
|
72
|
+
* using the same thread.
|
|
73
|
+
*/
|
|
74
|
+
threadLevelCallCount: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* As private state we consider all information we want to track within
|
|
78
|
+
* the lifecycle of the agent, without exposing it to the user. These informations
|
|
79
|
+
* are propagated to the user as _readonly_ runtime properties.
|
|
80
|
+
*/
|
|
81
|
+
interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {}
|
|
82
|
+
/**
|
|
83
|
+
* Helper type to check if a type is optional (includes undefined)
|
|
84
|
+
*/
|
|
85
|
+
type IsOptionalType<T> = undefined extends T ? true : false;
|
|
86
|
+
/**
|
|
87
|
+
* Extract non-undefined part of a union that includes undefined
|
|
88
|
+
*/
|
|
89
|
+
type ExtractNonUndefined<T> = T extends undefined ? never : T;
|
|
90
|
+
/**
|
|
91
|
+
* Helper type to check if all properties of a type are optional
|
|
92
|
+
*/
|
|
93
|
+
type IsAllOptional<T> =
|
|
94
|
+
// If T includes undefined, then it's optional (can be omitted entirely)
|
|
95
|
+
undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
|
|
96
|
+
/**
|
|
97
|
+
* Pregel options that are propagated to the agent
|
|
98
|
+
*/
|
|
99
|
+
type CreateAgentPregelOptions = "configurable" | "durability" | "store" | "cache" | "signal" | "recursionLimit" | "maxConcurrency" | "timeout";
|
|
100
|
+
/**
|
|
101
|
+
* Decide whether provided configuration requires a context
|
|
102
|
+
*/
|
|
103
|
+
type InvokeConfiguration<ContextSchema extends Record<string, any>> =
|
|
104
|
+
/**
|
|
105
|
+
* If the context schema is a default object, `context` can be optional
|
|
106
|
+
*/
|
|
107
|
+
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
108
|
+
context?: Partial<ContextSchema>;
|
|
109
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
110
|
+
context?: Partial<ContextSchema>;
|
|
111
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
112
|
+
type StreamConfiguration<ContextSchema extends Record<string, any>> =
|
|
113
|
+
/**
|
|
114
|
+
* If the context schema is a default object, `context` can be optional
|
|
115
|
+
*/
|
|
116
|
+
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
117
|
+
context?: Partial<ContextSchema>;
|
|
118
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | "streamMode">> & {
|
|
119
|
+
context?: Partial<ContextSchema>;
|
|
120
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | "streamMode">> & WithMaybeContext<ContextSchema>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
|
|
123
|
+
//# sourceMappingURL=runtime.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.cts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","PrivateState","RunLevelPrivateState","ThreadLevelPrivateState","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","InvokeConfiguration","ContextSchema","Pick","StreamConfiguration"],"sources":["../../src/agents/runtime.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodOptional } from \"@langchain/core/utils/types\";\nimport type { InteropZodDefault } from \"@langchain/core/utils/types\";\nimport type { Runtime as LangGraphRuntime, PregelOptions } from \"@langchain/langgraph\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\n/**\n * Type for the agent's built-in state properties.\n */\nexport type AgentBuiltInState = {\n /**\n * Array of messages representing the conversation history.\n *\n * This includes all messages exchanged during the agent's execution:\n * - Human messages: Input from the user\n * - AI messages: Responses from the language model\n * - Tool messages: Results from tool executions\n * - System messages: System-level instructions or information\n *\n * Messages are accumulated throughout the agent's lifecycle and can be\n * accessed or modified by middleware hooks during execution.\n */\n messages: BaseMessage[];\n /**\n * Structured response data returned by the agent when a `responseFormat` is configured.\n *\n * This property is only populated when you provide a `responseFormat` schema\n * (as Zod or JSON schema) to the agent configuration. The agent will format\n * its final output to match the specified schema and store it in this property.\n *\n * Note: The type is specified as `Record<string, unknown>` because TypeScript cannot\n * infer the actual response format type in contexts like middleware, where the agent's\n * generic type parameters are not accessible. You may need to cast this to your specific\n * response type when accessing it.\n */\n structuredResponse?: Record<string, unknown>;\n};\n/**\n * Type helper to check if TContext is an optional Zod schema\n */\ntype IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;\ntype IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;\nexport type WithMaybeContext<TContext> = undefined extends TContext ? {\n readonly context?: TContext;\n} : IsOptionalZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : IsDefaultZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : {\n readonly context: TContext;\n};\n/**\n * Runtime information available to middleware (readonly).\n */\nexport type Runtime<TContext = unknown> = Partial<Omit<LangGraphRuntime<TContext>, \"context\" | \"configurable\">> & WithMaybeContext<TContext> & PrivateState & {\n configurable?: {\n thread_id?: string;\n [key: string]: unknown;\n };\n};\nexport interface RunLevelPrivateState {\n /**\n * The number of times the model has been called at the run level.\n * This includes multiple agent invocations.\n */\n runModelCallCount: number;\n}\nexport interface ThreadLevelPrivateState {\n /**\n * The number of times the model has been called at the thread level.\n * This includes multiple agent invocations within different environments\n * using the same thread.\n */\n threadLevelCallCount: number;\n}\n/**\n * As private state we consider all information we want to track within\n * the lifecycle of the agent, without exposing it to the user. These informations\n * are propagated to the user as _readonly_ runtime properties.\n */\nexport interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {\n}\nexport type InternalAgentState<StructuredResponseType extends Record<string, unknown> | undefined = Record<string, unknown>> = {\n messages: BaseMessage[];\n _privateState?: PrivateState;\n} & (StructuredResponseType extends ResponseFormatUndefined ? Record<string, never> : {\n structuredResponse: StructuredResponseType;\n});\n/**\n * Helper type to check if a type is optional (includes undefined)\n */\ntype IsOptionalType<T> = undefined extends T ? true : false;\n/**\n * Extract non-undefined part of a union that includes undefined\n */\ntype ExtractNonUndefined<T> = T extends undefined ? never : T;\n/**\n * Helper type to check if all properties of a type are optional\n */\nexport type IsAllOptional<T> = \n// If T includes undefined, then it's optional (can be omitted entirely)\nundefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;\n/**\n * Pregel options that are propagated to the agent\n */\ntype CreateAgentPregelOptions = \"configurable\" | \"durability\" | \"store\" | \"cache\" | \"signal\" | \"recursionLimit\" | \"maxConcurrency\" | \"timeout\";\n/**\n * Decide whether provided configuration requires a context\n */\nexport type InvokeConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;\nexport type StreamConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":"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"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
import { PregelOptions, Runtime } from "@langchain/langgraph";
|
|
3
|
+
import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
|
|
4
|
+
|
|
5
|
+
//#region src/agents/runtime.d.ts
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Type for the agent's built-in state properties.
|
|
9
|
+
*/
|
|
10
|
+
type AgentBuiltInState = {
|
|
11
|
+
/**
|
|
12
|
+
* Array of messages representing the conversation history.
|
|
13
|
+
*
|
|
14
|
+
* This includes all messages exchanged during the agent's execution:
|
|
15
|
+
* - Human messages: Input from the user
|
|
16
|
+
* - AI messages: Responses from the language model
|
|
17
|
+
* - Tool messages: Results from tool executions
|
|
18
|
+
* - System messages: System-level instructions or information
|
|
19
|
+
*
|
|
20
|
+
* Messages are accumulated throughout the agent's lifecycle and can be
|
|
21
|
+
* accessed or modified by middleware hooks during execution.
|
|
22
|
+
*/
|
|
23
|
+
messages: BaseMessage[];
|
|
24
|
+
/**
|
|
25
|
+
* Structured response data returned by the agent when a `responseFormat` is configured.
|
|
26
|
+
*
|
|
27
|
+
* This property is only populated when you provide a `responseFormat` schema
|
|
28
|
+
* (as Zod or JSON schema) to the agent configuration. The agent will format
|
|
29
|
+
* its final output to match the specified schema and store it in this property.
|
|
30
|
+
*
|
|
31
|
+
* Note: The type is specified as `Record<string, unknown>` because TypeScript cannot
|
|
32
|
+
* infer the actual response format type in contexts like middleware, where the agent's
|
|
33
|
+
* generic type parameters are not accessible. You may need to cast this to your specific
|
|
34
|
+
* response type when accessing it.
|
|
35
|
+
*/
|
|
36
|
+
structuredResponse?: Record<string, unknown>;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Type helper to check if TContext is an optional Zod schema
|
|
40
|
+
*/
|
|
41
|
+
type IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;
|
|
42
|
+
type IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;
|
|
43
|
+
type WithMaybeContext<TContext> = undefined extends TContext ? {
|
|
44
|
+
readonly context?: TContext;
|
|
45
|
+
} : IsOptionalZodObject<TContext> extends true ? {
|
|
46
|
+
readonly context?: TContext;
|
|
47
|
+
} : IsDefaultZodObject<TContext> extends true ? {
|
|
48
|
+
readonly context?: TContext;
|
|
49
|
+
} : {
|
|
50
|
+
readonly context: TContext;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Runtime information available to middleware (readonly).
|
|
54
|
+
*/
|
|
55
|
+
type Runtime$1<TContext = unknown> = Partial<Omit<Runtime<TContext>, "context" | "configurable">> & WithMaybeContext<TContext> & PrivateState & {
|
|
56
|
+
configurable?: {
|
|
57
|
+
thread_id?: string;
|
|
58
|
+
[key: string]: unknown;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
interface RunLevelPrivateState {
|
|
62
|
+
/**
|
|
63
|
+
* The number of times the model has been called at the run level.
|
|
64
|
+
* This includes multiple agent invocations.
|
|
65
|
+
*/
|
|
66
|
+
runModelCallCount: number;
|
|
67
|
+
}
|
|
68
|
+
interface ThreadLevelPrivateState {
|
|
69
|
+
/**
|
|
70
|
+
* The number of times the model has been called at the thread level.
|
|
71
|
+
* This includes multiple agent invocations within different environments
|
|
72
|
+
* using the same thread.
|
|
73
|
+
*/
|
|
74
|
+
threadLevelCallCount: number;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* As private state we consider all information we want to track within
|
|
78
|
+
* the lifecycle of the agent, without exposing it to the user. These informations
|
|
79
|
+
* are propagated to the user as _readonly_ runtime properties.
|
|
80
|
+
*/
|
|
81
|
+
interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {}
|
|
82
|
+
/**
|
|
83
|
+
* Helper type to check if a type is optional (includes undefined)
|
|
84
|
+
*/
|
|
85
|
+
type IsOptionalType<T> = undefined extends T ? true : false;
|
|
86
|
+
/**
|
|
87
|
+
* Extract non-undefined part of a union that includes undefined
|
|
88
|
+
*/
|
|
89
|
+
type ExtractNonUndefined<T> = T extends undefined ? never : T;
|
|
90
|
+
/**
|
|
91
|
+
* Helper type to check if all properties of a type are optional
|
|
92
|
+
*/
|
|
93
|
+
type IsAllOptional<T> =
|
|
94
|
+
// If T includes undefined, then it's optional (can be omitted entirely)
|
|
95
|
+
undefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;
|
|
96
|
+
/**
|
|
97
|
+
* Pregel options that are propagated to the agent
|
|
98
|
+
*/
|
|
99
|
+
type CreateAgentPregelOptions = "configurable" | "durability" | "store" | "cache" | "signal" | "recursionLimit" | "maxConcurrency" | "timeout";
|
|
100
|
+
/**
|
|
101
|
+
* Decide whether provided configuration requires a context
|
|
102
|
+
*/
|
|
103
|
+
type InvokeConfiguration<ContextSchema extends Record<string, any>> =
|
|
104
|
+
/**
|
|
105
|
+
* If the context schema is a default object, `context` can be optional
|
|
106
|
+
*/
|
|
107
|
+
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
108
|
+
context?: Partial<ContextSchema>;
|
|
109
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
110
|
+
context?: Partial<ContextSchema>;
|
|
111
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
|
|
112
|
+
type StreamConfiguration<ContextSchema extends Record<string, any>> =
|
|
113
|
+
/**
|
|
114
|
+
* If the context schema is a default object, `context` can be optional
|
|
115
|
+
*/
|
|
116
|
+
ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
|
|
117
|
+
context?: Partial<ContextSchema>;
|
|
118
|
+
} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | "streamMode">> & {
|
|
119
|
+
context?: Partial<ContextSchema>;
|
|
120
|
+
} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | "streamMode">> & WithMaybeContext<ContextSchema>;
|
|
121
|
+
//#endregion
|
|
122
|
+
export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
|
|
123
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","PrivateState","RunLevelPrivateState","ThreadLevelPrivateState","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","InvokeConfiguration","ContextSchema","Pick","StreamConfiguration"],"sources":["../../src/agents/runtime.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodOptional } from \"@langchain/core/utils/types\";\nimport type { InteropZodDefault } from \"@langchain/core/utils/types\";\nimport type { Runtime as LangGraphRuntime, PregelOptions } from \"@langchain/langgraph\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\n/**\n * Type for the agent's built-in state properties.\n */\nexport type AgentBuiltInState = {\n /**\n * Array of messages representing the conversation history.\n *\n * This includes all messages exchanged during the agent's execution:\n * - Human messages: Input from the user\n * - AI messages: Responses from the language model\n * - Tool messages: Results from tool executions\n * - System messages: System-level instructions or information\n *\n * Messages are accumulated throughout the agent's lifecycle and can be\n * accessed or modified by middleware hooks during execution.\n */\n messages: BaseMessage[];\n /**\n * Structured response data returned by the agent when a `responseFormat` is configured.\n *\n * This property is only populated when you provide a `responseFormat` schema\n * (as Zod or JSON schema) to the agent configuration. The agent will format\n * its final output to match the specified schema and store it in this property.\n *\n * Note: The type is specified as `Record<string, unknown>` because TypeScript cannot\n * infer the actual response format type in contexts like middleware, where the agent's\n * generic type parameters are not accessible. You may need to cast this to your specific\n * response type when accessing it.\n */\n structuredResponse?: Record<string, unknown>;\n};\n/**\n * Type helper to check if TContext is an optional Zod schema\n */\ntype IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;\ntype IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;\nexport type WithMaybeContext<TContext> = undefined extends TContext ? {\n readonly context?: TContext;\n} : IsOptionalZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : IsDefaultZodObject<TContext> extends true ? {\n readonly context?: TContext;\n} : {\n readonly context: TContext;\n};\n/**\n * Runtime information available to middleware (readonly).\n */\nexport type Runtime<TContext = unknown> = Partial<Omit<LangGraphRuntime<TContext>, \"context\" | \"configurable\">> & WithMaybeContext<TContext> & PrivateState & {\n configurable?: {\n thread_id?: string;\n [key: string]: unknown;\n };\n};\nexport interface RunLevelPrivateState {\n /**\n * The number of times the model has been called at the run level.\n * This includes multiple agent invocations.\n */\n runModelCallCount: number;\n}\nexport interface ThreadLevelPrivateState {\n /**\n * The number of times the model has been called at the thread level.\n * This includes multiple agent invocations within different environments\n * using the same thread.\n */\n threadLevelCallCount: number;\n}\n/**\n * As private state we consider all information we want to track within\n * the lifecycle of the agent, without exposing it to the user. These informations\n * are propagated to the user as _readonly_ runtime properties.\n */\nexport interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {\n}\nexport type InternalAgentState<StructuredResponseType extends Record<string, unknown> | undefined = Record<string, unknown>> = {\n messages: BaseMessage[];\n _privateState?: PrivateState;\n} & (StructuredResponseType extends ResponseFormatUndefined ? Record<string, never> : {\n structuredResponse: StructuredResponseType;\n});\n/**\n * Helper type to check if a type is optional (includes undefined)\n */\ntype IsOptionalType<T> = undefined extends T ? true : false;\n/**\n * Extract non-undefined part of a union that includes undefined\n */\ntype ExtractNonUndefined<T> = T extends undefined ? never : T;\n/**\n * Helper type to check if all properties of a type are optional\n */\nexport type IsAllOptional<T> = \n// If T includes undefined, then it's optional (can be omitted entirely)\nundefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;\n/**\n * Pregel options that are propagated to the agent\n */\ntype CreateAgentPregelOptions = \"configurable\" | \"durability\" | \"store\" | \"cache\" | \"signal\" | \"recursionLimit\" | \"maxConcurrency\" | \"timeout\";\n/**\n * Decide whether provided configuration requires a context\n */\nexport type InvokeConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;\nexport type StreamConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":"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"}
|
|
@@ -13,16 +13,22 @@ require("@langchain/langgraph-checkpoint");
|
|
|
13
13
|
var FakeToolCallingModel = class FakeToolCallingModel extends __langchain_core_language_models_chat_models.BaseChatModel {
|
|
14
14
|
toolCalls;
|
|
15
15
|
toolStyle;
|
|
16
|
-
|
|
16
|
+
indexRef;
|
|
17
17
|
structuredResponse;
|
|
18
18
|
tools = [];
|
|
19
|
-
constructor({ toolCalls = [], toolStyle = "openai", index = 0, structuredResponse,...rest } = {}) {
|
|
19
|
+
constructor({ toolCalls = [], toolStyle = "openai", index = 0, structuredResponse, indexRef,...rest } = {}) {
|
|
20
20
|
super(rest);
|
|
21
21
|
this.toolCalls = toolCalls;
|
|
22
22
|
this.toolStyle = toolStyle;
|
|
23
|
-
this.
|
|
23
|
+
this.indexRef = indexRef ?? { current: index };
|
|
24
24
|
this.structuredResponse = structuredResponse;
|
|
25
25
|
}
|
|
26
|
+
get index() {
|
|
27
|
+
return this.indexRef.current;
|
|
28
|
+
}
|
|
29
|
+
set index(value) {
|
|
30
|
+
this.indexRef.current = value;
|
|
31
|
+
}
|
|
26
32
|
_llmType() {
|
|
27
33
|
return "fake-tool-calling";
|
|
28
34
|
}
|
|
@@ -33,8 +39,8 @@ var FakeToolCallingModel = class FakeToolCallingModel extends __langchain_core_l
|
|
|
33
39
|
const newInstance = new FakeToolCallingModel({
|
|
34
40
|
toolCalls: this.toolCalls,
|
|
35
41
|
toolStyle: this.toolStyle,
|
|
36
|
-
|
|
37
|
-
|
|
42
|
+
structuredResponse: this.structuredResponse,
|
|
43
|
+
indexRef: this.indexRef
|
|
38
44
|
});
|
|
39
45
|
newInstance.tools = [...this.tools, ...tools];
|
|
40
46
|
return newInstance;
|
|
@@ -51,6 +57,8 @@ var FakeToolCallingModel = class FakeToolCallingModel extends __langchain_core_l
|
|
|
51
57
|
const parts = messages.map((m) => m.content).filter(Boolean);
|
|
52
58
|
content = parts.join("-");
|
|
53
59
|
}
|
|
60
|
+
const isStartOfConversation = messages.length === 1 || messages.length === 2 && messages.every(__langchain_core_messages.HumanMessage.isInstance);
|
|
61
|
+
if (isStartOfConversation && this.index !== 0) this.index = 0;
|
|
54
62
|
const currentToolCalls = this.toolCalls[this.index] || [];
|
|
55
63
|
const messageId = this.index.toString();
|
|
56
64
|
this.index = (this.index + 1) % Math.max(1, this.toolCalls.length);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["BaseChatModel","tools: StructuredTool[]","_schema: any","RunnableLambda","messages: BaseMessage[]","_options?: this[\"ParsedCallOptions\"]","_runManager?: CallbackManagerForLLMRun","AIMessage"],"sources":["../../../src/agents/tests/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable import/no-extraneous-dependencies */\nimport { expect } from \"vitest\";\nimport { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport {\n BaseChatModel,\n BaseChatModelParams,\n BaseChatModelCallOptions,\n BindToolsInput,\n ToolChoice,\n} from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport {\n BaseMessage,\n AIMessage,\n HumanMessage,\n BaseMessageFields,\n AIMessageFields,\n ToolMessage,\n ToolMessageFields,\n} from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport {\n Runnable,\n RunnableConfig,\n RunnableLambda,\n RunnableBinding,\n} from \"@langchain/core/runnables\";\nimport {\n MemorySaver,\n Checkpoint,\n CheckpointMetadata,\n type BaseCheckpointSaver,\n} from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\n\nexport class _AnyIdAIMessage extends AIMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"AIMessage\"];\n }\n\n constructor(fields: AIMessageFields | string) {\n let fieldsWithJestMatcher: Partial<AIMessageFields> = {\n id: expect.any(String) as unknown as string,\n };\n if (typeof fields === \"string\") {\n fieldsWithJestMatcher = {\n content: fields,\n ...fieldsWithJestMatcher,\n };\n } else {\n fieldsWithJestMatcher = {\n ...fields,\n ...fieldsWithJestMatcher,\n };\n }\n super(fieldsWithJestMatcher as AIMessageFields);\n }\n}\n\nexport class _AnyIdHumanMessage extends HumanMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"HumanMessage\"];\n }\n\n constructor(fields: BaseMessageFields | string) {\n let fieldsWithJestMatcher: Partial<BaseMessageFields> = {\n id: expect.any(String) as unknown as string,\n };\n if (typeof fields === \"string\") {\n fieldsWithJestMatcher = {\n content: fields,\n ...fieldsWithJestMatcher,\n };\n } else {\n fieldsWithJestMatcher = {\n ...fields,\n ...fieldsWithJestMatcher,\n };\n }\n super(fieldsWithJestMatcher as BaseMessageFields);\n }\n}\n\nexport class _AnyIdToolMessage extends ToolMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"ToolMessage\"];\n }\n\n constructor(fields: ToolMessageFields) {\n const fieldsWithJestMatcher: Partial<ToolMessageFields> = {\n id: expect.any(String) as unknown as string,\n ...fields,\n };\n super(fieldsWithJestMatcher as ToolMessageFields);\n }\n}\n\nexport class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any> = {};\n\n _chatModel: LanguageModelLike;\n\n constructor(\n fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams\n ) {\n super(fields);\n this._chatModel = fields.model;\n }\n\n _llmType() {\n return \"fake_configurable\";\n }\n\n async _generate(\n _messages: BaseMessage[],\n _options: this[\"ParsedCallOptions\"],\n _runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n throw new Error(\"Not implemented\");\n }\n\n async _model() {\n return this._chatModel;\n }\n\n bindTools(tools: BindToolsInput[]) {\n const modelWithTools = new FakeConfigurableModel({\n model: (this._chatModel as FakeToolCallingChatModel).bindTools(tools),\n });\n modelWithTools._queuedMethodOperations.bindTools = tools;\n return modelWithTools;\n }\n}\n\nexport class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number = 50;\n\n responses?: BaseMessage[];\n\n thrownErrorString?: string;\n\n idx: number;\n\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\" = \"openai\";\n\n structuredResponse?: Record<string, unknown>;\n\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][] = [];\n\n constructor(\n fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams\n ) {\n super(fields);\n this.sleep = fields.sleep ?? this.sleep;\n this.responses = fields.responses;\n this.thrownErrorString = fields.thrownErrorString;\n this.idx = 0;\n this.toolStyle = fields.toolStyle ?? this.toolStyle;\n this.structuredResponse = fields.structuredResponse;\n this.structuredOutputMessages = [];\n }\n\n _llmType() {\n return \"fake\";\n }\n\n async _generate(\n messages: BaseMessage[],\n _options: this[\"ParsedCallOptions\"],\n runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n if (this.thrownErrorString) {\n throw new Error(this.thrownErrorString);\n }\n if (this.sleep !== undefined) {\n await new Promise((resolve) => setTimeout(resolve, this.sleep));\n }\n const responses = this.responses?.length ? this.responses : messages;\n const msg = responses[this.idx % responses.length];\n const generation: ChatResult = {\n generations: [\n {\n text: \"\",\n message: msg,\n },\n ],\n };\n this.idx += 1;\n\n if (typeof msg.content === \"string\") {\n await runManager?.handleLLMNewToken(msg.content);\n }\n return generation;\n }\n\n bindTools(tools: BindToolsInput[]): Runnable<any> {\n const toolDicts = [];\n const serverTools = [];\n for (const tool of tools) {\n if (!(\"name\" in tool)) {\n serverTools.push(tool);\n continue;\n }\n\n // NOTE: this is a simplified tool spec for testing purposes only\n if (this.toolStyle === \"openai\") {\n toolDicts.push({\n type: \"function\",\n function: {\n name: tool.name,\n },\n });\n } else if ([\"anthropic\", \"google\"].includes(this.toolStyle)) {\n toolDicts.push({\n name: tool.name,\n });\n } else if (this.toolStyle === \"bedrock\") {\n toolDicts.push({\n toolSpec: {\n name: tool.name,\n },\n });\n }\n }\n let toolsToBind: BindToolsInput[] = toolDicts;\n if (this.toolStyle === \"google\") {\n toolsToBind = [{ functionDeclarations: toolDicts }];\n }\n return this.bind({\n tools: [...toolsToBind, ...serverTools],\n } as BaseChatModelCallOptions);\n }\n\n withStructuredOutput<\n RunOutput extends Record<string, any> = Record<string, any>\n >(_: unknown): Runnable<any> {\n if (!this.structuredResponse) {\n throw new Error(\"No structured response provided\");\n }\n // Create a runnable that returns the proper structured format\n return RunnableLambda.from(async (messages: BaseMessage[]) => {\n if (this.sleep) {\n await new Promise((resolve) => setTimeout(resolve, this.sleep));\n }\n\n // Store the messages that were sent to generate structured output\n this.structuredOutputMessages.push([...messages]);\n\n // Return in the format expected: { raw: BaseMessage, parsed: RunOutput }\n return this.structuredResponse as RunOutput;\n });\n }\n}\n\nexport class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>> = {};\n\n constructor() {\n super();\n this.storageForCopies = {};\n }\n\n async put(\n config: RunnableConfig,\n checkpoint: Checkpoint,\n metadata: CheckpointMetadata\n ): Promise<RunnableConfig> {\n const thread_id = config.configurable?.thread_id;\n this.storageForCopies[thread_id] ??= {};\n\n // assert checkpoint hasn't been modified since last written\n const saved = await this.get(config);\n if (saved) {\n const savedId = saved.id;\n if (this.storageForCopies[thread_id][savedId]) {\n const loaded = await this.serde.loadsTyped(\n \"json\",\n this.storageForCopies[thread_id][savedId]\n );\n\n expect(\n saved,\n `Checkpoint [${savedId}] has been modified since last written`\n ).toEqual(loaded);\n }\n }\n const [, serializedCheckpoint] = await this.serde.dumpsTyped(checkpoint);\n // save a copy of the checkpoint\n this.storageForCopies[thread_id][checkpoint.id] = serializedCheckpoint;\n\n return super.put(config, checkpoint, metadata);\n }\n}\n\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\n\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n\n// Helper function to create checkpointer\nexport function createCheckpointer(): BaseCheckpointSaver {\n return new MemorySaver();\n}\n\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n\n toolStyle: \"openai\" | \"anthropic\";\n\n index: number;\n\n structuredResponse?: any;\n\n private tools: StructuredTool[] = [];\n\n constructor({\n toolCalls = [],\n toolStyle = \"openai\",\n index = 0,\n structuredResponse,\n ...rest\n }: FakeToolCallingModelFields = {}) {\n super(rest);\n this.toolCalls = toolCalls;\n this.toolStyle = toolStyle;\n this.index = index;\n this.structuredResponse = structuredResponse;\n }\n\n _llmType(): string {\n return \"fake-tool-calling\";\n }\n\n _combineLLMOutput() {\n return [];\n }\n\n bindTools(\n tools: StructuredTool[]\n ):\n | FakeToolCallingModel\n | RunnableBinding<\n any,\n any,\n any & { tool_choice?: ToolChoice | undefined }\n > {\n const newInstance = new FakeToolCallingModel({\n toolCalls: this.toolCalls,\n toolStyle: this.toolStyle,\n index: this.index,\n structuredResponse: this.structuredResponse,\n });\n newInstance.tools = [...this.tools, ...tools];\n return newInstance;\n }\n\n withStructuredOutput(_schema: any) {\n return new RunnableLambda({\n func: async () => {\n return this.structuredResponse;\n },\n });\n }\n\n async _generate(\n messages: BaseMessage[],\n _options?: this[\"ParsedCallOptions\"],\n _runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n const lastMessage = messages[messages.length - 1];\n let content = lastMessage.content as string;\n\n // Handle prompt concatenation\n if (messages.length > 1) {\n const parts = messages.map((m) => m.content as string).filter(Boolean);\n content = parts.join(\"-\");\n }\n\n const currentToolCalls = this.toolCalls[this.index] || [];\n const messageId = this.index.toString();\n\n // Move to next set of tool calls for subsequent invocations\n this.index = (this.index + 1) % Math.max(1, this.toolCalls.length);\n\n const message = new AIMessage({\n content,\n id: messageId,\n tool_calls:\n currentToolCalls.length > 0\n ? currentToolCalls.map((tc) => ({\n ...tc,\n type: \"tool_call\" as const,\n }))\n : undefined,\n });\n\n return {\n generations: [\n {\n text: content,\n message,\n },\n ],\n llmOutput: {},\n };\n }\n}\n\nexport class SearchAPI extends StructuredTool {\n name = \"search_api\";\n\n description = \"A simple API that returns the input string.\";\n\n schema = z.object({\n query: z.string().describe(\"The query to search for.\"),\n });\n\n async _call(input: z.infer<typeof this.schema>) {\n if (input?.query === \"error\") {\n throw new Error(\"Error\");\n }\n return `result for ${input?.query}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuUA,IAAa,uBAAb,MAAa,6BAA6BA,2DAAc;CACtD;CAEA;CAEA;CAEA;CAEA,AAAQ,QAA0B,CAAE;CAEpC,YAAY,EACV,YAAY,CAAE,GACd,YAAY,UACZ,QAAQ,GACR,mBACA,GAAG,MACwB,GAAG,CAAE,GAAE;EAClC,MAAM,KAAK;EACX,KAAK,YAAY;EACjB,KAAK,YAAY;EACjB,KAAK,QAAQ;EACb,KAAK,qBAAqB;CAC3B;CAED,WAAmB;AACjB,SAAO;CACR;CAED,oBAAoB;AAClB,SAAO,CAAE;CACV;CAED,UACEC,OAOI;EACJ,MAAM,cAAc,IAAI,qBAAqB;GAC3C,WAAW,KAAK;GAChB,WAAW,KAAK;GAChB,OAAO,KAAK;GACZ,oBAAoB,KAAK;EAC1B;EACD,YAAY,QAAQ,CAAC,GAAG,KAAK,OAAO,GAAG,KAAM;AAC7C,SAAO;CACR;CAED,qBAAqBC,SAAc;AACjC,SAAO,IAAIC,0CAAe,EACxB,MAAM,YAAY;AAChB,UAAO,KAAK;EACb,EACF;CACF;CAED,MAAM,UACJC,UACAC,UACAC,aACqB;EACrB,MAAM,cAAc,SAAS,SAAS,SAAS;EAC/C,IAAI,UAAU,YAAY;AAG1B,MAAI,SAAS,SAAS,GAAG;GACvB,MAAM,QAAQ,SAAS,IAAI,CAAC,MAAM,EAAE,QAAkB,CAAC,OAAO,QAAQ;GACtE,UAAU,MAAM,KAAK,IAAI;EAC1B;EAED,MAAM,mBAAmB,KAAK,UAAU,KAAK,UAAU,CAAE;EACzD,MAAM,YAAY,KAAK,MAAM,UAAU;EAGvC,KAAK,SAAS,KAAK,QAAQ,KAAK,KAAK,IAAI,GAAG,KAAK,UAAU,OAAO;EAElE,MAAM,UAAU,IAAIC,oCAAU;GAC5B;GACA,IAAI;GACJ,YACE,iBAAiB,SAAS,IACtB,iBAAiB,IAAI,CAAC,QAAQ;IAC5B,GAAG;IACH,MAAM;GACP,GAAE,GACH;EACP;AAED,SAAO;GACL,aAAa,CACX;IACE,MAAM;IACN;GACD,CACF;GACD,WAAW,CAAE;EACd;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["BaseChatModel","value: number","tools: StructuredTool[]","_schema: any","RunnableLambda","messages: BaseMessage[]","_options?: this[\"ParsedCallOptions\"]","_runManager?: CallbackManagerForLLMRun","HumanMessage","AIMessage"],"sources":["../../../src/agents/tests/utils.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable import/no-extraneous-dependencies */\nimport { expect } from \"vitest\";\nimport { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport {\n BaseChatModel,\n BaseChatModelParams,\n BaseChatModelCallOptions,\n BindToolsInput,\n ToolChoice,\n} from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport {\n BaseMessage,\n AIMessage,\n HumanMessage,\n BaseMessageFields,\n AIMessageFields,\n ToolMessage,\n ToolMessageFields,\n} from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport {\n Runnable,\n RunnableConfig,\n RunnableLambda,\n RunnableBinding,\n} from \"@langchain/core/runnables\";\nimport {\n MemorySaver,\n Checkpoint,\n CheckpointMetadata,\n type BaseCheckpointSaver,\n} from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\n\nexport class _AnyIdAIMessage extends AIMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"AIMessage\"];\n }\n\n constructor(fields: AIMessageFields | string) {\n let fieldsWithJestMatcher: Partial<AIMessageFields> = {\n id: expect.any(String) as unknown as string,\n };\n if (typeof fields === \"string\") {\n fieldsWithJestMatcher = {\n content: fields,\n ...fieldsWithJestMatcher,\n };\n } else {\n fieldsWithJestMatcher = {\n ...fields,\n ...fieldsWithJestMatcher,\n };\n }\n super(fieldsWithJestMatcher as AIMessageFields);\n }\n}\n\nexport class _AnyIdHumanMessage extends HumanMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"HumanMessage\"];\n }\n\n constructor(fields: BaseMessageFields | string) {\n let fieldsWithJestMatcher: Partial<BaseMessageFields> = {\n id: expect.any(String) as unknown as string,\n };\n if (typeof fields === \"string\") {\n fieldsWithJestMatcher = {\n content: fields,\n ...fieldsWithJestMatcher,\n };\n } else {\n fieldsWithJestMatcher = {\n ...fields,\n ...fieldsWithJestMatcher,\n };\n }\n super(fieldsWithJestMatcher as BaseMessageFields);\n }\n}\n\nexport class _AnyIdToolMessage extends ToolMessage {\n get lc_id() {\n return [\"langchain_core\", \"messages\", \"ToolMessage\"];\n }\n\n constructor(fields: ToolMessageFields) {\n const fieldsWithJestMatcher: Partial<ToolMessageFields> = {\n id: expect.any(String) as unknown as string,\n ...fields,\n };\n super(fieldsWithJestMatcher as ToolMessageFields);\n }\n}\n\nexport class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any> = {};\n\n _chatModel: LanguageModelLike;\n\n constructor(\n fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams\n ) {\n super(fields);\n this._chatModel = fields.model;\n }\n\n _llmType() {\n return \"fake_configurable\";\n }\n\n async _generate(\n _messages: BaseMessage[],\n _options: this[\"ParsedCallOptions\"],\n _runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n throw new Error(\"Not implemented\");\n }\n\n async _model() {\n return this._chatModel;\n }\n\n bindTools(tools: BindToolsInput[]) {\n const modelWithTools = new FakeConfigurableModel({\n model: (this._chatModel as FakeToolCallingChatModel).bindTools(tools),\n });\n modelWithTools._queuedMethodOperations.bindTools = tools;\n return modelWithTools;\n }\n}\n\nexport class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number = 50;\n\n responses?: BaseMessage[];\n\n thrownErrorString?: string;\n\n idx: number;\n\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\" = \"openai\";\n\n structuredResponse?: Record<string, unknown>;\n\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][] = [];\n\n constructor(\n fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams\n ) {\n super(fields);\n this.sleep = fields.sleep ?? this.sleep;\n this.responses = fields.responses;\n this.thrownErrorString = fields.thrownErrorString;\n this.idx = 0;\n this.toolStyle = fields.toolStyle ?? this.toolStyle;\n this.structuredResponse = fields.structuredResponse;\n this.structuredOutputMessages = [];\n }\n\n _llmType() {\n return \"fake\";\n }\n\n async _generate(\n messages: BaseMessage[],\n _options: this[\"ParsedCallOptions\"],\n runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n if (this.thrownErrorString) {\n throw new Error(this.thrownErrorString);\n }\n if (this.sleep !== undefined) {\n await new Promise((resolve) => setTimeout(resolve, this.sleep));\n }\n const responses = this.responses?.length ? this.responses : messages;\n const msg = responses[this.idx % responses.length];\n const generation: ChatResult = {\n generations: [\n {\n text: \"\",\n message: msg,\n },\n ],\n };\n this.idx += 1;\n\n if (typeof msg.content === \"string\") {\n await runManager?.handleLLMNewToken(msg.content);\n }\n return generation;\n }\n\n bindTools(tools: BindToolsInput[]): Runnable<any> {\n const toolDicts = [];\n const serverTools = [];\n for (const tool of tools) {\n if (!(\"name\" in tool)) {\n serverTools.push(tool);\n continue;\n }\n\n // NOTE: this is a simplified tool spec for testing purposes only\n if (this.toolStyle === \"openai\") {\n toolDicts.push({\n type: \"function\",\n function: {\n name: tool.name,\n },\n });\n } else if ([\"anthropic\", \"google\"].includes(this.toolStyle)) {\n toolDicts.push({\n name: tool.name,\n });\n } else if (this.toolStyle === \"bedrock\") {\n toolDicts.push({\n toolSpec: {\n name: tool.name,\n },\n });\n }\n }\n let toolsToBind: BindToolsInput[] = toolDicts;\n if (this.toolStyle === \"google\") {\n toolsToBind = [{ functionDeclarations: toolDicts }];\n }\n return this.withConfig({\n tools: [...toolsToBind, ...serverTools],\n } as BaseChatModelCallOptions);\n }\n\n withStructuredOutput<\n RunOutput extends Record<string, any> = Record<string, any>\n >(_: unknown): Runnable<any> {\n if (!this.structuredResponse) {\n throw new Error(\"No structured response provided\");\n }\n // Create a runnable that returns the proper structured format\n return RunnableLambda.from(async (messages: BaseMessage[]) => {\n if (this.sleep) {\n await new Promise((resolve) => setTimeout(resolve, this.sleep));\n }\n\n // Store the messages that were sent to generate structured output\n this.structuredOutputMessages.push([...messages]);\n\n // Return in the format expected: { raw: BaseMessage, parsed: RunOutput }\n return this.structuredResponse as RunOutput;\n });\n }\n}\n\nexport class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>> = {};\n\n constructor() {\n super();\n this.storageForCopies = {};\n }\n\n async put(\n config: RunnableConfig,\n checkpoint: Checkpoint,\n metadata: CheckpointMetadata\n ): Promise<RunnableConfig> {\n const thread_id = config.configurable?.thread_id;\n this.storageForCopies[thread_id] ??= {};\n\n // assert checkpoint hasn't been modified since last written\n const saved = await this.get(config);\n if (saved) {\n const savedId = saved.id;\n if (this.storageForCopies[thread_id][savedId]) {\n const loaded = await this.serde.loadsTyped(\n \"json\",\n this.storageForCopies[thread_id][savedId]\n );\n\n expect(\n saved,\n `Checkpoint [${savedId}] has been modified since last written`\n ).toEqual(loaded);\n }\n }\n const [, serializedCheckpoint] = await this.serde.dumpsTyped(checkpoint);\n // save a copy of the checkpoint\n this.storageForCopies[thread_id][checkpoint.id] = serializedCheckpoint;\n\n return super.put(config, checkpoint, metadata);\n }\n}\n\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\n\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n\n// Helper function to create checkpointer\nexport function createCheckpointer(): BaseCheckpointSaver {\n return new MemorySaver();\n}\n\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n\n toolStyle: \"openai\" | \"anthropic\";\n\n // Use a shared reference object so the index persists across bindTools calls\n private indexRef: { current: number };\n\n structuredResponse?: any;\n\n private tools: StructuredTool[] = [];\n\n constructor({\n toolCalls = [],\n toolStyle = \"openai\",\n index = 0,\n structuredResponse,\n indexRef,\n ...rest\n }: FakeToolCallingModelFields & { indexRef?: { current: number } } = {}) {\n super(rest);\n this.toolCalls = toolCalls;\n this.toolStyle = toolStyle;\n // Share the same index reference across instances\n this.indexRef = indexRef ?? { current: index };\n this.structuredResponse = structuredResponse;\n }\n\n // Getter/setter for backwards compatibility\n get index(): number {\n return this.indexRef.current;\n }\n\n set index(value: number) {\n this.indexRef.current = value;\n }\n\n _llmType(): string {\n return \"fake-tool-calling\";\n }\n\n _combineLLMOutput() {\n return [];\n }\n\n bindTools(\n tools: StructuredTool[]\n ):\n | FakeToolCallingModel\n | RunnableBinding<\n any,\n any,\n any & { tool_choice?: ToolChoice | undefined }\n > {\n const newInstance = new FakeToolCallingModel({\n toolCalls: this.toolCalls,\n toolStyle: this.toolStyle,\n structuredResponse: this.structuredResponse,\n // Pass the same indexRef so all instances share the same index state\n indexRef: this.indexRef,\n });\n newInstance.tools = [...this.tools, ...tools];\n return newInstance;\n }\n\n withStructuredOutput(_schema: any) {\n return new RunnableLambda({\n func: async () => {\n return this.structuredResponse;\n },\n });\n }\n\n async _generate(\n messages: BaseMessage[],\n _options?: this[\"ParsedCallOptions\"],\n _runManager?: CallbackManagerForLLMRun\n ): Promise<ChatResult> {\n const lastMessage = messages[messages.length - 1];\n let content = lastMessage.content as string;\n\n // Handle prompt concatenation\n if (messages.length > 1) {\n const parts = messages.map((m) => m.content).filter(Boolean);\n content = parts.join(\"-\");\n }\n\n // Reset index at the start of a new conversation (only human message)\n // This allows the model to be reused across multiple agent.invoke() calls\n const isStartOfConversation =\n messages.length === 1 ||\n (messages.length === 2 && messages.every(HumanMessage.isInstance));\n if (isStartOfConversation && this.index !== 0) {\n this.index = 0;\n }\n\n const currentToolCalls = this.toolCalls[this.index] || [];\n const messageId = this.index.toString();\n\n // Move to next set of tool calls for subsequent invocations\n this.index = (this.index + 1) % Math.max(1, this.toolCalls.length);\n\n const message = new AIMessage({\n content,\n id: messageId,\n tool_calls:\n currentToolCalls.length > 0\n ? currentToolCalls.map((tc) => ({\n ...tc,\n type: \"tool_call\" as const,\n }))\n : undefined,\n });\n\n return {\n generations: [\n {\n text: content,\n message,\n },\n ],\n llmOutput: {},\n };\n }\n}\n\nexport class SearchAPI extends StructuredTool {\n name = \"search_api\";\n\n description = \"A simple API that returns the input string.\";\n\n schema = z.object({\n query: z.string().describe(\"The query to search for.\"),\n });\n\n async _call(input: z.infer<typeof this.schema>) {\n if (input?.query === \"error\") {\n throw new Error(\"Error\");\n }\n return `result for ${input?.query}`;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAuUA,IAAa,uBAAb,MAAa,6BAA6BA,2DAAc;CACtD;CAEA;CAGA,AAAQ;CAER;CAEA,AAAQ,QAA0B,CAAE;CAEpC,YAAY,EACV,YAAY,CAAE,GACd,YAAY,UACZ,QAAQ,GACR,oBACA,SACA,GAAG,MAC6D,GAAG,CAAE,GAAE;EACvE,MAAM,KAAK;EACX,KAAK,YAAY;EACjB,KAAK,YAAY;EAEjB,KAAK,WAAW,YAAY,EAAE,SAAS,MAAO;EAC9C,KAAK,qBAAqB;CAC3B;CAGD,IAAI,QAAgB;AAClB,SAAO,KAAK,SAAS;CACtB;CAED,IAAI,MAAMC,OAAe;EACvB,KAAK,SAAS,UAAU;CACzB;CAED,WAAmB;AACjB,SAAO;CACR;CAED,oBAAoB;AAClB,SAAO,CAAE;CACV;CAED,UACEC,OAOI;EACJ,MAAM,cAAc,IAAI,qBAAqB;GAC3C,WAAW,KAAK;GAChB,WAAW,KAAK;GAChB,oBAAoB,KAAK;GAEzB,UAAU,KAAK;EAChB;EACD,YAAY,QAAQ,CAAC,GAAG,KAAK,OAAO,GAAG,KAAM;AAC7C,SAAO;CACR;CAED,qBAAqBC,SAAc;AACjC,SAAO,IAAIC,0CAAe,EACxB,MAAM,YAAY;AAChB,UAAO,KAAK;EACb,EACF;CACF;CAED,MAAM,UACJC,UACAC,UACAC,aACqB;EACrB,MAAM,cAAc,SAAS,SAAS,SAAS;EAC/C,IAAI,UAAU,YAAY;AAG1B,MAAI,SAAS,SAAS,GAAG;GACvB,MAAM,QAAQ,SAAS,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,QAAQ;GAC5D,UAAU,MAAM,KAAK,IAAI;EAC1B;EAID,MAAM,wBACJ,SAAS,WAAW,KACnB,SAAS,WAAW,KAAK,SAAS,MAAMC,uCAAa,WAAW;AACnE,MAAI,yBAAyB,KAAK,UAAU,GAC1C,KAAK,QAAQ;EAGf,MAAM,mBAAmB,KAAK,UAAU,KAAK,UAAU,CAAE;EACzD,MAAM,YAAY,KAAK,MAAM,UAAU;EAGvC,KAAK,SAAS,KAAK,QAAQ,KAAK,KAAK,IAAI,GAAG,KAAK,UAAU,OAAO;EAElE,MAAM,UAAU,IAAIC,oCAAU;GAC5B;GACA,IAAI;GACJ,YACE,iBAAiB,SAAS,IACtB,iBAAiB,IAAI,CAAC,QAAQ;IAC5B,GAAG;IACH,MAAM;GACP,GAAE,GACH;EACP;AAED,SAAO;GACL,aAAa,CACX;IACE,MAAM;IACN;GACD,CACF;GACD,WAAW,CAAE;EACd;CACF;AACF"}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { LanguageModelLike } from "@langchain/core/language_models/base";
|
|
2
|
-
import {
|
|
2
|
+
import { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from "@langchain/core/language_models/chat_models";
|
|
3
3
|
import { AIMessage, BaseMessage, ToolMessage } from "@langchain/core/messages";
|
|
4
|
-
import { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
|
|
5
4
|
import { Runnable, RunnableBinding, RunnableConfig, RunnableLambda } from "@langchain/core/runnables";
|
|
6
5
|
import { StructuredTool } from "@langchain/core/tools";
|
|
7
|
-
import { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from "@langchain/core/language_models/chat_models";
|
|
8
6
|
import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
9
7
|
import { ChatResult } from "@langchain/core/outputs";
|
|
8
|
+
import { BaseCheckpointSaver } from "@langchain/langgraph-checkpoint";
|
|
9
|
+
import { z } from "zod/v3";
|
|
10
10
|
|
|
11
11
|
//#region src/agents/tests/utils.d.ts
|
|
12
12
|
|
|
13
|
-
interface ToolCall {
|
|
13
|
+
interface ToolCall$1 {
|
|
14
14
|
name: string;
|
|
15
15
|
args: Record<string, any>;
|
|
16
16
|
id: string;
|
|
17
17
|
type?: "tool_call";
|
|
18
18
|
}
|
|
19
19
|
interface FakeToolCallingModelFields {
|
|
20
|
-
toolCalls?: ToolCall[][];
|
|
20
|
+
toolCalls?: ToolCall$1[][];
|
|
21
21
|
toolStyle?: "openai" | "anthropic";
|
|
22
22
|
index?: number;
|
|
23
23
|
structuredResponse?: any;
|
|
@@ -28,9 +28,10 @@ interface FakeToolCallingModelFields {
|
|
|
28
28
|
* Fake chat model for testing tool calling functionality
|
|
29
29
|
*/
|
|
30
30
|
declare class FakeToolCallingModel extends BaseChatModel {
|
|
31
|
-
toolCalls: ToolCall[][];
|
|
31
|
+
toolCalls: ToolCall$1[][];
|
|
32
32
|
toolStyle: "openai" | "anthropic";
|
|
33
|
-
index
|
|
33
|
+
// Use a shared reference object so the index persists across bindTools calls
|
|
34
|
+
private indexRef;
|
|
34
35
|
structuredResponse?: any;
|
|
35
36
|
private tools;
|
|
36
37
|
constructor({
|
|
@@ -38,8 +39,16 @@ declare class FakeToolCallingModel extends BaseChatModel {
|
|
|
38
39
|
toolStyle,
|
|
39
40
|
index,
|
|
40
41
|
structuredResponse,
|
|
42
|
+
indexRef,
|
|
41
43
|
...rest
|
|
42
|
-
}?: FakeToolCallingModelFields
|
|
44
|
+
}?: FakeToolCallingModelFields & {
|
|
45
|
+
indexRef?: {
|
|
46
|
+
current: number;
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
// Getter/setter for backwards compatibility
|
|
50
|
+
get index(): number;
|
|
51
|
+
set index(value: number);
|
|
43
52
|
_llmType(): string;
|
|
44
53
|
_combineLLMOutput(): never[];
|
|
45
54
|
bindTools(tools: StructuredTool[]): FakeToolCallingModel | RunnableBinding<any, any, any & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.cts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelParams","BindToolsInput","ToolChoice","StructuredTool","BaseMessage","AIMessage","HumanMessage","BaseMessageFields","AIMessageFields","ToolMessage","ToolMessageFields","ChatResult","Runnable","RunnableConfig","RunnableLambda","RunnableBinding","MemorySaver","Checkpoint","CheckpointMetadata","BaseCheckpointSaver","LanguageModelLike","z","_AnyIdAIMessage","_AnyIdHumanMessage","_AnyIdToolMessage","FakeConfigurableModel","Record","Promise","FakeToolCallingChatModel","MemorySaverAssertImmutable","Uint8Array","ToolCall","FakeToolCallingModelFields","createCheckpointer","FakeToolCallingModel","toolCalls","toolStyle","index","structuredResponse","SearchAPI","ZodString","ZodTypeAny","ZodObject","this","schema","infer"],"sources":["../../../src/agents/tests/utils.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport { BaseMessage, AIMessage, HumanMessage, BaseMessageFields, AIMessageFields, ToolMessage, ToolMessageFields } from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport { Runnable, RunnableConfig, RunnableLambda, RunnableBinding } from \"@langchain/core/runnables\";\nimport { MemorySaver, Checkpoint, CheckpointMetadata, type BaseCheckpointSaver } from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\nexport declare class _AnyIdAIMessage extends AIMessage {\n get lc_id(): string[];\n constructor(fields: AIMessageFields | string);\n}\nexport declare class _AnyIdHumanMessage extends HumanMessage {\n get lc_id(): string[];\n constructor(fields: BaseMessageFields | string);\n}\nexport declare class _AnyIdToolMessage extends ToolMessage {\n get lc_id(): string[];\n constructor(fields: ToolMessageFields);\n}\nexport declare class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any>;\n _chatModel: LanguageModelLike;\n constructor(fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(_messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _model(): Promise<LanguageModelLike>;\n bindTools(tools: BindToolsInput[]): FakeConfigurableModel;\n}\nexport declare class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n idx: number;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][];\n constructor(fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n bindTools(tools: BindToolsInput[]): Runnable<any>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_: unknown): Runnable<any>;\n}\nexport declare class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>>;\n constructor();\n put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;\n}\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n// Helper function to create checkpointer\nexport declare function createCheckpointer(): BaseCheckpointSaver;\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport declare class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n toolStyle: \"openai\" | \"anthropic\";\n index
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelParams","BindToolsInput","ToolChoice","StructuredTool","BaseMessage","AIMessage","HumanMessage","BaseMessageFields","AIMessageFields","ToolMessage","ToolMessageFields","ChatResult","Runnable","RunnableConfig","RunnableLambda","RunnableBinding","MemorySaver","Checkpoint","CheckpointMetadata","BaseCheckpointSaver","LanguageModelLike","z","_AnyIdAIMessage","_AnyIdHumanMessage","_AnyIdToolMessage","FakeConfigurableModel","Record","Promise","FakeToolCallingChatModel","MemorySaverAssertImmutable","Uint8Array","ToolCall","FakeToolCallingModelFields","createCheckpointer","FakeToolCallingModel","toolCalls","toolStyle","index","structuredResponse","indexRef","SearchAPI","ZodString","ZodTypeAny","ZodObject","this","schema","infer"],"sources":["../../../src/agents/tests/utils.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport { BaseMessage, AIMessage, HumanMessage, BaseMessageFields, AIMessageFields, ToolMessage, ToolMessageFields } from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport { Runnable, RunnableConfig, RunnableLambda, RunnableBinding } from \"@langchain/core/runnables\";\nimport { MemorySaver, Checkpoint, CheckpointMetadata, type BaseCheckpointSaver } from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\nexport declare class _AnyIdAIMessage extends AIMessage {\n get lc_id(): string[];\n constructor(fields: AIMessageFields | string);\n}\nexport declare class _AnyIdHumanMessage extends HumanMessage {\n get lc_id(): string[];\n constructor(fields: BaseMessageFields | string);\n}\nexport declare class _AnyIdToolMessage extends ToolMessage {\n get lc_id(): string[];\n constructor(fields: ToolMessageFields);\n}\nexport declare class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any>;\n _chatModel: LanguageModelLike;\n constructor(fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(_messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _model(): Promise<LanguageModelLike>;\n bindTools(tools: BindToolsInput[]): FakeConfigurableModel;\n}\nexport declare class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n idx: number;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][];\n constructor(fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n bindTools(tools: BindToolsInput[]): Runnable<any>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_: unknown): Runnable<any>;\n}\nexport declare class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>>;\n constructor();\n put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;\n}\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n// Helper function to create checkpointer\nexport declare function createCheckpointer(): BaseCheckpointSaver;\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport declare class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n toolStyle: \"openai\" | \"anthropic\";\n // Use a shared reference object so the index persists across bindTools calls\n private indexRef;\n structuredResponse?: any;\n private tools;\n constructor({ toolCalls, toolStyle, index, structuredResponse, indexRef, ...rest }?: FakeToolCallingModelFields & {\n indexRef?: {\n current: number;\n };\n });\n // Getter/setter for backwards compatibility\n get index(): number;\n set index(value: number);\n _llmType(): string;\n _combineLLMOutput(): never[];\n bindTools(tools: StructuredTool[]): FakeToolCallingModel | RunnableBinding<any, any, any & {\n tool_choice?: ToolChoice | undefined;\n }>;\n withStructuredOutput(_schema: any): RunnableLambda<unknown, any, RunnableConfig<Record<string, any>>>;\n _generate(messages: BaseMessage[], _options?: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n}\nexport declare class SearchAPI extends StructuredTool {\n name: string;\n description: string;\n schema: z.ZodObject<{\n query: z.ZodString;\n }, \"strip\", z.ZodTypeAny, {\n query: string;\n }, {\n query: string;\n }>;\n _call(input: z.infer<typeof this.schema>): Promise<string>;\n}\nexport {};\n"],"mappings":";;;;;;;;;;;;UA0DUiC,UAAAA;;QAEAL;;;;UAIAM,0BAAAA;cACMD;;;;;;;;;;cAUKG,oBAAAA,SAA6BnC,aAAAA;aACnCgC;;;;;;;;;;;;;MAM0EC;;;;;;;;;;mBAUpE7B,mBAAmB+B,uBAAuBnB;kBACzCb;;sCAEkBY,6BAA6BD,eAAea;sBAC5DtB,mEAAmEN,2BAA2B6B,QAAQhB"}
|
|
@@ -10,14 +10,14 @@ import { CallbackManagerForLLMRun } from "@langchain/core/callbacks/manager";
|
|
|
10
10
|
|
|
11
11
|
//#region src/agents/tests/utils.d.ts
|
|
12
12
|
|
|
13
|
-
interface ToolCall {
|
|
13
|
+
interface ToolCall$1 {
|
|
14
14
|
name: string;
|
|
15
15
|
args: Record<string, any>;
|
|
16
16
|
id: string;
|
|
17
17
|
type?: "tool_call";
|
|
18
18
|
}
|
|
19
19
|
interface FakeToolCallingModelFields {
|
|
20
|
-
toolCalls?: ToolCall[][];
|
|
20
|
+
toolCalls?: ToolCall$1[][];
|
|
21
21
|
toolStyle?: "openai" | "anthropic";
|
|
22
22
|
index?: number;
|
|
23
23
|
structuredResponse?: any;
|
|
@@ -28,9 +28,10 @@ interface FakeToolCallingModelFields {
|
|
|
28
28
|
* Fake chat model for testing tool calling functionality
|
|
29
29
|
*/
|
|
30
30
|
declare class FakeToolCallingModel extends BaseChatModel {
|
|
31
|
-
toolCalls: ToolCall[][];
|
|
31
|
+
toolCalls: ToolCall$1[][];
|
|
32
32
|
toolStyle: "openai" | "anthropic";
|
|
33
|
-
index
|
|
33
|
+
// Use a shared reference object so the index persists across bindTools calls
|
|
34
|
+
private indexRef;
|
|
34
35
|
structuredResponse?: any;
|
|
35
36
|
private tools;
|
|
36
37
|
constructor({
|
|
@@ -38,8 +39,16 @@ declare class FakeToolCallingModel extends BaseChatModel {
|
|
|
38
39
|
toolStyle,
|
|
39
40
|
index,
|
|
40
41
|
structuredResponse,
|
|
42
|
+
indexRef,
|
|
41
43
|
...rest
|
|
42
|
-
}?: FakeToolCallingModelFields
|
|
44
|
+
}?: FakeToolCallingModelFields & {
|
|
45
|
+
indexRef?: {
|
|
46
|
+
current: number;
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
// Getter/setter for backwards compatibility
|
|
50
|
+
get index(): number;
|
|
51
|
+
set index(value: number);
|
|
43
52
|
_llmType(): string;
|
|
44
53
|
_combineLLMOutput(): never[];
|
|
45
54
|
bindTools(tools: StructuredTool[]): FakeToolCallingModel | RunnableBinding<any, any, any & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelParams","BindToolsInput","ToolChoice","StructuredTool","BaseMessage","AIMessage","HumanMessage","BaseMessageFields","AIMessageFields","ToolMessage","ToolMessageFields","ChatResult","Runnable","RunnableConfig","RunnableLambda","RunnableBinding","MemorySaver","Checkpoint","CheckpointMetadata","BaseCheckpointSaver","LanguageModelLike","z","_AnyIdAIMessage","_AnyIdHumanMessage","_AnyIdToolMessage","FakeConfigurableModel","Record","Promise","FakeToolCallingChatModel","MemorySaverAssertImmutable","Uint8Array","ToolCall","FakeToolCallingModelFields","createCheckpointer","FakeToolCallingModel","toolCalls","toolStyle","index","structuredResponse","SearchAPI","ZodString","ZodTypeAny","ZodObject","this","schema","infer"],"sources":["../../../src/agents/tests/utils.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport { BaseMessage, AIMessage, HumanMessage, BaseMessageFields, AIMessageFields, ToolMessage, ToolMessageFields } from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport { Runnable, RunnableConfig, RunnableLambda, RunnableBinding } from \"@langchain/core/runnables\";\nimport { MemorySaver, Checkpoint, CheckpointMetadata, type BaseCheckpointSaver } from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\nexport declare class _AnyIdAIMessage extends AIMessage {\n get lc_id(): string[];\n constructor(fields: AIMessageFields | string);\n}\nexport declare class _AnyIdHumanMessage extends HumanMessage {\n get lc_id(): string[];\n constructor(fields: BaseMessageFields | string);\n}\nexport declare class _AnyIdToolMessage extends ToolMessage {\n get lc_id(): string[];\n constructor(fields: ToolMessageFields);\n}\nexport declare class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any>;\n _chatModel: LanguageModelLike;\n constructor(fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(_messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _model(): Promise<LanguageModelLike>;\n bindTools(tools: BindToolsInput[]): FakeConfigurableModel;\n}\nexport declare class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n idx: number;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][];\n constructor(fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n bindTools(tools: BindToolsInput[]): Runnable<any>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_: unknown): Runnable<any>;\n}\nexport declare class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>>;\n constructor();\n put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;\n}\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n// Helper function to create checkpointer\nexport declare function createCheckpointer(): BaseCheckpointSaver;\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport declare class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n toolStyle: \"openai\" | \"anthropic\";\n index
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":["CallbackManagerForLLMRun","BaseChatModel","BaseChatModelParams","BindToolsInput","ToolChoice","StructuredTool","BaseMessage","AIMessage","HumanMessage","BaseMessageFields","AIMessageFields","ToolMessage","ToolMessageFields","ChatResult","Runnable","RunnableConfig","RunnableLambda","RunnableBinding","MemorySaver","Checkpoint","CheckpointMetadata","BaseCheckpointSaver","LanguageModelLike","z","_AnyIdAIMessage","_AnyIdHumanMessage","_AnyIdToolMessage","FakeConfigurableModel","Record","Promise","FakeToolCallingChatModel","MemorySaverAssertImmutable","Uint8Array","ToolCall","FakeToolCallingModelFields","createCheckpointer","FakeToolCallingModel","toolCalls","toolStyle","index","structuredResponse","indexRef","SearchAPI","ZodString","ZodTypeAny","ZodObject","this","schema","infer"],"sources":["../../../src/agents/tests/utils.d.ts"],"sourcesContent":["import { CallbackManagerForLLMRun } from \"@langchain/core/callbacks/manager\";\nimport { BaseChatModel, BaseChatModelParams, BindToolsInput, ToolChoice } from \"@langchain/core/language_models/chat_models\";\nimport { StructuredTool } from \"@langchain/core/tools\";\nimport { BaseMessage, AIMessage, HumanMessage, BaseMessageFields, AIMessageFields, ToolMessage, ToolMessageFields } from \"@langchain/core/messages\";\nimport { ChatResult } from \"@langchain/core/outputs\";\nimport { Runnable, RunnableConfig, RunnableLambda, RunnableBinding } from \"@langchain/core/runnables\";\nimport { MemorySaver, Checkpoint, CheckpointMetadata, type BaseCheckpointSaver } from \"@langchain/langgraph-checkpoint\";\nimport { LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { z } from \"zod/v3\";\nexport declare class _AnyIdAIMessage extends AIMessage {\n get lc_id(): string[];\n constructor(fields: AIMessageFields | string);\n}\nexport declare class _AnyIdHumanMessage extends HumanMessage {\n get lc_id(): string[];\n constructor(fields: BaseMessageFields | string);\n}\nexport declare class _AnyIdToolMessage extends ToolMessage {\n get lc_id(): string[];\n constructor(fields: ToolMessageFields);\n}\nexport declare class FakeConfigurableModel extends BaseChatModel {\n _queuedMethodOperations: Record<string, any>;\n _chatModel: LanguageModelLike;\n constructor(fields: {\n model: LanguageModelLike;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(_messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n _model(): Promise<LanguageModelLike>;\n bindTools(tools: BindToolsInput[]): FakeConfigurableModel;\n}\nexport declare class FakeToolCallingChatModel extends BaseChatModel {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n idx: number;\n toolStyle: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n // Track messages passed to structured output calls\n structuredOutputMessages: BaseMessage[][];\n constructor(fields: {\n sleep?: number;\n responses?: BaseMessage[];\n thrownErrorString?: string;\n toolStyle?: \"openai\" | \"anthropic\" | \"bedrock\" | \"google\";\n structuredResponse?: Record<string, unknown>;\n } & BaseChatModelParams);\n _llmType(): string;\n _generate(messages: BaseMessage[], _options: this[\"ParsedCallOptions\"], runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n bindTools(tools: BindToolsInput[]): Runnable<any>;\n withStructuredOutput<RunOutput extends Record<string, any> = Record<string, any>>(_: unknown): Runnable<any>;\n}\nexport declare class MemorySaverAssertImmutable extends MemorySaver {\n storageForCopies: Record<string, Record<string, Uint8Array>>;\n constructor();\n put(config: RunnableConfig, checkpoint: Checkpoint, metadata: CheckpointMetadata): Promise<RunnableConfig>;\n}\ninterface ToolCall {\n name: string;\n args: Record<string, any>;\n id: string;\n type?: \"tool_call\";\n}\ninterface FakeToolCallingModelFields {\n toolCalls?: ToolCall[][];\n toolStyle?: \"openai\" | \"anthropic\";\n index?: number;\n structuredResponse?: any;\n}\n// Helper function to create checkpointer\nexport declare function createCheckpointer(): BaseCheckpointSaver;\n/**\n * Fake chat model for testing tool calling functionality\n */\nexport declare class FakeToolCallingModel extends BaseChatModel {\n toolCalls: ToolCall[][];\n toolStyle: \"openai\" | \"anthropic\";\n // Use a shared reference object so the index persists across bindTools calls\n private indexRef;\n structuredResponse?: any;\n private tools;\n constructor({ toolCalls, toolStyle, index, structuredResponse, indexRef, ...rest }?: FakeToolCallingModelFields & {\n indexRef?: {\n current: number;\n };\n });\n // Getter/setter for backwards compatibility\n get index(): number;\n set index(value: number);\n _llmType(): string;\n _combineLLMOutput(): never[];\n bindTools(tools: StructuredTool[]): FakeToolCallingModel | RunnableBinding<any, any, any & {\n tool_choice?: ToolChoice | undefined;\n }>;\n withStructuredOutput(_schema: any): RunnableLambda<unknown, any, RunnableConfig<Record<string, any>>>;\n _generate(messages: BaseMessage[], _options?: this[\"ParsedCallOptions\"], _runManager?: CallbackManagerForLLMRun): Promise<ChatResult>;\n}\nexport declare class SearchAPI extends StructuredTool {\n name: string;\n description: string;\n schema: z.ZodObject<{\n query: z.ZodString;\n }, \"strip\", z.ZodTypeAny, {\n query: string;\n }, {\n query: string;\n }>;\n _call(input: z.infer<typeof this.schema>): Promise<string>;\n}\nexport {};\n"],"mappings":";;;;;;;;;;;;UA0DUiC,UAAAA;;QAEAL;;;;UAIAM,0BAAAA;cACMD;;;;;;;;;;cAUKG,oBAAAA,SAA6BnC,aAAAA;aACnCgC;;;;;;;;;;;;;MAM0EC;;;;;;;;;;mBAUpE7B,mBAAmB+B,uBAAuBnB;kBACzCb;;sCAEkBY,6BAA6BD,eAAea;sBAC5DtB,mEAAmEN,2BAA2B6B,QAAQhB"}
|
|
@@ -12,16 +12,22 @@ import "@langchain/langgraph-checkpoint";
|
|
|
12
12
|
var FakeToolCallingModel = class FakeToolCallingModel extends BaseChatModel {
|
|
13
13
|
toolCalls;
|
|
14
14
|
toolStyle;
|
|
15
|
-
|
|
15
|
+
indexRef;
|
|
16
16
|
structuredResponse;
|
|
17
17
|
tools = [];
|
|
18
|
-
constructor({ toolCalls = [], toolStyle = "openai", index = 0, structuredResponse,...rest } = {}) {
|
|
18
|
+
constructor({ toolCalls = [], toolStyle = "openai", index = 0, structuredResponse, indexRef,...rest } = {}) {
|
|
19
19
|
super(rest);
|
|
20
20
|
this.toolCalls = toolCalls;
|
|
21
21
|
this.toolStyle = toolStyle;
|
|
22
|
-
this.
|
|
22
|
+
this.indexRef = indexRef ?? { current: index };
|
|
23
23
|
this.structuredResponse = structuredResponse;
|
|
24
24
|
}
|
|
25
|
+
get index() {
|
|
26
|
+
return this.indexRef.current;
|
|
27
|
+
}
|
|
28
|
+
set index(value) {
|
|
29
|
+
this.indexRef.current = value;
|
|
30
|
+
}
|
|
25
31
|
_llmType() {
|
|
26
32
|
return "fake-tool-calling";
|
|
27
33
|
}
|
|
@@ -32,8 +38,8 @@ var FakeToolCallingModel = class FakeToolCallingModel extends BaseChatModel {
|
|
|
32
38
|
const newInstance = new FakeToolCallingModel({
|
|
33
39
|
toolCalls: this.toolCalls,
|
|
34
40
|
toolStyle: this.toolStyle,
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
structuredResponse: this.structuredResponse,
|
|
42
|
+
indexRef: this.indexRef
|
|
37
43
|
});
|
|
38
44
|
newInstance.tools = [...this.tools, ...tools];
|
|
39
45
|
return newInstance;
|
|
@@ -50,6 +56,8 @@ var FakeToolCallingModel = class FakeToolCallingModel extends BaseChatModel {
|
|
|
50
56
|
const parts = messages.map((m) => m.content).filter(Boolean);
|
|
51
57
|
content = parts.join("-");
|
|
52
58
|
}
|
|
59
|
+
const isStartOfConversation = messages.length === 1 || messages.length === 2 && messages.every(HumanMessage.isInstance);
|
|
60
|
+
if (isStartOfConversation && this.index !== 0) this.index = 0;
|
|
53
61
|
const currentToolCalls = this.toolCalls[this.index] || [];
|
|
54
62
|
const messageId = this.index.toString();
|
|
55
63
|
this.index = (this.index + 1) % Math.max(1, this.toolCalls.length);
|