langchain 1.0.0-alpha.9 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +267 -0
- package/README.md +29 -77
- package/dist/_virtual/rolldown_runtime.cjs +0 -4
- package/dist/_virtual/rolldown_runtime.js +1 -10
- package/dist/agents/ReactAgent.cjs +6 -5
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.d.cts +11 -11
- package/dist/agents/ReactAgent.d.cts.map +1 -1
- package/dist/agents/ReactAgent.d.ts +11 -11
- package/dist/agents/ReactAgent.d.ts.map +1 -1
- package/dist/agents/ReactAgent.js +6 -5
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/annotation.cjs +8 -9
- package/dist/agents/annotation.cjs.map +1 -1
- package/dist/agents/annotation.js +8 -9
- package/dist/agents/annotation.js.map +1 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +23 -23
- package/dist/agents/index.d.cts.map +1 -1
- package/dist/agents/index.d.ts +23 -23
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/middleware/callLimit.cjs +29 -27
- package/dist/agents/middleware/callLimit.cjs.map +1 -1
- package/dist/agents/middleware/callLimit.d.cts.map +1 -1
- package/dist/agents/middleware/callLimit.d.ts.map +1 -1
- package/dist/agents/middleware/callLimit.js +29 -27
- package/dist/agents/middleware/callLimit.js.map +1 -1
- package/dist/agents/middleware/contextEditing.cjs +1 -1
- package/dist/agents/middleware/contextEditing.d.cts.map +1 -1
- package/dist/agents/middleware/contextEditing.d.ts.map +1 -1
- package/dist/agents/middleware/contextEditing.js +1 -1
- package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -1
- package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -1
- package/dist/agents/middleware/hitl.cjs +92 -90
- package/dist/agents/middleware/hitl.cjs.map +1 -1
- package/dist/agents/middleware/hitl.d.cts +20 -20
- package/dist/agents/middleware/hitl.d.cts.map +1 -1
- package/dist/agents/middleware/hitl.d.ts +20 -20
- package/dist/agents/middleware/hitl.d.ts.map +1 -1
- package/dist/agents/middleware/hitl.js +92 -90
- package/dist/agents/middleware/hitl.js.map +1 -1
- package/dist/agents/middleware/modelFallback.cjs +1 -1
- package/dist/agents/middleware/modelFallback.cjs.map +1 -1
- package/dist/agents/middleware/modelFallback.d.cts +1 -1
- package/dist/agents/middleware/modelFallback.d.cts.map +1 -1
- package/dist/agents/middleware/modelFallback.d.ts +1 -1
- package/dist/agents/middleware/modelFallback.d.ts.map +1 -1
- package/dist/agents/middleware/modelFallback.js +1 -1
- package/dist/agents/middleware/modelFallback.js.map +1 -1
- package/dist/agents/middleware/promptCaching.d.cts.map +1 -1
- package/dist/agents/middleware/promptCaching.d.ts.map +1 -1
- package/dist/agents/middleware/summarization.cjs +1 -1
- package/dist/agents/middleware/summarization.js +1 -1
- package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -1
- package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.cjs +30 -28
- package/dist/agents/middleware/toolCallLimit.cjs.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.js +30 -28
- package/dist/agents/middleware/toolCallLimit.js.map +1 -1
- package/dist/agents/middleware/types.d.cts +165 -19
- package/dist/agents/middleware/types.d.cts.map +1 -1
- package/dist/agents/middleware/types.d.ts +165 -19
- package/dist/agents/middleware/types.d.ts.map +1 -1
- package/dist/agents/middleware/utils.cjs +10 -0
- package/dist/agents/middleware/utils.cjs.map +1 -1
- package/dist/agents/middleware/utils.d.cts.map +1 -1
- package/dist/agents/middleware/utils.d.ts.map +1 -1
- package/dist/agents/middleware/utils.js +9 -1
- package/dist/agents/middleware/utils.js.map +1 -1
- package/dist/agents/middleware.cjs +6 -10
- package/dist/agents/middleware.cjs.map +1 -1
- package/dist/agents/middleware.d.cts +12 -32
- package/dist/agents/middleware.d.cts.map +1 -1
- package/dist/agents/middleware.d.ts +12 -32
- package/dist/agents/middleware.d.ts.map +1 -1
- package/dist/agents/middleware.js +6 -10
- package/dist/agents/middleware.js.map +1 -1
- package/dist/agents/nodes/AfterAgentNode.cjs +3 -1
- package/dist/agents/nodes/AfterAgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AfterAgentNode.js +3 -1
- package/dist/agents/nodes/AfterAgentNode.js.map +1 -1
- package/dist/agents/nodes/AfterModelNode.cjs +3 -1
- package/dist/agents/nodes/AfterModelNode.cjs.map +1 -1
- package/dist/agents/nodes/AfterModelNode.js +3 -1
- package/dist/agents/nodes/AfterModelNode.js.map +1 -1
- package/dist/agents/nodes/AgentNode.cjs +1 -0
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +1 -0
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/nodes/BeforeAgentNode.cjs +3 -1
- package/dist/agents/nodes/BeforeAgentNode.cjs.map +1 -1
- package/dist/agents/nodes/BeforeAgentNode.js +3 -1
- package/dist/agents/nodes/BeforeAgentNode.js.map +1 -1
- package/dist/agents/nodes/BeforeModelNode.cjs +3 -1
- package/dist/agents/nodes/BeforeModelNode.cjs.map +1 -1
- package/dist/agents/nodes/BeforeModelNode.js +3 -1
- package/dist/agents/nodes/BeforeModelNode.js.map +1 -1
- package/dist/agents/nodes/ToolNode.cjs +37 -36
- package/dist/agents/nodes/ToolNode.cjs.map +1 -1
- package/dist/agents/nodes/ToolNode.js +37 -36
- package/dist/agents/nodes/ToolNode.js.map +1 -1
- package/dist/agents/nodes/middleware.cjs +10 -9
- package/dist/agents/nodes/middleware.cjs.map +1 -1
- package/dist/agents/nodes/middleware.js +10 -9
- package/dist/agents/nodes/middleware.js.map +1 -1
- package/dist/agents/nodes/types.d.cts +15 -0
- package/dist/agents/nodes/types.d.cts.map +1 -1
- package/dist/agents/nodes/types.d.ts +15 -0
- package/dist/agents/nodes/types.d.ts.map +1 -1
- package/dist/agents/types.d.cts +48 -3
- package/dist/agents/types.d.cts.map +1 -1
- package/dist/agents/types.d.ts +48 -3
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/utils.cjs +4 -4
- package/dist/agents/utils.cjs.map +1 -1
- package/dist/agents/utils.js +4 -4
- package/dist/agents/utils.js.map +1 -1
- package/dist/chat_models/universal.cjs +2 -1
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.js +2 -1
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/hub/base.cjs +4 -17
- package/dist/hub/base.cjs.map +1 -1
- package/dist/hub/base.js +2 -15
- package/dist/hub/base.js.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/load/import_map.cjs +1 -5
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +1 -5
- package/dist/load/import_map.js.map +1 -1
- package/package.json +32 -54
- package/dist/embeddings/cache_backed.cjs +0 -140
- package/dist/embeddings/cache_backed.cjs.map +0 -1
- package/dist/embeddings/cache_backed.d.cts +0 -107
- package/dist/embeddings/cache_backed.d.cts.map +0 -1
- package/dist/embeddings/cache_backed.d.ts +0 -107
- package/dist/embeddings/cache_backed.d.ts.map +0 -1
- package/dist/embeddings/cache_backed.js +0 -134
- package/dist/embeddings/cache_backed.js.map +0 -1
- package/dist/embeddings/fake.cjs +0 -22
- package/dist/embeddings/fake.cjs.map +0 -1
- package/dist/embeddings/fake.d.cts +0 -1
- package/dist/embeddings/fake.d.ts +0 -1
- package/dist/embeddings/fake.js +0 -12
- package/dist/embeddings/fake.js.map +0 -1
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs +0 -248
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js +0 -244
- package/dist/node_modules/.pnpm/eventemitter3@4.0.7/node_modules/eventemitter3/index.js.map +0 -1
- 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 +0 -3096
- 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 +0 -1
- 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 +0 -3095
- 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 +0 -1
- 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/env.cjs +0 -12
- 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/env.cjs.map +0 -1
- 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/env.js +0 -12
- 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/env.js.map +0 -1
- 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/experimental/otel/constants.cjs +0 -71
- 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/experimental/otel/constants.cjs.map +0 -1
- 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/experimental/otel/constants.js +0 -38
- 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/experimental/otel/constants.js.map +0 -1
- 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/experimental/otel/translator.cjs +0 -221
- 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/experimental/otel/translator.cjs.map +0 -1
- 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/experimental/otel/translator.js +0 -221
- 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/experimental/otel/translator.js.map +0 -1
- 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/index.cjs +0 -11
- 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/index.cjs.map +0 -1
- 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/index.js +0 -11
- 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/index.js.map +0 -1
- 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 +0 -703
- 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 +0 -1
- 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 +0 -702
- 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 +0 -1
- 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/singletons/constants.cjs +0 -7
- 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/singletons/constants.cjs.map +0 -1
- 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/singletons/constants.js +0 -6
- 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/singletons/constants.js.map +0 -1
- 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/singletons/fetch.cjs +0 -29
- 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/singletons/fetch.cjs.map +0 -1
- 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/singletons/fetch.js +0 -28
- 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/singletons/fetch.js.map +0 -1
- 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/singletons/otel.cjs +0 -115
- 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/singletons/otel.cjs.map +0 -1
- 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/singletons/otel.js +0 -113
- 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/singletons/otel.js.map +0 -1
- 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/_uuid.cjs +0 -14
- 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/_uuid.cjs.map +0 -1
- 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/_uuid.js +0 -13
- 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/_uuid.js.map +0 -1
- 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/async_caller.cjs +0 -95
- 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/async_caller.cjs.map +0 -1
- 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/async_caller.js +0 -95
- 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/async_caller.js.map +0 -1
- 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 +0 -136
- 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 +0 -1
- 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 +0 -131
- 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 +0 -1
- 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 +0 -102
- 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 +0 -1
- 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 +0 -99
- 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 +0 -1
- 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/fast-safe-stringify/index.cjs +0 -140
- 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/fast-safe-stringify/index.cjs.map +0 -1
- 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/fast-safe-stringify/index.js +0 -140
- 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/fast-safe-stringify/index.js.map +0 -1
- 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/messages.cjs +0 -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/utils/messages.cjs.map +0 -1
- 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/messages.js +0 -16
- 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/messages.js.map +0 -1
- 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/project.cjs +0 -10
- 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/project.cjs.map +0 -1
- 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/project.js +0 -10
- 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/project.js.map +0 -1
- 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/prompts.cjs +0 -30
- 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/prompts.cjs.map +0 -1
- 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/prompts.js +0 -30
- 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/prompts.js.map +0 -1
- 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/warn.cjs +0 -13
- 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/warn.cjs.map +0 -1
- 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/warn.js +0 -12
- 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/warn.js.map +0 -1
- 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/index.cjs +0 -6
- 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/index.js +0 -6
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs +0 -27
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js +0 -23
- package/dist/node_modules/.pnpm/p-finally@1.0.0/node_modules/p-finally/index.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs +0 -267
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js +0 -263
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/index.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs +0 -32
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js +0 -28
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/lower-bound.js.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs +0 -49
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js +0 -45
- package/dist/node_modules/.pnpm/p-queue@6.6.2/node_modules/p-queue/dist/priority-queue.js.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs +0 -83
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js +0 -79
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js.map +0 -1
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs +0 -52
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js +0 -48
- package/dist/node_modules/.pnpm/p-timeout@3.2.0/node_modules/p-timeout/index.js.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs +0 -16
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js +0 -13
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs +0 -77
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js +0 -74
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs +0 -115
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs.map +0 -1
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js +0 -112
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs +0 -90
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js +0 -86
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/comparator.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs +0 -294
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js +0 -290
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/range.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs +0 -191
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js +0 -187
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/classes/semver.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs +0 -24
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js +0 -20
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/clean.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs +0 -51
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js +0 -47
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/cmp.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs +0 -48
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js +0 -44
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/coerce.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-build.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare-loose.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/compare.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs +0 -43
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js +0 -39
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/diff.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/eq.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gt.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/gte.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs +0 -32
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js +0 -28
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/inc.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lt.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/lte.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/major.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/minor.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/neq.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs +0 -29
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/parse.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/patch.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs +0 -24
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js +0 -20
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/prerelease.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rcompare.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/rsort.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs +0 -28
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js +0 -24
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/satisfies.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/sort.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs +0 -24
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js +0 -20
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/functions/valid.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs +0 -146
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js +0 -142
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/index.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs +0 -41
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js +0 -37
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/constants.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs +0 -19
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js +0 -15
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/debug.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs +0 -32
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js +0 -28
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/identifiers.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs +0 -47
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js +0 -43
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/lrucache.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/parse-options.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs +0 -94
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js +0 -90
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/internal/re.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/gtr.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs +0 -25
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/intersects.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/ltr.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs +0 -41
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js +0 -37
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/max-satisfying.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs +0 -41
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js +0 -37
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-satisfying.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs +0 -55
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js +0 -51
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/min-version.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs +0 -74
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js +0 -70
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/outside.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs +0 -48
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js +0 -44
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/simplify.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs +0 -112
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js +0 -108
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/subset.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs +0 -21
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js +0 -17
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/to-comparators.js.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs +0 -27
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.cjs.map +0 -1
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js +0 -23
- package/dist/node_modules/.pnpm/semver@7.7.2/node_modules/semver/ranges/valid.js.map +0 -1
package/dist/agents/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { MultipleStructuredOutputsError, MultipleToolsBoundError, StructuredOutp
|
|
|
2
2
|
import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.cjs";
|
|
3
3
|
import { JumpToTarget } from "./constants.cjs";
|
|
4
4
|
import { Runtime } from "./runtime.cjs";
|
|
5
|
-
import { AgentMiddleware, AnyAnnotationRoot, ToolCallHandler, ToolCallRequest,
|
|
5
|
+
import { AgentMiddleware, AnyAnnotationRoot, ToolCallHandler, ToolCallRequest, WrapToolCallHook } from "./middleware/types.cjs";
|
|
6
6
|
import { BuiltInState, CreateAgentParams, ExecutedToolCall, ExtractZodArrayTypes, Interrupt, JumpTo, N, ToolCall, ToolResult, UserInput, WithStateGraphNodes } from "./types.cjs";
|
|
7
7
|
import { ReactAgent } from "./ReactAgent.cjs";
|
|
8
8
|
import { createMiddleware } from "./middleware.cjs";
|
|
@@ -131,59 +131,59 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
|
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
133
133
|
// Overload 1: With responseFormat as single InteropZodType
|
|
134
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {
|
|
134
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
|
|
135
135
|
responseFormat: InteropZodType<T>;
|
|
136
136
|
middleware?: TMiddleware;
|
|
137
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
137
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
138
138
|
// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
|
|
139
|
-
declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
|
|
139
|
+
declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
|
|
140
140
|
responseFormat: T;
|
|
141
141
|
middleware?: TMiddleware;
|
|
142
|
-
}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;
|
|
142
|
+
}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
|
|
143
143
|
// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
|
|
144
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
|
|
144
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
|
|
145
145
|
responseFormat: JsonSchemaFormat;
|
|
146
146
|
middleware?: TMiddleware;
|
|
147
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
147
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
148
148
|
// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
|
|
149
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
|
|
149
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
|
|
150
150
|
responseFormat: JsonSchemaFormat[];
|
|
151
151
|
middleware?: TMiddleware;
|
|
152
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
152
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
153
153
|
// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
|
|
154
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
|
|
154
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
|
|
155
155
|
responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
|
|
156
156
|
middleware?: TMiddleware;
|
|
157
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
157
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
158
158
|
// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
|
|
159
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {
|
|
159
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
|
|
160
160
|
responseFormat: TypedToolStrategy<T>;
|
|
161
161
|
middleware?: TMiddleware;
|
|
162
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
162
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
163
163
|
// Overload 6: With responseFormat as single ToolStrategy instance
|
|
164
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {
|
|
164
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
|
|
165
165
|
responseFormat: ToolStrategy<T>;
|
|
166
166
|
middleware?: TMiddleware;
|
|
167
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
167
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
168
168
|
// Overload 7: With responseFormat as ProviderStrategy
|
|
169
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {
|
|
169
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
|
|
170
170
|
responseFormat: ProviderStrategy<T>;
|
|
171
171
|
middleware?: TMiddleware;
|
|
172
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
172
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
173
173
|
// Overload 8: Without responseFormat property at all - with proper middleware state typing
|
|
174
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
|
|
174
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
|
|
175
175
|
middleware?: TMiddleware;
|
|
176
|
-
}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
|
|
176
|
+
}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
|
|
177
177
|
// Overload 9: With responseFormat explicitly undefined
|
|
178
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
|
|
178
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
|
|
179
179
|
responseFormat?: undefined;
|
|
180
180
|
middleware?: TMiddleware;
|
|
181
|
-
}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
|
|
181
|
+
}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
|
|
182
182
|
// Overload 10: For other ResponseFormat values (failsafe)
|
|
183
|
-
declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, ContextSchema, ResponseFormat> & {
|
|
183
|
+
declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
|
|
184
184
|
responseFormat: ResponseFormat;
|
|
185
185
|
middleware?: TMiddleware;
|
|
186
|
-
}): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;
|
|
186
|
+
}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;
|
|
187
187
|
// Re-export types and utilities
|
|
188
188
|
|
|
189
189
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","Record","T","ContextSchema","TMiddleware","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","ToolCallRequest","ToolCallHandler","ToolCallWrapper","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type { ToolCallRequest, ToolCallHandler, ToolCallWrapper, } from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgIA;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;AAAgRe,iBAzBxPF,WAyBwPE,CAAAA,UAzBlOD,MAyBkOC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAzB5MD,MAyB4MC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAzBjKV,iBAyBiKU,GAzB7If,gBAyB6Ie,GAzB1HV,iBAyB0HU,EAAAA,oBAAAA,SAzB1EX,eAyB0EW,EAAAA,GAAAA,SAzB7CX,eAyB6CW,EAAAA,CAAAA,CAAAA,MAAAA,EAzBlBZ,iBAyBkBY,CAzBAA,CAyBAA,EAzBGC,aAyBHD,EAzBkBd,cAyBlBc,CAzBiCA,CAyBjCA,CAAAA,CAAAA,GAAAA;EAAC,cAAEC,EAxB/Pf,cAwB+Pe,CAxBhPD,CAwBgPC,CAAAA;EAAa,UAAoBD,CAAAA,EAvBnSE,WAuBmSF;CAAC,CAAA,EAtBjTH,UAsB8RJ,CAtBnRO,CAsBmRP,EAtBhRQ,aAsBgRR,EAtBjQS,WAsBiQT,CAAAA;;AAC5PO,iBArBdF,WAqBcE,CAAAA,UAAAA,SArBiBd,cAqBjBc,CAAAA,GAAAA,CAAAA,EAAAA,EAAAA,sBArB8DV,iBAqB9DU,GArBkFf,gBAqBlFe,GArBqGV,iB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MAbtDC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAaiGV,iBAbjGU,GAaqHf,gBAbrHe,GAawIV,iBAbxIU,EAAAA,oBAAAA,SAawLX,eAbxLW,EAAAA,GAAAA,SAaqNX,eAbrNW,EAAAA,CAAAA,CAAAA,MAAAA,EAagPZ,iBAbhPY,CAakQI,wBAblQJ,EAa4RC,aAb5RD,EAa2SL,cAb3SK,CAAAA,GAAAA;EAAC,cAAlBN,EAcAC,cAdAD;EAAgB,UACnBQ,CAAAA,EAcAA,WAdAA;CAAW,CAAA,EAexBL,UAdWG,CAcAI,wBAdAJ,EAc0BC,aAd1BD,EAcyCE,WAdzCF,CAAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","Record","T","StateSchema","ContextSchema","TMiddleware","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","ToolCallRequest","ToolCallHandler","WrapToolCallHook","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type { ToolCallRequest, ToolCallHandler, WrapToolCallHook, } from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgIA;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA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AAC,CAAA,EAsBjZH,UAtBmYL,CAsBxXa,wBAtBwXb,EAsB9VS,WAtB8VT,EAsBjVU,aAtBiVV,EAsBlUW,WAtBkUX,CAAAA"}
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { MultipleStructuredOutputsError, MultipleToolsBoundError, StructuredOutp
|
|
|
2
2
|
import { JsonSchemaFormat, ProviderStrategy, ResponseFormat, ResponseFormatUndefined, ToolStrategy, TypedToolStrategy, providerStrategy, toolStrategy } from "./responses.js";
|
|
3
3
|
import { JumpToTarget } from "./constants.js";
|
|
4
4
|
import { Runtime } from "./runtime.js";
|
|
5
|
-
import { AgentMiddleware, AnyAnnotationRoot, ToolCallHandler, ToolCallRequest,
|
|
5
|
+
import { AgentMiddleware, AnyAnnotationRoot, ToolCallHandler, ToolCallRequest, WrapToolCallHook } from "./middleware/types.js";
|
|
6
6
|
import { BuiltInState, CreateAgentParams, ExecutedToolCall, ExtractZodArrayTypes, Interrupt, JumpTo, N, ToolCall, ToolResult, UserInput, WithStateGraphNodes } from "./types.js";
|
|
7
7
|
import { ReactAgent } from "./ReactAgent.js";
|
|
8
8
|
import { createMiddleware } from "./middleware.js";
|
|
@@ -131,59 +131,59 @@ import { InteropZodObject, InteropZodType } from "@langchain/core/utils/types";
|
|
|
131
131
|
* ```
|
|
132
132
|
*/
|
|
133
133
|
// Overload 1: With responseFormat as single InteropZodType
|
|
134
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {
|
|
134
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {
|
|
135
135
|
responseFormat: InteropZodType<T>;
|
|
136
136
|
middleware?: TMiddleware;
|
|
137
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
137
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
138
138
|
// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)
|
|
139
|
-
declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {
|
|
139
|
+
declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {
|
|
140
140
|
responseFormat: T;
|
|
141
141
|
middleware?: TMiddleware;
|
|
142
|
-
}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;
|
|
142
|
+
}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;
|
|
143
143
|
// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)
|
|
144
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {
|
|
144
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {
|
|
145
145
|
responseFormat: JsonSchemaFormat;
|
|
146
146
|
middleware?: TMiddleware;
|
|
147
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
147
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
148
148
|
// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)
|
|
149
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {
|
|
149
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {
|
|
150
150
|
responseFormat: JsonSchemaFormat[];
|
|
151
151
|
middleware?: TMiddleware;
|
|
152
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
152
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
153
153
|
// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]
|
|
154
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
|
|
154
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {
|
|
155
155
|
responseFormat: JsonSchemaFormat | JsonSchemaFormat[];
|
|
156
156
|
middleware?: TMiddleware;
|
|
157
|
-
}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;
|
|
157
|
+
}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;
|
|
158
158
|
// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)
|
|
159
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {
|
|
159
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {
|
|
160
160
|
responseFormat: TypedToolStrategy<T>;
|
|
161
161
|
middleware?: TMiddleware;
|
|
162
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
162
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
163
163
|
// Overload 6: With responseFormat as single ToolStrategy instance
|
|
164
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {
|
|
164
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {
|
|
165
165
|
responseFormat: ToolStrategy<T>;
|
|
166
166
|
middleware?: TMiddleware;
|
|
167
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
167
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
168
168
|
// Overload 7: With responseFormat as ProviderStrategy
|
|
169
|
-
declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {
|
|
169
|
+
declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {
|
|
170
170
|
responseFormat: ProviderStrategy<T>;
|
|
171
171
|
middleware?: TMiddleware;
|
|
172
|
-
}): ReactAgent<T, ContextSchema, TMiddleware>;
|
|
172
|
+
}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;
|
|
173
173
|
// Overload 8: Without responseFormat property at all - with proper middleware state typing
|
|
174
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
|
|
174
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
|
|
175
175
|
middleware?: TMiddleware;
|
|
176
|
-
}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
|
|
176
|
+
}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
|
|
177
177
|
// Overload 9: With responseFormat explicitly undefined
|
|
178
|
-
declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, "responseFormat"> & {
|
|
178
|
+
declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, "responseFormat"> & {
|
|
179
179
|
responseFormat?: undefined;
|
|
180
180
|
middleware?: TMiddleware;
|
|
181
|
-
}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;
|
|
181
|
+
}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;
|
|
182
182
|
// Overload 10: For other ResponseFormat values (failsafe)
|
|
183
|
-
declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, ContextSchema, ResponseFormat> & {
|
|
183
|
+
declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
|
|
184
184
|
responseFormat: ResponseFormat;
|
|
185
185
|
middleware?: TMiddleware;
|
|
186
|
-
}): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;
|
|
186
|
+
}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;
|
|
187
187
|
// Re-export types and utilities
|
|
188
188
|
|
|
189
189
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","Record","T","ContextSchema","TMiddleware","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","ToolCallRequest","ToolCallHandler","ToolCallWrapper","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createAgent<T extends readonly InteropZodType<any>[], ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, ContextSchema, TMiddleware>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, ContextSchema, TMiddleware>;\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createAgent<ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type { ToolCallRequest, ToolCallHandler, ToolCallWrapper, } from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgIA;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;AAAgRe,iBAzBxPF,WAyBwPE,CAAAA,UAzBlOD,MAyBkOC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAzB5MD,MAyB4MC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAzBjKV,iBAyBiKU,GAzB7If,gBAyB6Ie,GAzB1HV,iBAyB0HU,EAAAA,oBAAAA,SAzB1EX,eAyB0EW,EAAAA,GAAAA,SAzB7CX,eAyB6CW,EAAAA,CAAAA,CAAAA,MAAAA,EAzBlBZ,iBAyBkBY,CAzBAA,CAyBAA,EAzBGC,aAyBHD,EAzBkBd,cAyBlBc,CAzBiCA,CAyBjCA,CAAAA,CAAAA,GAAAA;EAAC,cAAEC,EAxB/Pf,c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vBC,aATuBD,EAAAA,KAAAA,CAAAA,EAAAA,gBAAAA,CAAAA,GAAAA;EAAC,cAAEC,CAAAA,EAAAA,SAAAA;EAAa,UAAmBD,CAAAA,EAWlSE,WAXkSF;CAAC,CAAA,EAYhTH,UAZ8RH,CAYnRP,uBAZmRO,EAY1PO,aAZ0PP,EAY3OQ,WAZ2OR,CAAAA;;AAC7PM,iBAabF,WAbaE,CAAAA,iCAagCD,MAbhCC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GAasDD,MAbtDC,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,sBAaiGV,iBAbjGU,GAaqHf,gBAbrHe,GAawIV,iBAbxIU,EAAAA,oBAAAA,SAawLX,eAbxLW,EAAAA,GAAAA,SAaqNX,eAbrNW,EAAAA,CAAAA,CAAAA,MAAAA,EAagPZ,iBAbhPY,CAakQI,wBAblQJ,EAa4RC,aAb5RD,EAa2SL,cAb3SK,CAAAA,GAAAA;EAAC,cAAlBN,EAcAC,cAdAD;EAAgB,UACnBQ,CAAAA,EAcAA,WAdAA;CAAW,CAAA,EAexBL,UAdWG,CAcAI,wBAdAJ,EAc0BC,aAd1BD,EAcyCE,WAdzCF,CAAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["InteropZodObject","InteropZodType","ResponseFormatUndefined","CreateAgentParams","AgentMiddleware","AnyAnnotationRoot","ExtractZodArrayTypes","ToolStrategy","TypedToolStrategy","ProviderStrategy","ResponseFormat","JsonSchemaFormat","ReactAgent","createAgent","Record","T","StateSchema","ContextSchema","TMiddleware","Omit","StructuredResponseFormat","JumpToTarget","Runtime","toolStrategy","providerStrategy","createMiddleware","ToolCallRequest","ToolCallHandler","WrapToolCallHook","FakeToolCallingModel"],"sources":["../../src/agents/index.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type { ToolStrategy, TypedToolStrategy, ProviderStrategy, ResponseFormat, JsonSchemaFormat } from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport declare function createAgent<T extends readonly InteropZodType<any>[], StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, T> & {\n responseFormat: T;\n middleware?: TMiddleware;\n}): ReactAgent<ExtractZodArrayTypes<T> extends Record<string, any> ? ExtractZodArrayTypes<T> : Record<string, any>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat> & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<Record<string, unknown>, StateSchema, ContextSchema, JsonSchemaFormat | JsonSchemaFormat[]> & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n}): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 7: With responseFormat as ProviderStrategy\nexport declare function createAgent<T extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<T, StateSchema, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n}): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n// Overload 9: With responseFormat explicitly undefined\nexport declare function createAgent<StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: Omit<CreateAgentParams<ResponseFormatUndefined, StateSchema, ContextSchema, never>, \"responseFormat\"> & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n}): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n// Overload 10: For other ResponseFormat values (failsafe)\nexport declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n}): ReactAgent<StructuredResponseFormat, StateSchema, ContextSchema, TMiddleware>;\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport { toolStrategy, providerStrategy, ToolStrategy, ProviderStrategy, type ResponseFormat, type ResponseFormatUndefined, } from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type { ToolCallRequest, ToolCallHandler, WrapToolCallHook, } from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;AAgIA;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;;;;;;;;;AAGc;AAEd;;;;;;;;;;;;;AAA2XW,iBApBnWE,WAoBmWF,CAAAA,UApB7UG,MAoB6UH,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,GApBvTG,MAoBuTH,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,oBApB9QN,iBAoB8QM,GApB1PX,gBAoB0PW,GAAAA,SAAAA,GAAAA,SAAAA,EAAAA,sBApB1LN,iBAoB0LM,GApBtKX,gBAoBsKW,GApBnJN,iBAoBmJM,EAAAA,0BAAAA,SApB7FP,eAoB6FO,EAAAA,GAAAA,SApBhEP,eAoBgEO,EAAAA,CAAAA,CAAAA,MAAAA,EApBrCR,iBAoBqCQ,CApBnBI,CAoBmBJ,EApBhBK,WAoBgBL,EApBHM,aAoBGN,EApBYV,cAoBZU,CApB2BI,CAoB3BJ,CAAAA,CAAAA,GAAAA;EAAgB,cAA1GR,EAnB7QF,cAmB6QE,CAnB9PY,CAmB8PZ,CAAAA;EAAiB,UAC9RQ,CAAAA,EAnBHO,WAmBGP;CAAgB,CAAA,EAlBhCC,UAkBmCD,CAlBxBI,CAkBwBJ,EAlBrBK,WAkBqBL,EAlBRM,aAkBQN,EAlBOO,WAkBPP,CAAAA;;AAExBG,iBAlBSD,WAkBTC,CAAAA,UAAAA,SAlBwCb,cAkBxCa,CAAAA,GAAAA,CAAAA,EAAAA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B/HhB,gBAnB+HgB,GAmB5GX,iBAnB4GW,EAAAA,0BAAAA,SAmBtDZ,eAnBsDY,EAAAA,GAAAA,SAmBzBZ,eAnByBY,EAAAA,CAAAA,CAAAA,MAAAA,EAmBEb,iBAnBFa,CAmBoBI,wBAnBpBJ,EAmB8CA,WAnB9CA,EAmB2DC,aAnB3DD,EAmB0EN,cAnB1EM,CAAAA,GAAAA;EAAW,cAAEC,EAoBpWP,cApBoWO;EAAa,UAAeF,CAAAA,EAqBnYG,WArBmYH;CAAC,CAAA,EAsBjZH,UAtBmYL,CAsBxXa,wBAtBwXb,EAsB9VS,WAtB8VT,EAsBjVU,aAtBiVV,EAsBlUW,WAtBkUX,CAAAA"}
|
package/dist/agents/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["params: CreateAgentParams<StructuredResponseFormat, ContextSchema, any>"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, InteropZodType<T>> & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n T\n > & {\n responseFormat: T;\n middleware?: TMiddleware;\n }\n): ReactAgent<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n ContextSchema,\n TMiddleware\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, ContextSchema, TMiddleware>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, TypedToolStrategy<T>> & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, ContextSchema, ProviderStrategy<T>> & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, ContextSchema, TMiddleware>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & { middleware?: TMiddleware }\n): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<ResponseFormatUndefined, ContextSchema, never>,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n }\n): ReactAgent<ResponseFormatUndefined, ContextSchema, TMiddleware>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = []\n>(\n params: CreateAgentParams<StructuredResponseFormat, ContextSchema, any>\n): ReactAgent<StructuredResponseFormat, ContextSchema, TMiddleware> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type {\n ToolCallRequest,\n ToolCallHandler,\n ToolCallWrapper,\n} from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;AA+TA,SAAgB,YAKdA,QACkE;AAClE,QAAO,IAAI,WAAW;AACvB"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["params: CreateAgentParams<\n StructuredResponseFormat,\n StateSchema,\n ContextSchema,\n any\n >"],"sources":["../../src/agents/index.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodType,\n} from \"@langchain/core/utils/types\";\n\nimport type { ResponseFormatUndefined } from \"./responses.js\";\nimport type { CreateAgentParams } from \"./types.js\";\nimport type { AgentMiddleware, AnyAnnotationRoot } from \"./middleware/types.js\";\nimport type { ExtractZodArrayTypes } from \"./types.js\";\nimport type {\n ToolStrategy,\n TypedToolStrategy,\n ProviderStrategy,\n ResponseFormat,\n JsonSchemaFormat,\n} from \"./responses.js\";\nimport { ReactAgent } from \"./ReactAgent.js\";\n\n/**\n * Creates a production-ready ReAct (Reasoning + Acting) agent that combines language models with tools\n * and middleware to create systems that can reason about tasks, decide which tools to use, and iteratively\n * work towards solutions.\n *\n * The agent follows the ReAct pattern, interleaving reasoning steps with tool calls to iteratively\n * work towards solutions. It can handle multiple tool calls in sequence or parallel, maintain state\n * across interactions, and provide auditable decision processes.\n *\n * ## Core Components\n *\n * ### Model\n * The reasoning engine can be specified as:\n * - **String identifier**: `\"openai:gpt-4o\"` for simple setup\n * - **Model instance**: Configured model object for full control\n * - **Dynamic function**: Select models at runtime based on state\n *\n * ### Tools\n * Tools give agents the ability to take actions:\n * - Pass an array of tools created with the `tool` function\n * - Or provide a configured `ToolNode` for custom error handling\n *\n * ### Prompt\n * Shape how your agent approaches tasks:\n * - String for simple instructions\n * - SystemMessage for structured prompts\n * - Function for dynamic prompts based on state\n *\n * ### Middleware\n * Middleware allows you to extend the agent's behavior:\n * - Add pre/post-model processing for context injection or validation\n * - Add dynamic control flows, e.g. terminate invocation or retries\n * - Add human-in-the-loop capabilities\n * - Add tool calls to the agent\n * - Add tool results to the agent\n *\n * ## Advanced Features\n *\n * - **Structured Output**: Use `responseFormat` with a Zod schema to get typed responses\n * - **Memory**: Extend the state schema to remember information across interactions\n * - **Streaming**: Get real-time updates as the agent processes\n *\n * @param options - Configuration options for the agent\n * @param options.llm - The language model as an instance of a chat model\n * @param options.model - The language model as a string identifier, see more in {@link https://docs.langchain.com/oss/javascript/langchain/models#basic-usage | Models}.\n * @param options.tools - Array of tools or configured ToolNode\n * @param options.prompt - System instructions (string, SystemMessage, or function)\n * @param options.responseFormat - Zod schema for structured output\n * @param options.stateSchema - Custom state schema for memory\n * @param options.middleware - Array of middleware for extending agent behavior, see more in {@link https://docs.langchain.com/oss/javascript/langchain/middleware | Middleware}.\n *\n * @returns A ReactAgent instance with `invoke` and `stream` methods\n *\n * @example Basic agent with tools\n * ```ts\n * import { createAgent, tool } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const search = tool(\n * ({ query }) => `Results for: ${query}`,\n * {\n * name: \"search\",\n * description: \"Search for information\",\n * schema: z.object({\n * query: z.string().describe(\"The search query\"),\n * })\n * }\n * );\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [search],\n * });\n *\n * const result = await agent.invoke({\n * messages: [{ role: \"user\", content: \"Search for ReAct agents\" }],\n * });\n * ```\n *\n * @example Structured output\n * ```ts\n * import { createAgent } from \"langchain\";\n * import { z } from \"zod\";\n *\n * const ContactInfo = z.object({\n * name: z.string(),\n * email: z.string(),\n * phone: z.string(),\n * });\n *\n * const agent = createAgent({\n * llm: \"openai:gpt-4o\",\n * tools: [],\n * responseFormat: ContactInfo,\n * });\n *\n * const result = await agent.invoke({\n * messages: [{\n * role: \"user\",\n * content: \"Extract: John Doe, john@example.com, (555) 123-4567\"\n * }],\n * });\n *\n * console.log(result.structuredResponse);\n * // { name: 'John Doe', email: 'john@example.com', phone: '(555) 123-4567' }\n * ```\n *\n * @example Streaming responses\n * ```ts\n * const stream = await agent.stream(\n * { messages: [{ role: \"user\", content: \"What's the weather?\" }] },\n * { streamMode: \"values\" }\n * );\n *\n * for await (const chunk of stream) {\n * // ...\n * }\n * ```\n */\n// Overload 1: With responseFormat as single InteropZodType\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n T,\n StateSchema,\n ContextSchema,\n InteropZodType<T>\n > & {\n responseFormat: InteropZodType<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 2: With responseFormat as array of InteropZodTypes (infers union type)\nexport function createAgent<\n T extends readonly InteropZodType<any>[],\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n StateSchema,\n ContextSchema,\n T\n > & {\n responseFormat: T;\n middleware?: TMiddleware;\n }\n): ReactAgent<\n ExtractZodArrayTypes<T> extends Record<string, any>\n ? ExtractZodArrayTypes<T>\n : Record<string, any>,\n StateSchema,\n ContextSchema,\n TMiddleware\n>;\n\n// Overload 3: With responseFormat as JsonSchemaFormat (JSON schema object)\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n StateSchema,\n ContextSchema,\n JsonSchemaFormat\n > & {\n responseFormat: JsonSchemaFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 4: With responseFormat as array of JsonSchemaFormat (JSON schema objects)\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n StateSchema,\n ContextSchema,\n JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 4.5: With responseFormat as union of JsonSchemaFormat | JsonSchemaFormat[]\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n Record<string, unknown>,\n StateSchema,\n ContextSchema,\n JsonSchemaFormat | JsonSchemaFormat[]\n > & {\n responseFormat: JsonSchemaFormat | JsonSchemaFormat[];\n middleware?: TMiddleware;\n }\n): ReactAgent<Record<string, unknown>, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 5: With responseFormat as TypedToolStrategy (for union types from toolStrategy)\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n T,\n StateSchema,\n ContextSchema,\n TypedToolStrategy<T>\n > & {\n responseFormat: TypedToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 6: With responseFormat as single ToolStrategy instance\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<T, StateSchema, ContextSchema, ToolStrategy<T>> & {\n responseFormat: ToolStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 7: With responseFormat as ProviderStrategy\nexport function createAgent<\n T extends Record<string, any> = Record<string, any>,\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n T,\n StateSchema,\n ContextSchema,\n ProviderStrategy<T>\n > & {\n responseFormat: ProviderStrategy<T>;\n middleware?: TMiddleware;\n }\n): ReactAgent<T, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 8: Without responseFormat property at all - with proper middleware state typing\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n StateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & { middleware?: TMiddleware }\n): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 9: With responseFormat explicitly undefined\nexport function createAgent<\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: Omit<\n CreateAgentParams<\n ResponseFormatUndefined,\n StateSchema,\n ContextSchema,\n never\n >,\n \"responseFormat\"\n > & {\n responseFormat?: undefined;\n middleware?: TMiddleware;\n }\n): ReactAgent<ResponseFormatUndefined, StateSchema, ContextSchema, TMiddleware>;\n\n// Overload 10: For other ResponseFormat values (failsafe)\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any> = Record<string, any>,\n StateSchema extends\n | AnyAnnotationRoot\n | InteropZodObject\n | undefined = undefined,\n ContextSchema extends\n | AnyAnnotationRoot\n | InteropZodObject = AnyAnnotationRoot,\n const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n StateSchema,\n ContextSchema,\n ResponseFormat\n > & {\n responseFormat: ResponseFormat;\n middleware?: TMiddleware;\n }\n): ReactAgent<\n StructuredResponseFormat,\n StateSchema,\n ContextSchema,\n TMiddleware\n>;\n\n// Implementation\nexport function createAgent<\n StructuredResponseFormat extends Record<string, any>,\n StateSchema extends AnyAnnotationRoot | InteropZodObject,\n ContextSchema extends AnyAnnotationRoot | InteropZodObject,\n TMiddleware extends readonly AgentMiddleware[] = []\n>(\n params: CreateAgentParams<\n StructuredResponseFormat,\n StateSchema,\n ContextSchema,\n any\n >\n): ReactAgent<\n StructuredResponseFormat,\n StateSchema,\n ContextSchema,\n TMiddleware\n> {\n return new ReactAgent(params);\n}\n\n// Re-export types and utilities\nexport * from \"./types.js\";\nexport * from \"./errors.js\";\nexport type { JumpToTarget } from \"./constants.js\";\nexport type { Runtime } from \"./runtime.js\";\nexport {\n toolStrategy,\n providerStrategy,\n ToolStrategy,\n ProviderStrategy,\n type ResponseFormat,\n type ResponseFormatUndefined,\n} from \"./responses.js\";\nexport { createMiddleware } from \"./middleware.js\";\nexport type {\n ToolCallRequest,\n ToolCallHandler,\n WrapToolCallHook,\n} from \"./middleware/types.js\";\nexport { FakeToolCallingModel } from \"./tests/utils.js\";\nexport type { ReactAgent } from \"./ReactAgent.js\";\n"],"mappings":";;;;;;;AA+YA,SAAgB,YAMdA,QAWA;AACA,QAAO,IAAI,WAAW;AACvB"}
|
|
@@ -91,34 +91,36 @@ function modelCallLimitMiddleware(middlewareOptions) {
|
|
|
91
91
|
return require_middleware.createMiddleware({
|
|
92
92
|
name: "ModelCallLimitMiddleware",
|
|
93
93
|
contextSchema,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
94
|
+
beforeModel: {
|
|
95
|
+
canJumpTo: ["end"],
|
|
96
|
+
hook: (state, runtime) => {
|
|
97
|
+
const exitBehavior = runtime.context.exitBehavior ?? middlewareOptions?.exitBehavior ?? DEFAULT_EXIT_BEHAVIOR;
|
|
98
|
+
const threadLimit = runtime.context.threadLimit ?? middlewareOptions?.threadLimit;
|
|
99
|
+
const runLimit = runtime.context.runLimit ?? middlewareOptions?.runLimit;
|
|
100
|
+
if (typeof threadLimit === "number" && threadLimit <= runtime.threadLevelCallCount) {
|
|
101
|
+
const error = new ModelCallLimitMiddlewareError({
|
|
102
|
+
threadLimit,
|
|
103
|
+
threadCount: runtime.threadLevelCallCount
|
|
104
|
+
});
|
|
105
|
+
if (exitBehavior === "end") return {
|
|
106
|
+
jumpTo: "end",
|
|
107
|
+
messages: [new __langchain_core_messages.AIMessage(error.message)]
|
|
108
|
+
};
|
|
109
|
+
throw error;
|
|
110
|
+
}
|
|
111
|
+
if (typeof runLimit === "number" && runLimit <= runtime.runModelCallCount) {
|
|
112
|
+
const error = new ModelCallLimitMiddlewareError({
|
|
113
|
+
runLimit,
|
|
114
|
+
runCount: runtime.runModelCallCount
|
|
115
|
+
});
|
|
116
|
+
if (exitBehavior === "end") return {
|
|
117
|
+
jumpTo: "end",
|
|
118
|
+
messages: [new __langchain_core_messages.AIMessage(error.message)]
|
|
119
|
+
};
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
return state;
|
|
109
123
|
}
|
|
110
|
-
if (typeof runLimit === "number" && runLimit <= runtime.runModelCallCount) {
|
|
111
|
-
const error = new ModelCallLimitMiddlewareError({
|
|
112
|
-
runLimit,
|
|
113
|
-
runCount: runtime.runModelCallCount
|
|
114
|
-
});
|
|
115
|
-
if (exitBehavior === "end") return {
|
|
116
|
-
jumpTo: "end",
|
|
117
|
-
messages: [new __langchain_core_messages.AIMessage(error.message)]
|
|
118
|
-
};
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
121
|
-
return state;
|
|
122
124
|
}
|
|
123
125
|
});
|
|
124
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callLimit.cjs","names":["z","exceededHint: string[]","middlewareOptions?: ModelCallLimitMiddlewareConfig","createMiddleware","AIMessage"],"sources":["../../../src/agents/middleware/callLimit.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { AIMessage } from \"@langchain/core/messages\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\n\nimport { createMiddleware } from \"../middleware.js\";\n\nconst DEFAULT_EXIT_BEHAVIOR = \"end\";\n\nconst contextSchema = z.object({\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.number().optional(),\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.number().optional(),\n /**\n * The behavior to take when the limit is exceeded.\n * - \"throw\" will throw an error and stop the agent.\n * - \"end\" will end the agent.\n * @default \"end\"\n */\n exitBehavior: z.enum([\"throw\", \"end\"]).optional(),\n});\nexport type ModelCallLimitMiddlewareConfig = Partial<\n InferInteropZodInput<typeof contextSchema>\n>;\n\n/**\n * Error thrown when the model call limit is exceeded.\n *\n * @param threadLimit - The maximum number of model calls allowed per thread.\n * @param runLimit - The maximum number of model calls allowed per run.\n * @param threadCount - The number of model calls made at the thread level.\n * @param runCount - The number of model calls made at the run level.\n */\nclass ModelCallLimitMiddlewareError extends Error {\n constructor({\n threadLimit,\n runLimit,\n threadCount,\n runCount,\n }: {\n threadLimit?: number;\n runLimit?: number;\n threadCount?: number;\n runCount?: number;\n }) {\n const exceededHint: string[] = [];\n if (typeof threadLimit === \"number\" && typeof threadCount === \"number\") {\n exceededHint.push(\n `thread level call limit reached with ${threadCount} model calls`\n );\n }\n if (typeof runLimit === \"number\" && typeof runCount === \"number\") {\n exceededHint.push(\n `run level call limit reached with ${runCount} model calls`\n );\n }\n super(\n `Model call limits exceeded${\n exceededHint.length > 0 ? `: ${exceededHint.join(\", \")}` : \"\"\n }`\n );\n this.name = \"ModelCallLimitMiddlewareError\";\n }\n}\n\n/**\n * Creates a middleware to limit the number of model calls at both thread and run levels.\n *\n * This middleware helps prevent excessive model API calls by enforcing limits on how many\n * times the model can be invoked. It supports two types of limits:\n *\n * - **Thread-level limit**: Restricts the total number of model calls across an entire conversation thread\n * - **Run-level limit**: Restricts the number of model calls within a single agent run/invocation\n *\n * ## How It Works\n *\n * The middleware intercepts model requests before they are sent and checks the current call counts\n * against the configured limits. If either limit is exceeded, it throws a `ModelCallLimitMiddlewareError`\n * to stop execution and prevent further API calls.\n *\n * ## Use Cases\n *\n * - **Cost Control**: Prevent runaway costs from excessive model calls in production\n * - **Testing**: Ensure agents don't make too many calls during development/testing\n * - **Safety**: Limit potential infinite loops or recursive agent behaviors\n * - **Rate Limiting**: Enforce organizational policies on model usage per conversation\n *\n * @param middlewareOptions - Configuration options for the call limits\n * @param middlewareOptions.threadLimit - Maximum number of model calls allowed per thread (optional)\n * @param middlewareOptions.runLimit - Maximum number of model calls allowed per run (optional)\n *\n * @returns A middleware instance that can be passed to `createAgent`\n *\n * @throws {ModelCallLimitMiddlewareError} When either the thread or run limit is exceeded\n *\n * @example\n * ```typescript\n * import { createAgent, modelCallLimitMiddleware } from \"langchain\";\n *\n * // Limit to 10 calls per thread and 3 calls per run\n * const agent = createAgent({\n * model: \"openai:gpt-4o-mini\",\n * tools: [myTool],\n * middleware: [\n * modelCallLimitMiddleware({\n * threadLimit: 10,\n * runLimit: 3\n * })\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Limits can also be configured at runtime via context\n * const result = await agent.invoke(\n * { messages: [\"Hello\"] },\n * {\n * configurable: {\n * threadLimit: 5 // Override the default limit for this run\n * }\n * }\n * );\n * ```\n */\nexport function modelCallLimitMiddleware(\n middlewareOptions?: ModelCallLimitMiddlewareConfig\n) {\n return createMiddleware({\n name: \"ModelCallLimitMiddleware\",\n contextSchema,\n
|
|
1
|
+
{"version":3,"file":"callLimit.cjs","names":["z","exceededHint: string[]","middlewareOptions?: ModelCallLimitMiddlewareConfig","createMiddleware","AIMessage"],"sources":["../../../src/agents/middleware/callLimit.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { AIMessage } from \"@langchain/core/messages\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\n\nimport { createMiddleware } from \"../middleware.js\";\n\nconst DEFAULT_EXIT_BEHAVIOR = \"end\";\n\nconst contextSchema = z.object({\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.number().optional(),\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.number().optional(),\n /**\n * The behavior to take when the limit is exceeded.\n * - \"throw\" will throw an error and stop the agent.\n * - \"end\" will end the agent.\n * @default \"end\"\n */\n exitBehavior: z.enum([\"throw\", \"end\"]).optional(),\n});\nexport type ModelCallLimitMiddlewareConfig = Partial<\n InferInteropZodInput<typeof contextSchema>\n>;\n\n/**\n * Error thrown when the model call limit is exceeded.\n *\n * @param threadLimit - The maximum number of model calls allowed per thread.\n * @param runLimit - The maximum number of model calls allowed per run.\n * @param threadCount - The number of model calls made at the thread level.\n * @param runCount - The number of model calls made at the run level.\n */\nclass ModelCallLimitMiddlewareError extends Error {\n constructor({\n threadLimit,\n runLimit,\n threadCount,\n runCount,\n }: {\n threadLimit?: number;\n runLimit?: number;\n threadCount?: number;\n runCount?: number;\n }) {\n const exceededHint: string[] = [];\n if (typeof threadLimit === \"number\" && typeof threadCount === \"number\") {\n exceededHint.push(\n `thread level call limit reached with ${threadCount} model calls`\n );\n }\n if (typeof runLimit === \"number\" && typeof runCount === \"number\") {\n exceededHint.push(\n `run level call limit reached with ${runCount} model calls`\n );\n }\n super(\n `Model call limits exceeded${\n exceededHint.length > 0 ? `: ${exceededHint.join(\", \")}` : \"\"\n }`\n );\n this.name = \"ModelCallLimitMiddlewareError\";\n }\n}\n\n/**\n * Creates a middleware to limit the number of model calls at both thread and run levels.\n *\n * This middleware helps prevent excessive model API calls by enforcing limits on how many\n * times the model can be invoked. It supports two types of limits:\n *\n * - **Thread-level limit**: Restricts the total number of model calls across an entire conversation thread\n * - **Run-level limit**: Restricts the number of model calls within a single agent run/invocation\n *\n * ## How It Works\n *\n * The middleware intercepts model requests before they are sent and checks the current call counts\n * against the configured limits. If either limit is exceeded, it throws a `ModelCallLimitMiddlewareError`\n * to stop execution and prevent further API calls.\n *\n * ## Use Cases\n *\n * - **Cost Control**: Prevent runaway costs from excessive model calls in production\n * - **Testing**: Ensure agents don't make too many calls during development/testing\n * - **Safety**: Limit potential infinite loops or recursive agent behaviors\n * - **Rate Limiting**: Enforce organizational policies on model usage per conversation\n *\n * @param middlewareOptions - Configuration options for the call limits\n * @param middlewareOptions.threadLimit - Maximum number of model calls allowed per thread (optional)\n * @param middlewareOptions.runLimit - Maximum number of model calls allowed per run (optional)\n *\n * @returns A middleware instance that can be passed to `createAgent`\n *\n * @throws {ModelCallLimitMiddlewareError} When either the thread or run limit is exceeded\n *\n * @example\n * ```typescript\n * import { createAgent, modelCallLimitMiddleware } from \"langchain\";\n *\n * // Limit to 10 calls per thread and 3 calls per run\n * const agent = createAgent({\n * model: \"openai:gpt-4o-mini\",\n * tools: [myTool],\n * middleware: [\n * modelCallLimitMiddleware({\n * threadLimit: 10,\n * runLimit: 3\n * })\n * ]\n * });\n * ```\n *\n * @example\n * ```typescript\n * // Limits can also be configured at runtime via context\n * const result = await agent.invoke(\n * { messages: [\"Hello\"] },\n * {\n * configurable: {\n * threadLimit: 5 // Override the default limit for this run\n * }\n * }\n * );\n * ```\n */\nexport function modelCallLimitMiddleware(\n middlewareOptions?: ModelCallLimitMiddlewareConfig\n) {\n return createMiddleware({\n name: \"ModelCallLimitMiddleware\",\n contextSchema,\n beforeModel: {\n canJumpTo: [\"end\"],\n hook: (state, runtime) => {\n const exitBehavior =\n runtime.context.exitBehavior ??\n middlewareOptions?.exitBehavior ??\n DEFAULT_EXIT_BEHAVIOR;\n const threadLimit =\n runtime.context.threadLimit ?? middlewareOptions?.threadLimit;\n const runLimit =\n runtime.context.runLimit ?? middlewareOptions?.runLimit;\n\n if (\n typeof threadLimit === \"number\" &&\n threadLimit <= runtime.threadLevelCallCount\n ) {\n const error = new ModelCallLimitMiddlewareError({\n threadLimit,\n threadCount: runtime.threadLevelCallCount,\n });\n if (exitBehavior === \"end\") {\n return {\n jumpTo: \"end\",\n messages: [new AIMessage(error.message)],\n };\n }\n\n throw error;\n }\n if (\n typeof runLimit === \"number\" &&\n runLimit <= runtime.runModelCallCount\n ) {\n const error = new ModelCallLimitMiddlewareError({\n runLimit,\n runCount: runtime.runModelCallCount,\n });\n if (exitBehavior === \"end\") {\n return {\n jumpTo: \"end\",\n messages: [new AIMessage(error.message)],\n };\n }\n\n throw error;\n }\n\n return state;\n },\n },\n });\n}\n"],"mappings":";;;;;;AAMA,MAAM,wBAAwB;AAE9B,MAAM,gBAAgBA,SAAE,OAAO;CAI7B,aAAaA,SAAE,QAAQ,CAAC,UAAU;CAIlC,UAAUA,SAAE,QAAQ,CAAC,UAAU;CAO/B,cAAcA,SAAE,KAAK,CAAC,SAAS,KAAM,EAAC,CAAC,UAAU;AAClD,EAAC;;;;;;;;;AAaF,IAAM,gCAAN,cAA4C,MAAM;CAChD,YAAY,EACV,aACA,UACA,aACA,UAMD,EAAE;EACD,MAAMC,eAAyB,CAAE;AACjC,MAAI,OAAO,gBAAgB,YAAY,OAAO,gBAAgB,UAC5D,aAAa,KACX,CAAC,qCAAqC,EAAE,YAAY,YAAY,CAAC,CAClE;AAEH,MAAI,OAAO,aAAa,YAAY,OAAO,aAAa,UACtD,aAAa,KACX,CAAC,kCAAkC,EAAE,SAAS,YAAY,CAAC,CAC5D;EAEH,MACE,CAAC,0BAA0B,EACzB,aAAa,SAAS,IAAI,CAAC,EAAE,EAAE,aAAa,KAAK,KAAK,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