langchain 1.0.3 → 1.0.5
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 +21 -0
- package/dist/agents/ReactAgent.cjs +15 -17
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.d.cts +3 -3
- package/dist/agents/ReactAgent.d.cts.map +1 -1
- package/dist/agents/ReactAgent.d.ts +3 -3
- package/dist/agents/ReactAgent.d.ts.map +1 -1
- package/dist/agents/ReactAgent.js +15 -17
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/annotation.cjs +6 -4
- package/dist/agents/annotation.cjs.map +1 -1
- package/dist/agents/annotation.js +7 -5
- package/dist/agents/annotation.js.map +1 -1
- package/dist/agents/middleware/contextEditing.cjs +302 -33
- package/dist/agents/middleware/contextEditing.cjs.map +1 -1
- package/dist/agents/middleware/contextEditing.d.cts +125 -41
- package/dist/agents/middleware/contextEditing.d.cts.map +1 -1
- package/dist/agents/middleware/contextEditing.d.ts +125 -41
- package/dist/agents/middleware/contextEditing.d.ts.map +1 -1
- package/dist/agents/middleware/contextEditing.js +302 -33
- package/dist/agents/middleware/contextEditing.js.map +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.d.cts.map +1 -1
- package/dist/agents/middleware/hitl.d.ts.map +1 -1
- package/dist/agents/middleware/index.cjs +2 -0
- package/dist/agents/middleware/index.js +2 -0
- package/dist/agents/middleware/modelCallLimit.cjs +6 -2
- package/dist/agents/middleware/modelCallLimit.cjs.map +1 -1
- package/dist/agents/middleware/modelCallLimit.d.cts +8 -8
- package/dist/agents/middleware/modelCallLimit.d.cts.map +1 -1
- package/dist/agents/middleware/modelCallLimit.d.ts +8 -8
- package/dist/agents/middleware/modelCallLimit.d.ts.map +1 -1
- package/dist/agents/middleware/modelCallLimit.js +6 -2
- package/dist/agents/middleware/modelCallLimit.js.map +1 -1
- package/dist/agents/middleware/modelFallback.cjs +2 -2
- package/dist/agents/middleware/modelFallback.cjs.map +1 -1
- package/dist/agents/middleware/modelFallback.d.cts +2 -2
- package/dist/agents/middleware/modelFallback.d.cts.map +1 -1
- package/dist/agents/middleware/modelFallback.d.ts +2 -2
- package/dist/agents/middleware/modelFallback.d.ts.map +1 -1
- package/dist/agents/middleware/modelFallback.js +2 -2
- package/dist/agents/middleware/modelFallback.js.map +1 -1
- package/dist/agents/middleware/pii.cjs +445 -0
- package/dist/agents/middleware/pii.cjs.map +1 -0
- package/dist/agents/middleware/pii.d.cts +216 -0
- package/dist/agents/middleware/pii.d.cts.map +1 -0
- package/dist/agents/middleware/pii.d.ts +216 -0
- package/dist/agents/middleware/pii.d.ts.map +1 -0
- package/dist/agents/middleware/pii.js +436 -0
- package/dist/agents/middleware/pii.js.map +1 -0
- package/dist/agents/middleware/piiRedaction.cjs +2 -1
- package/dist/agents/middleware/piiRedaction.cjs.map +1 -1
- package/dist/agents/middleware/piiRedaction.d.cts +4 -1
- package/dist/agents/middleware/piiRedaction.d.cts.map +1 -1
- package/dist/agents/middleware/piiRedaction.d.ts +4 -1
- package/dist/agents/middleware/piiRedaction.d.ts.map +1 -1
- package/dist/agents/middleware/piiRedaction.js +2 -1
- package/dist/agents/middleware/piiRedaction.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 +263 -52
- package/dist/agents/middleware/summarization.cjs.map +1 -1
- package/dist/agents/middleware/summarization.d.cts +384 -26
- package/dist/agents/middleware/summarization.d.cts.map +1 -1
- package/dist/agents/middleware/summarization.d.ts +384 -26
- package/dist/agents/middleware/summarization.d.ts.map +1 -1
- package/dist/agents/middleware/summarization.js +263 -55
- package/dist/agents/middleware/summarization.js.map +1 -1
- package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.cjs +36 -27
- package/dist/agents/middleware/toolCallLimit.cjs.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.cts +3 -1
- package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.d.ts +3 -1
- package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -1
- package/dist/agents/middleware/toolCallLimit.js +36 -27
- package/dist/agents/middleware/toolCallLimit.js.map +1 -1
- package/dist/agents/middleware/toolEmulator.cjs +118 -0
- package/dist/agents/middleware/toolEmulator.cjs.map +1 -0
- package/dist/agents/middleware/toolEmulator.d.cts +76 -0
- package/dist/agents/middleware/toolEmulator.d.cts.map +1 -0
- package/dist/agents/middleware/toolEmulator.d.ts +76 -0
- package/dist/agents/middleware/toolEmulator.d.ts.map +1 -0
- package/dist/agents/middleware/toolEmulator.js +117 -0
- package/dist/agents/middleware/toolEmulator.js.map +1 -0
- package/dist/agents/middleware/utils.cjs +4 -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 +4 -0
- package/dist/agents/middleware/utils.js.map +1 -1
- package/dist/agents/nodes/AgentNode.cjs +1 -5
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +2 -6
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/responses.cjs +0 -1
- package/dist/agents/responses.js +1 -1
- package/dist/agents/runtime.d.cts +5 -5
- package/dist/agents/runtime.d.cts.map +1 -1
- package/dist/agents/runtime.d.ts +5 -5
- package/dist/agents/runtime.d.ts.map +1 -1
- package/dist/index.cjs +22 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -4
- package/dist/index.d.ts +6 -4
- package/dist/index.js +13 -1
- package/dist/index.js.map +1 -1
- package/package.json +10 -9
- package/dist/agents/middleware/callLimit.cjs +0 -130
- package/dist/agents/middleware/callLimit.cjs.map +0 -1
- package/dist/agents/middleware/callLimit.d.cts +0 -119
- package/dist/agents/middleware/callLimit.d.cts.map +0 -1
- package/dist/agents/middleware/callLimit.d.ts +0 -119
- package/dist/agents/middleware/callLimit.d.ts.map +0 -1
- package/dist/agents/middleware/callLimit.js +0 -129
- package/dist/agents/middleware/callLimit.js.map +0 -1
- package/dist/agents/middleware/index.d.cts +0 -15
- package/dist/agents/middleware/index.d.ts +0 -14
- package/dist/agents/tools.d.cts +0 -9
- package/dist/agents/tools.d.cts.map +0 -1
- package/dist/agents/tools.d.ts +0 -9
- package/dist/agents/tools.d.ts.map +0 -1
- 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
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { AgentMiddleware } from "./types.cjs";
|
|
2
|
-
import { InferInteropZodInput } from "@langchain/core/utils/types";
|
|
3
|
-
import { z } from "zod/v3";
|
|
4
|
-
|
|
5
|
-
//#region src/agents/middleware/callLimit.d.ts
|
|
6
|
-
declare const contextSchema: z.ZodObject<{
|
|
7
|
-
/**
|
|
8
|
-
* The maximum number of model calls allowed per thread.
|
|
9
|
-
*/
|
|
10
|
-
threadLimit: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
/**
|
|
12
|
-
* The maximum number of model calls allowed per run.
|
|
13
|
-
*/
|
|
14
|
-
runLimit: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
/**
|
|
16
|
-
* The behavior to take when the limit is exceeded.
|
|
17
|
-
* - "throw" will throw an error and stop the agent.
|
|
18
|
-
* - "end" will end the agent.
|
|
19
|
-
* @default "end"
|
|
20
|
-
*/
|
|
21
|
-
exitBehavior: z.ZodOptional<z.ZodEnum<["throw", "end"]>>;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
threadLimit?: number | undefined;
|
|
24
|
-
runLimit?: number | undefined;
|
|
25
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
threadLimit?: number | undefined;
|
|
28
|
-
runLimit?: number | undefined;
|
|
29
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
type ModelCallLimitMiddlewareConfig = Partial<InferInteropZodInput<typeof contextSchema>>;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a middleware to limit the number of model calls at both thread and run levels.
|
|
34
|
-
*
|
|
35
|
-
* This middleware helps prevent excessive model API calls by enforcing limits on how many
|
|
36
|
-
* times the model can be invoked. It supports two types of limits:
|
|
37
|
-
*
|
|
38
|
-
* - **Thread-level limit**: Restricts the total number of model calls across an entire conversation thread
|
|
39
|
-
* - **Run-level limit**: Restricts the number of model calls within a single agent run/invocation
|
|
40
|
-
*
|
|
41
|
-
* ## How It Works
|
|
42
|
-
*
|
|
43
|
-
* The middleware intercepts model requests before they are sent and checks the current call counts
|
|
44
|
-
* against the configured limits. If either limit is exceeded, it throws a `ModelCallLimitMiddlewareError`
|
|
45
|
-
* to stop execution and prevent further API calls.
|
|
46
|
-
*
|
|
47
|
-
* ## Use Cases
|
|
48
|
-
*
|
|
49
|
-
* - **Cost Control**: Prevent runaway costs from excessive model calls in production
|
|
50
|
-
* - **Testing**: Ensure agents don't make too many calls during development/testing
|
|
51
|
-
* - **Safety**: Limit potential infinite loops or recursive agent behaviors
|
|
52
|
-
* - **Rate Limiting**: Enforce organizational policies on model usage per conversation
|
|
53
|
-
*
|
|
54
|
-
* @param middlewareOptions - Configuration options for the call limits
|
|
55
|
-
* @param middlewareOptions.threadLimit - Maximum number of model calls allowed per thread (optional)
|
|
56
|
-
* @param middlewareOptions.runLimit - Maximum number of model calls allowed per run (optional)
|
|
57
|
-
*
|
|
58
|
-
* @returns A middleware instance that can be passed to `createAgent`
|
|
59
|
-
*
|
|
60
|
-
* @throws {ModelCallLimitMiddlewareError} When either the thread or run limit is exceeded
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* import { createAgent, modelCallLimitMiddleware } from "langchain";
|
|
65
|
-
*
|
|
66
|
-
* // Limit to 10 calls per thread and 3 calls per run
|
|
67
|
-
* const agent = createAgent({
|
|
68
|
-
* model: "openai:gpt-4o-mini",
|
|
69
|
-
* tools: [myTool],
|
|
70
|
-
* middleware: [
|
|
71
|
-
* modelCallLimitMiddleware({
|
|
72
|
-
* threadLimit: 10,
|
|
73
|
-
* runLimit: 3
|
|
74
|
-
* })
|
|
75
|
-
* ]
|
|
76
|
-
* });
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* // Limits can also be configured at runtime via context
|
|
82
|
-
* const result = await agent.invoke(
|
|
83
|
-
* { messages: ["Hello"] },
|
|
84
|
-
* {
|
|
85
|
-
* configurable: {
|
|
86
|
-
* threadLimit: 5 // Override the default limit for this run
|
|
87
|
-
* }
|
|
88
|
-
* }
|
|
89
|
-
* );
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare function modelCallLimitMiddleware(middlewareOptions?: ModelCallLimitMiddlewareConfig): AgentMiddleware<undefined, z.ZodObject<{
|
|
93
|
-
/**
|
|
94
|
-
* The maximum number of model calls allowed per thread.
|
|
95
|
-
*/
|
|
96
|
-
threadLimit: z.ZodOptional<z.ZodNumber>;
|
|
97
|
-
/**
|
|
98
|
-
* The maximum number of model calls allowed per run.
|
|
99
|
-
*/
|
|
100
|
-
runLimit: z.ZodOptional<z.ZodNumber>;
|
|
101
|
-
/**
|
|
102
|
-
* The behavior to take when the limit is exceeded.
|
|
103
|
-
* - "throw" will throw an error and stop the agent.
|
|
104
|
-
* - "end" will end the agent.
|
|
105
|
-
* @default "end"
|
|
106
|
-
*/
|
|
107
|
-
exitBehavior: z.ZodOptional<z.ZodEnum<["throw", "end"]>>;
|
|
108
|
-
}, "strip", z.ZodTypeAny, {
|
|
109
|
-
threadLimit?: number | undefined;
|
|
110
|
-
runLimit?: number | undefined;
|
|
111
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
112
|
-
}, {
|
|
113
|
-
threadLimit?: number | undefined;
|
|
114
|
-
runLimit?: number | undefined;
|
|
115
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
116
|
-
}>, any>;
|
|
117
|
-
//#endregion
|
|
118
|
-
export { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware };
|
|
119
|
-
//# sourceMappingURL=callLimit.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callLimit.d.cts","names":["z","InferInteropZodInput","contextSchema","ZodNumber","ZodOptional","ZodEnum","ZodTypeAny","ZodObject","ModelCallLimitMiddlewareConfig","Partial","modelCallLimitMiddleware","__types_js10","AgentMiddleware"],"sources":["../../../src/agents/middleware/callLimit.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\ndeclare const contextSchema: z.ZodObject<{\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.ZodOptional<z.ZodNumber>;\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.ZodOptional<z.ZodNumber>;\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.ZodOptional<z.ZodEnum<[\"throw\", \"end\"]>>;\n}, \"strip\", z.ZodTypeAny, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}>;\nexport type ModelCallLimitMiddlewareConfig = Partial<InferInteropZodInput<typeof contextSchema>>;\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 declare function modelCallLimitMiddleware(middlewareOptions?: ModelCallLimitMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, z.ZodObject<{\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.ZodOptional<z.ZodNumber>;\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.ZodOptional<z.ZodNumber>;\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.ZodOptional<z.ZodEnum<[\"throw\", \"end\"]>>;\n}, \"strip\", z.ZodTypeAny, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}>, any>;\nexport {};\n"],"mappings":";;;;;cAEcE,eAAeF,CAAAA,CAAEO;;;AADoC;EAyBjE,WAAA,EApBeP,CAAAA,CAAEI,WAoBjB,CApB6BJ,CAAAA,CAAEG,SAoB/B,CAAA;EAAA;;;EAhBqC,QAAvBC,EAAFJ,CAAAA,CAAEI,WAAAA,CAAYJ,CAAAA,CAAEG,SAAdC,CAAAA;EAAW;;;;AARa;AAyBxC;EAA0C,YAAA,EAVxBJ,CAAAA,CAAEI,WAUsB,CAVVJ,CAAAA,CAAEK,OAUQ,CAAA,CAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;CAAA,EAAA,OAAuCH,EATrEF,CAAAA,CAAEM,UASmEJ,EAAAA;EAAa,WAAzCD,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAoB,QAA5BQ,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAO,YAAA,CAAA,EAAA,KAAA,GAAA,OAAA,GAAA,SAAA;AA6DpD,CAAA,EAAA;EAAgD,WAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,QAAqBD,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAA8B,YAIlEL,CAAAA,EAAAA,KAAAA,GAAAA,OAAAA,GAAAA,SAAAA;CAAS,CAAA;AAIdH,KArEhBQ,8BAAAA,GAAiCC,OAqEfN,CArEuBF,oBAqEvBE,CAAAA,OArEmDD,aAqEnDC,CAAAA,CAAAA;;;;;;;AAR4G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAlHO,wBAAAA,qBAA6CF,iCAA4F,2BAAXR,CAAAA,CAAEO;;;;eAIvIP,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEG;;;;YAInBH,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEG;;;;;;;gBAOZH,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEK;YACtBL,CAAAA,CAAEM"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { AgentMiddleware } from "./types.js";
|
|
2
|
-
import { z } from "zod/v3";
|
|
3
|
-
import { InferInteropZodInput } from "@langchain/core/utils/types";
|
|
4
|
-
|
|
5
|
-
//#region src/agents/middleware/callLimit.d.ts
|
|
6
|
-
declare const contextSchema: z.ZodObject<{
|
|
7
|
-
/**
|
|
8
|
-
* The maximum number of model calls allowed per thread.
|
|
9
|
-
*/
|
|
10
|
-
threadLimit: z.ZodOptional<z.ZodNumber>;
|
|
11
|
-
/**
|
|
12
|
-
* The maximum number of model calls allowed per run.
|
|
13
|
-
*/
|
|
14
|
-
runLimit: z.ZodOptional<z.ZodNumber>;
|
|
15
|
-
/**
|
|
16
|
-
* The behavior to take when the limit is exceeded.
|
|
17
|
-
* - "throw" will throw an error and stop the agent.
|
|
18
|
-
* - "end" will end the agent.
|
|
19
|
-
* @default "end"
|
|
20
|
-
*/
|
|
21
|
-
exitBehavior: z.ZodOptional<z.ZodEnum<["throw", "end"]>>;
|
|
22
|
-
}, "strip", z.ZodTypeAny, {
|
|
23
|
-
threadLimit?: number | undefined;
|
|
24
|
-
runLimit?: number | undefined;
|
|
25
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
26
|
-
}, {
|
|
27
|
-
threadLimit?: number | undefined;
|
|
28
|
-
runLimit?: number | undefined;
|
|
29
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
30
|
-
}>;
|
|
31
|
-
type ModelCallLimitMiddlewareConfig = Partial<InferInteropZodInput<typeof contextSchema>>;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a middleware to limit the number of model calls at both thread and run levels.
|
|
34
|
-
*
|
|
35
|
-
* This middleware helps prevent excessive model API calls by enforcing limits on how many
|
|
36
|
-
* times the model can be invoked. It supports two types of limits:
|
|
37
|
-
*
|
|
38
|
-
* - **Thread-level limit**: Restricts the total number of model calls across an entire conversation thread
|
|
39
|
-
* - **Run-level limit**: Restricts the number of model calls within a single agent run/invocation
|
|
40
|
-
*
|
|
41
|
-
* ## How It Works
|
|
42
|
-
*
|
|
43
|
-
* The middleware intercepts model requests before they are sent and checks the current call counts
|
|
44
|
-
* against the configured limits. If either limit is exceeded, it throws a `ModelCallLimitMiddlewareError`
|
|
45
|
-
* to stop execution and prevent further API calls.
|
|
46
|
-
*
|
|
47
|
-
* ## Use Cases
|
|
48
|
-
*
|
|
49
|
-
* - **Cost Control**: Prevent runaway costs from excessive model calls in production
|
|
50
|
-
* - **Testing**: Ensure agents don't make too many calls during development/testing
|
|
51
|
-
* - **Safety**: Limit potential infinite loops or recursive agent behaviors
|
|
52
|
-
* - **Rate Limiting**: Enforce organizational policies on model usage per conversation
|
|
53
|
-
*
|
|
54
|
-
* @param middlewareOptions - Configuration options for the call limits
|
|
55
|
-
* @param middlewareOptions.threadLimit - Maximum number of model calls allowed per thread (optional)
|
|
56
|
-
* @param middlewareOptions.runLimit - Maximum number of model calls allowed per run (optional)
|
|
57
|
-
*
|
|
58
|
-
* @returns A middleware instance that can be passed to `createAgent`
|
|
59
|
-
*
|
|
60
|
-
* @throws {ModelCallLimitMiddlewareError} When either the thread or run limit is exceeded
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* import { createAgent, modelCallLimitMiddleware } from "langchain";
|
|
65
|
-
*
|
|
66
|
-
* // Limit to 10 calls per thread and 3 calls per run
|
|
67
|
-
* const agent = createAgent({
|
|
68
|
-
* model: "openai:gpt-4o-mini",
|
|
69
|
-
* tools: [myTool],
|
|
70
|
-
* middleware: [
|
|
71
|
-
* modelCallLimitMiddleware({
|
|
72
|
-
* threadLimit: 10,
|
|
73
|
-
* runLimit: 3
|
|
74
|
-
* })
|
|
75
|
-
* ]
|
|
76
|
-
* });
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @example
|
|
80
|
-
* ```typescript
|
|
81
|
-
* // Limits can also be configured at runtime via context
|
|
82
|
-
* const result = await agent.invoke(
|
|
83
|
-
* { messages: ["Hello"] },
|
|
84
|
-
* {
|
|
85
|
-
* configurable: {
|
|
86
|
-
* threadLimit: 5 // Override the default limit for this run
|
|
87
|
-
* }
|
|
88
|
-
* }
|
|
89
|
-
* );
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
declare function modelCallLimitMiddleware(middlewareOptions?: ModelCallLimitMiddlewareConfig): AgentMiddleware<undefined, z.ZodObject<{
|
|
93
|
-
/**
|
|
94
|
-
* The maximum number of model calls allowed per thread.
|
|
95
|
-
*/
|
|
96
|
-
threadLimit: z.ZodOptional<z.ZodNumber>;
|
|
97
|
-
/**
|
|
98
|
-
* The maximum number of model calls allowed per run.
|
|
99
|
-
*/
|
|
100
|
-
runLimit: z.ZodOptional<z.ZodNumber>;
|
|
101
|
-
/**
|
|
102
|
-
* The behavior to take when the limit is exceeded.
|
|
103
|
-
* - "throw" will throw an error and stop the agent.
|
|
104
|
-
* - "end" will end the agent.
|
|
105
|
-
* @default "end"
|
|
106
|
-
*/
|
|
107
|
-
exitBehavior: z.ZodOptional<z.ZodEnum<["throw", "end"]>>;
|
|
108
|
-
}, "strip", z.ZodTypeAny, {
|
|
109
|
-
threadLimit?: number | undefined;
|
|
110
|
-
runLimit?: number | undefined;
|
|
111
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
112
|
-
}, {
|
|
113
|
-
threadLimit?: number | undefined;
|
|
114
|
-
runLimit?: number | undefined;
|
|
115
|
-
exitBehavior?: "end" | "throw" | undefined;
|
|
116
|
-
}>, any>;
|
|
117
|
-
//#endregion
|
|
118
|
-
export { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware };
|
|
119
|
-
//# sourceMappingURL=callLimit.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callLimit.d.ts","names":["z","InferInteropZodInput","contextSchema","ZodNumber","ZodOptional","ZodEnum","ZodTypeAny","ZodObject","ModelCallLimitMiddlewareConfig","Partial","modelCallLimitMiddleware","__types_js10","AgentMiddleware"],"sources":["../../../src/agents/middleware/callLimit.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { InferInteropZodInput } from \"@langchain/core/utils/types\";\ndeclare const contextSchema: z.ZodObject<{\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.ZodOptional<z.ZodNumber>;\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.ZodOptional<z.ZodNumber>;\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.ZodOptional<z.ZodEnum<[\"throw\", \"end\"]>>;\n}, \"strip\", z.ZodTypeAny, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}>;\nexport type ModelCallLimitMiddlewareConfig = Partial<InferInteropZodInput<typeof contextSchema>>;\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 declare function modelCallLimitMiddleware(middlewareOptions?: ModelCallLimitMiddlewareConfig): import(\"./types.js\").AgentMiddleware<undefined, z.ZodObject<{\n /**\n * The maximum number of model calls allowed per thread.\n */\n threadLimit: z.ZodOptional<z.ZodNumber>;\n /**\n * The maximum number of model calls allowed per run.\n */\n runLimit: z.ZodOptional<z.ZodNumber>;\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.ZodOptional<z.ZodEnum<[\"throw\", \"end\"]>>;\n}, \"strip\", z.ZodTypeAny, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}, {\n threadLimit?: number | undefined;\n runLimit?: number | undefined;\n exitBehavior?: \"end\" | \"throw\" | undefined;\n}>, any>;\nexport {};\n"],"mappings":";;;;;cAEcE,eAAeF,CAAAA,CAAEO;;;AADoC;EAyBjE,WAAA,EApBeP,CAAAA,CAAEI,WAoBjB,CApB6BJ,CAAAA,CAAEG,SAoB/B,CAAA;EAAA;;;EAhBqC,QAAvBC,EAAFJ,CAAAA,CAAEI,WAAAA,CAAYJ,CAAAA,CAAEG,SAAdC,CAAAA;EAAW;;;;AARa;AAyBxC;EAA0C,YAAA,EAVxBJ,CAAAA,CAAEI,WAUsB,CAVVJ,CAAAA,CAAEK,OAUQ,CAAA,CAAA,OAAA,EAAA,KAAA,CAAA,CAAA,CAAA;CAAA,EAAA,OAAuCH,EATrEF,CAAAA,CAAEM,UASmEJ,EAAAA;EAAa,WAAzCD,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAoB,QAA5BQ,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAAO,YAAA,CAAA,EAAA,KAAA,GAAA,OAAA,GAAA,SAAA;AA6DpD,CAAA,EAAA;EAAgD,WAAA,CAAA,EAAA,MAAA,GAAA,SAAA;EAAA,QAAqBD,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;EAA8B,YAIlEL,CAAAA,EAAAA,KAAAA,GAAAA,OAAAA,GAAAA,SAAAA;CAAS,CAAA;AAIdH,KArEhBQ,8BAAAA,GAAiCC,OAqEfN,CArEuBF,oBAqEvBE,CAAAA,OArEmDD,aAqEnDC,CAAAA,CAAAA;;;;;;;AAR4G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAlHO,wBAAAA,qBAA6CF,iCAA4F,2BAAXR,CAAAA,CAAEO;;;;eAIvIP,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEG;;;;YAInBH,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEG;;;;;;;gBAOZH,CAAAA,CAAEI,YAAYJ,CAAAA,CAAEK;YACtBL,CAAAA,CAAEM"}
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { createMiddleware } from "../middleware.js";
|
|
2
|
-
import { AIMessage } from "@langchain/core/messages";
|
|
3
|
-
import { z } from "zod/v3";
|
|
4
|
-
|
|
5
|
-
//#region src/agents/middleware/callLimit.ts
|
|
6
|
-
const DEFAULT_EXIT_BEHAVIOR = "end";
|
|
7
|
-
const contextSchema = z.object({
|
|
8
|
-
threadLimit: z.number().optional(),
|
|
9
|
-
runLimit: z.number().optional(),
|
|
10
|
-
exitBehavior: z.enum(["throw", "end"]).optional()
|
|
11
|
-
});
|
|
12
|
-
/**
|
|
13
|
-
* Error thrown when the model call limit is exceeded.
|
|
14
|
-
*
|
|
15
|
-
* @param threadLimit - The maximum number of model calls allowed per thread.
|
|
16
|
-
* @param runLimit - The maximum number of model calls allowed per run.
|
|
17
|
-
* @param threadCount - The number of model calls made at the thread level.
|
|
18
|
-
* @param runCount - The number of model calls made at the run level.
|
|
19
|
-
*/
|
|
20
|
-
var ModelCallLimitMiddlewareError = class extends Error {
|
|
21
|
-
constructor({ threadLimit, runLimit, threadCount, runCount }) {
|
|
22
|
-
const exceededHint = [];
|
|
23
|
-
if (typeof threadLimit === "number" && typeof threadCount === "number") exceededHint.push(`thread level call limit reached with ${threadCount} model calls`);
|
|
24
|
-
if (typeof runLimit === "number" && typeof runCount === "number") exceededHint.push(`run level call limit reached with ${runCount} model calls`);
|
|
25
|
-
super(`Model call limits exceeded${exceededHint.length > 0 ? `: ${exceededHint.join(", ")}` : ""}`);
|
|
26
|
-
this.name = "ModelCallLimitMiddlewareError";
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Creates a middleware to limit the number of model calls at both thread and run levels.
|
|
31
|
-
*
|
|
32
|
-
* This middleware helps prevent excessive model API calls by enforcing limits on how many
|
|
33
|
-
* times the model can be invoked. It supports two types of limits:
|
|
34
|
-
*
|
|
35
|
-
* - **Thread-level limit**: Restricts the total number of model calls across an entire conversation thread
|
|
36
|
-
* - **Run-level limit**: Restricts the number of model calls within a single agent run/invocation
|
|
37
|
-
*
|
|
38
|
-
* ## How It Works
|
|
39
|
-
*
|
|
40
|
-
* The middleware intercepts model requests before they are sent and checks the current call counts
|
|
41
|
-
* against the configured limits. If either limit is exceeded, it throws a `ModelCallLimitMiddlewareError`
|
|
42
|
-
* to stop execution and prevent further API calls.
|
|
43
|
-
*
|
|
44
|
-
* ## Use Cases
|
|
45
|
-
*
|
|
46
|
-
* - **Cost Control**: Prevent runaway costs from excessive model calls in production
|
|
47
|
-
* - **Testing**: Ensure agents don't make too many calls during development/testing
|
|
48
|
-
* - **Safety**: Limit potential infinite loops or recursive agent behaviors
|
|
49
|
-
* - **Rate Limiting**: Enforce organizational policies on model usage per conversation
|
|
50
|
-
*
|
|
51
|
-
* @param middlewareOptions - Configuration options for the call limits
|
|
52
|
-
* @param middlewareOptions.threadLimit - Maximum number of model calls allowed per thread (optional)
|
|
53
|
-
* @param middlewareOptions.runLimit - Maximum number of model calls allowed per run (optional)
|
|
54
|
-
*
|
|
55
|
-
* @returns A middleware instance that can be passed to `createAgent`
|
|
56
|
-
*
|
|
57
|
-
* @throws {ModelCallLimitMiddlewareError} When either the thread or run limit is exceeded
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```typescript
|
|
61
|
-
* import { createAgent, modelCallLimitMiddleware } from "langchain";
|
|
62
|
-
*
|
|
63
|
-
* // Limit to 10 calls per thread and 3 calls per run
|
|
64
|
-
* const agent = createAgent({
|
|
65
|
-
* model: "openai:gpt-4o-mini",
|
|
66
|
-
* tools: [myTool],
|
|
67
|
-
* middleware: [
|
|
68
|
-
* modelCallLimitMiddleware({
|
|
69
|
-
* threadLimit: 10,
|
|
70
|
-
* runLimit: 3
|
|
71
|
-
* })
|
|
72
|
-
* ]
|
|
73
|
-
* });
|
|
74
|
-
* ```
|
|
75
|
-
*
|
|
76
|
-
* @example
|
|
77
|
-
* ```typescript
|
|
78
|
-
* // Limits can also be configured at runtime via context
|
|
79
|
-
* const result = await agent.invoke(
|
|
80
|
-
* { messages: ["Hello"] },
|
|
81
|
-
* {
|
|
82
|
-
* configurable: {
|
|
83
|
-
* threadLimit: 5 // Override the default limit for this run
|
|
84
|
-
* }
|
|
85
|
-
* }
|
|
86
|
-
* );
|
|
87
|
-
* ```
|
|
88
|
-
*/
|
|
89
|
-
function modelCallLimitMiddleware(middlewareOptions) {
|
|
90
|
-
return createMiddleware({
|
|
91
|
-
name: "ModelCallLimitMiddleware",
|
|
92
|
-
contextSchema,
|
|
93
|
-
beforeModel: {
|
|
94
|
-
canJumpTo: ["end"],
|
|
95
|
-
hook: (state, runtime) => {
|
|
96
|
-
const exitBehavior = runtime.context.exitBehavior ?? middlewareOptions?.exitBehavior ?? DEFAULT_EXIT_BEHAVIOR;
|
|
97
|
-
const threadLimit = runtime.context.threadLimit ?? middlewareOptions?.threadLimit;
|
|
98
|
-
const runLimit = runtime.context.runLimit ?? middlewareOptions?.runLimit;
|
|
99
|
-
if (typeof threadLimit === "number" && threadLimit <= runtime.threadLevelCallCount) {
|
|
100
|
-
const error = new ModelCallLimitMiddlewareError({
|
|
101
|
-
threadLimit,
|
|
102
|
-
threadCount: runtime.threadLevelCallCount
|
|
103
|
-
});
|
|
104
|
-
if (exitBehavior === "end") return {
|
|
105
|
-
jumpTo: "end",
|
|
106
|
-
messages: [new AIMessage(error.message)]
|
|
107
|
-
};
|
|
108
|
-
throw error;
|
|
109
|
-
}
|
|
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 AIMessage(error.message)]
|
|
118
|
-
};
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
121
|
-
return state;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
//#endregion
|
|
128
|
-
export { modelCallLimitMiddleware };
|
|
129
|
-
//# sourceMappingURL=callLimit.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"callLimit.js","names":["exceededHint: string[]","middlewareOptions?: ModelCallLimitMiddlewareConfig"],"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,gBAAgB,EAAE,OAAO;CAI7B,aAAa,EAAE,QAAQ,CAAC,UAAU;CAIlC,UAAU,EAAE,QAAQ,CAAC,UAAU;CAO/B,cAAc,EAAE,KAAK,CAAC,SAAS,KAAM,EAAC,CAAC,UAAU;AAClD,EAAC;;;;;;;;;AAaF,IAAM,gCAAN,cAA4C,MAAM;CAChD,YAAY,EACV,aACA,UACA,aACA,UAMD,EAAE;EACD,MAAMA,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,EAAE,GAAG,IAC3D,CACH;EACD,KAAK,OAAO;CACb;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DD,SAAgB,yBACdC,mBACA;AACA,QAAO,iBAAiB;EACtB,MAAM;EACN;EACA,aAAa;GACX,WAAW,CAAC,KAAM;GAClB,MAAM,CAAC,OAAO,YAAY;IACxB,MAAM,eACJ,QAAQ,QAAQ,gBAChB,mBAAmB,gBACnB;IACF,MAAM,cACJ,QAAQ,QAAQ,eAAe,mBAAmB;IACpD,MAAM,WACJ,QAAQ,QAAQ,YAAY,mBAAmB;AAEjD,QACE,OAAO,gBAAgB,YACvB,eAAe,QAAQ,sBACvB;KACA,MAAM,QAAQ,IAAI,8BAA8B;MAC9C;MACA,aAAa,QAAQ;KACtB;AACD,SAAI,iBAAiB,MACnB,QAAO;MACL,QAAQ;MACR,UAAU,CAAC,IAAI,UAAU,MAAM,QAAS;KACzC;AAGH,WAAM;IACP;AACD,QACE,OAAO,aAAa,YACpB,YAAY,QAAQ,mBACpB;KACA,MAAM,QAAQ,IAAI,8BAA8B;MAC9C;MACA,UAAU,QAAQ;KACnB;AACD,SAAI,iBAAiB,MACnB,QAAO;MACL,QAAQ;MACR,UAAU,CAAC,IAAI,UAAU,MAAM,QAAS;KACzC;AAGH,WAAM;IACP;AAED,WAAO;GACR;EACF;CACF,EAAC;AACH"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { AgentMiddleware } from "./types.cjs";
|
|
2
|
-
import { SummarizationMiddlewareConfig, summarizationMiddleware } from "./summarization.cjs";
|
|
3
|
-
import { Action, ActionRequest, ApproveDecision, Decision, DecisionType, DescriptionFactory, EditDecision, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, InterruptOnConfig, RejectDecision, ReviewConfig, humanInTheLoopMiddleware } from "./hitl.cjs";
|
|
4
|
-
import { PromptCachingMiddlewareConfig, anthropicPromptCachingMiddleware } from "./promptCaching.cjs";
|
|
5
|
-
import { DynamicSystemPromptMiddlewareConfig, dynamicSystemPromptMiddleware } from "./dynamicSystemPrompt.cjs";
|
|
6
|
-
import { LLMToolSelectorConfig, llmToolSelectorMiddleware } from "./llmToolSelector.cjs";
|
|
7
|
-
import { PIIRedactionMiddlewareConfig, piiRedactionMiddleware } from "./piiRedaction.cjs";
|
|
8
|
-
import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, TokenCounter, contextEditingMiddleware } from "./contextEditing.cjs";
|
|
9
|
-
import { ToolCallLimitConfig, ToolCallLimitExceededError, toolCallLimitMiddleware } from "./toolCallLimit.cjs";
|
|
10
|
-
import { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware } from "./todoListMiddleware.cjs";
|
|
11
|
-
import { modelFallbackMiddleware } from "./modelFallback.cjs";
|
|
12
|
-
import { ToolRetryMiddlewareConfig, toolRetryMiddleware } from "./toolRetry.cjs";
|
|
13
|
-
import { countTokensApproximately } from "./utils.cjs";
|
|
14
|
-
import { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware } from "./modelCallLimit.js";
|
|
15
|
-
export { type ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { AgentMiddleware } from "./types.js";
|
|
2
|
-
import { SummarizationMiddlewareConfig, summarizationMiddleware } from "./summarization.js";
|
|
3
|
-
import { Action, ActionRequest, ApproveDecision, Decision, DecisionType, DescriptionFactory, EditDecision, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, InterruptOnConfig, RejectDecision, ReviewConfig, humanInTheLoopMiddleware } from "./hitl.js";
|
|
4
|
-
import { PromptCachingMiddlewareConfig, anthropicPromptCachingMiddleware } from "./promptCaching.js";
|
|
5
|
-
import { DynamicSystemPromptMiddlewareConfig, dynamicSystemPromptMiddleware } from "./dynamicSystemPrompt.js";
|
|
6
|
-
import { LLMToolSelectorConfig, llmToolSelectorMiddleware } from "./llmToolSelector.js";
|
|
7
|
-
import { PIIRedactionMiddlewareConfig, piiRedactionMiddleware } from "./piiRedaction.js";
|
|
8
|
-
import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, TokenCounter, contextEditingMiddleware } from "./contextEditing.js";
|
|
9
|
-
import { ToolCallLimitConfig, ToolCallLimitExceededError, toolCallLimitMiddleware } from "./toolCallLimit.js";
|
|
10
|
-
import { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware } from "./todoListMiddleware.js";
|
|
11
|
-
import { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware } from "./modelCallLimit.js";
|
|
12
|
-
import { modelFallbackMiddleware } from "./modelFallback.js";
|
|
13
|
-
import { ToolRetryMiddlewareConfig, toolRetryMiddleware } from "./toolRetry.js";
|
|
14
|
-
import { countTokensApproximately } from "./utils.js";
|
package/dist/agents/tools.d.cts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RunnableToolLike } from "@langchain/core/runnables";
|
|
2
|
-
import { DynamicTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
3
|
-
|
|
4
|
-
//#region src/agents/tools.d.ts
|
|
5
|
-
type ServerTool = Record<string, unknown>;
|
|
6
|
-
type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { ClientTool, ServerTool };
|
|
9
|
-
//# sourceMappingURL=tools.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.cts","names":["StructuredToolInterface","DynamicTool","RunnableToolLike","ServerTool","Record","ClientTool"],"sources":["../../src/agents/tools.d.ts"],"sourcesContent":["import type { StructuredToolInterface, DynamicTool } from \"@langchain/core/tools\";\nimport type { RunnableToolLike } from \"@langchain/core/runnables\";\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n"],"mappings":";;;;KAEYG,UAAAA,GAAaC;KACbC,UAAAA,GAAaL,0BAA0BC,cAAcC"}
|
package/dist/agents/tools.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { RunnableToolLike } from "@langchain/core/runnables";
|
|
2
|
-
import { DynamicTool, StructuredToolInterface } from "@langchain/core/tools";
|
|
3
|
-
|
|
4
|
-
//#region src/agents/tools.d.ts
|
|
5
|
-
type ServerTool = Record<string, unknown>;
|
|
6
|
-
type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;
|
|
7
|
-
//#endregion
|
|
8
|
-
export { ClientTool, ServerTool };
|
|
9
|
-
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","names":["StructuredToolInterface","DynamicTool","RunnableToolLike","ServerTool","Record","ClientTool"],"sources":["../../src/agents/tools.d.ts"],"sourcesContent":["import type { StructuredToolInterface, DynamicTool } from \"@langchain/core/tools\";\nimport type { RunnableToolLike } from \"@langchain/core/runnables\";\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n"],"mappings":";;;;KAEYG,UAAAA,GAAaC;KACbC,UAAAA,GAAaL,0BAA0BC,cAAcC"}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
const require_storage_encoder_backed = require('../storage/encoder_backed.cjs');
|
|
3
|
-
const __langchain_core_utils_hash = require_rolldown_runtime.__toESM(require("@langchain/core/utils/hash"));
|
|
4
|
-
const __langchain_core_embeddings = require_rolldown_runtime.__toESM(require("@langchain/core/embeddings"));
|
|
5
|
-
|
|
6
|
-
//#region src/embeddings/cache_backed.ts
|
|
7
|
-
var cache_backed_exports = {};
|
|
8
|
-
require_rolldown_runtime.__export(cache_backed_exports, { CacheBackedEmbeddings: () => CacheBackedEmbeddings });
|
|
9
|
-
/**
|
|
10
|
-
* Interface for caching results from embedding models.
|
|
11
|
-
*
|
|
12
|
-
* The interface allows works with any store that implements
|
|
13
|
-
* the abstract store interface accepting keys of type str and values of list of
|
|
14
|
-
* floats.
|
|
15
|
-
*
|
|
16
|
-
* If need be, the interface can be extended to accept other implementations
|
|
17
|
-
* of the value serializer and deserializer, as well as the key encoder.
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* const underlyingEmbeddings = new OpenAIEmbeddings();
|
|
21
|
-
*
|
|
22
|
-
* const cacheBackedEmbeddings = CacheBackedEmbeddings.fromBytesStore(
|
|
23
|
-
* underlyingEmbeddings,
|
|
24
|
-
* new ConvexKVStore({ ctx }),
|
|
25
|
-
* {
|
|
26
|
-
* namespace: underlyingEmbeddings.modelName,
|
|
27
|
-
* },
|
|
28
|
-
* );
|
|
29
|
-
*
|
|
30
|
-
* const loader = new TextLoader("./state_of_the_union.txt");
|
|
31
|
-
* const rawDocuments = await loader.load();
|
|
32
|
-
* const splitter = new RecursiveCharacterTextSplitter({
|
|
33
|
-
* chunkSize: 1000,
|
|
34
|
-
* chunkOverlap: 0,
|
|
35
|
-
* });
|
|
36
|
-
* const documents = await splitter.splitDocuments(rawDocuments);
|
|
37
|
-
*
|
|
38
|
-
* let time = Date.now();
|
|
39
|
-
* const vectorstore = await ConvexVectorStore.fromDocuments(
|
|
40
|
-
* documents,
|
|
41
|
-
* cacheBackedEmbeddings,
|
|
42
|
-
* { ctx },
|
|
43
|
-
* );
|
|
44
|
-
* console.log(`Initial creation time: ${Date.now() - time}ms`);
|
|
45
|
-
*
|
|
46
|
-
* time = Date.now();
|
|
47
|
-
* const vectorstore2 = await ConvexVectorStore.fromDocuments(
|
|
48
|
-
* documents,
|
|
49
|
-
* cacheBackedEmbeddings,
|
|
50
|
-
* { ctx },
|
|
51
|
-
* );
|
|
52
|
-
* console.log(`Cached creation time: ${Date.now() - time}ms`);
|
|
53
|
-
*
|
|
54
|
-
* ```
|
|
55
|
-
*/
|
|
56
|
-
var CacheBackedEmbeddings = class extends __langchain_core_embeddings.Embeddings {
|
|
57
|
-
underlyingEmbeddings;
|
|
58
|
-
documentEmbeddingStore;
|
|
59
|
-
constructor(fields) {
|
|
60
|
-
super(fields);
|
|
61
|
-
this.underlyingEmbeddings = fields.underlyingEmbeddings;
|
|
62
|
-
this.documentEmbeddingStore = fields.documentEmbeddingStore;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Embed query text.
|
|
66
|
-
*
|
|
67
|
-
* This method does not support caching at the moment.
|
|
68
|
-
*
|
|
69
|
-
* Support for caching queries is easy to implement, but might make
|
|
70
|
-
* sense to hold off to see the most common patterns.
|
|
71
|
-
*
|
|
72
|
-
* If the cache has an eviction policy, we may need to be a bit more careful
|
|
73
|
-
* about sharing the cache between documents and queries. Generally,
|
|
74
|
-
* one is OK evicting query caches, but document caches should be kept.
|
|
75
|
-
*
|
|
76
|
-
* @param document The text to embed.
|
|
77
|
-
* @returns The embedding for the given text.
|
|
78
|
-
*/
|
|
79
|
-
async embedQuery(document) {
|
|
80
|
-
return this.underlyingEmbeddings.embedQuery(document);
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Embed a list of texts.
|
|
84
|
-
*
|
|
85
|
-
* The method first checks the cache for the embeddings.
|
|
86
|
-
* If the embeddings are not found, the method uses the underlying embedder
|
|
87
|
-
* to embed the documents and stores the results in the cache.
|
|
88
|
-
*
|
|
89
|
-
* @param documents
|
|
90
|
-
* @returns A list of embeddings for the given texts.
|
|
91
|
-
*/
|
|
92
|
-
async embedDocuments(documents) {
|
|
93
|
-
const vectors = await this.documentEmbeddingStore.mget(documents);
|
|
94
|
-
const missingIndicies = [];
|
|
95
|
-
const missingDocuments = [];
|
|
96
|
-
for (let i = 0; i < vectors.length; i += 1) if (vectors[i] === void 0) {
|
|
97
|
-
missingIndicies.push(i);
|
|
98
|
-
missingDocuments.push(documents[i]);
|
|
99
|
-
}
|
|
100
|
-
if (missingDocuments.length) {
|
|
101
|
-
const missingVectors = await this.underlyingEmbeddings.embedDocuments(missingDocuments);
|
|
102
|
-
const keyValuePairs = missingDocuments.map((document, i) => [document, missingVectors[i]]);
|
|
103
|
-
await this.documentEmbeddingStore.mset(keyValuePairs);
|
|
104
|
-
for (let i = 0; i < missingIndicies.length; i += 1) vectors[missingIndicies[i]] = missingVectors[i];
|
|
105
|
-
}
|
|
106
|
-
return vectors;
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* Create a new CacheBackedEmbeddings instance from another embeddings instance
|
|
110
|
-
* and a storage instance.
|
|
111
|
-
* @param underlyingEmbeddings Embeddings used to populate the cache for new documents.
|
|
112
|
-
* @param documentEmbeddingStore Stores raw document embedding values. Keys are hashes of the document content.
|
|
113
|
-
* @param options.namespace Optional namespace for store keys.
|
|
114
|
-
* @returns A new CacheBackedEmbeddings instance.
|
|
115
|
-
*/
|
|
116
|
-
static fromBytesStore(underlyingEmbeddings, documentEmbeddingStore, options) {
|
|
117
|
-
const encoder = new TextEncoder();
|
|
118
|
-
const decoder = new TextDecoder();
|
|
119
|
-
const encoderBackedStore = new require_storage_encoder_backed.EncoderBackedStore({
|
|
120
|
-
store: documentEmbeddingStore,
|
|
121
|
-
keyEncoder: (key) => (options?.namespace ?? "") + (0, __langchain_core_utils_hash.sha256)(key),
|
|
122
|
-
valueSerializer: (value) => encoder.encode(JSON.stringify(value)),
|
|
123
|
-
valueDeserializer: (serializedValue) => JSON.parse(decoder.decode(serializedValue))
|
|
124
|
-
});
|
|
125
|
-
return new this({
|
|
126
|
-
underlyingEmbeddings,
|
|
127
|
-
documentEmbeddingStore: encoderBackedStore
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
//#endregion
|
|
133
|
-
exports.CacheBackedEmbeddings = CacheBackedEmbeddings;
|
|
134
|
-
Object.defineProperty(exports, 'cache_backed_exports', {
|
|
135
|
-
enumerable: true,
|
|
136
|
-
get: function () {
|
|
137
|
-
return cache_backed_exports;
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
//# sourceMappingURL=cache_backed.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cache_backed.cjs","names":["Embeddings","fields: CacheBackedEmbeddingsFields","document: string","documents: string[]","keyValuePairs: [string, number[]][]","underlyingEmbeddings: EmbeddingsInterface","documentEmbeddingStore: BaseStore<string, Uint8Array>","options?: {\n namespace?: string;\n }","EncoderBackedStore"],"sources":["../../src/embeddings/cache_backed.ts"],"sourcesContent":["import { sha256 } from \"@langchain/core/utils/hash\";\nimport {\n type EmbeddingsInterface,\n Embeddings,\n} from \"@langchain/core/embeddings\";\nimport { BaseStore } from \"@langchain/core/stores\";\n\nimport { AsyncCallerParams } from \"@langchain/core/utils/async_caller\";\nimport { EncoderBackedStore } from \"../storage/encoder_backed.js\";\n\n/**\n * Interface for the fields required to initialize an instance of the\n * CacheBackedEmbeddings class.\n */\nexport interface CacheBackedEmbeddingsFields extends AsyncCallerParams {\n underlyingEmbeddings: EmbeddingsInterface;\n documentEmbeddingStore: BaseStore<string, number[]>;\n}\n\n/**\n * Interface for caching results from embedding models.\n *\n * The interface allows works with any store that implements\n * the abstract store interface accepting keys of type str and values of list of\n * floats.\n *\n * If need be, the interface can be extended to accept other implementations\n * of the value serializer and deserializer, as well as the key encoder.\n * @example\n * ```typescript\n * const underlyingEmbeddings = new OpenAIEmbeddings();\n *\n * const cacheBackedEmbeddings = CacheBackedEmbeddings.fromBytesStore(\n * underlyingEmbeddings,\n * new ConvexKVStore({ ctx }),\n * {\n * namespace: underlyingEmbeddings.modelName,\n * },\n * );\n *\n * const loader = new TextLoader(\"./state_of_the_union.txt\");\n * const rawDocuments = await loader.load();\n * const splitter = new RecursiveCharacterTextSplitter({\n * chunkSize: 1000,\n * chunkOverlap: 0,\n * });\n * const documents = await splitter.splitDocuments(rawDocuments);\n *\n * let time = Date.now();\n * const vectorstore = await ConvexVectorStore.fromDocuments(\n * documents,\n * cacheBackedEmbeddings,\n * { ctx },\n * );\n * console.log(`Initial creation time: ${Date.now() - time}ms`);\n *\n * time = Date.now();\n * const vectorstore2 = await ConvexVectorStore.fromDocuments(\n * documents,\n * cacheBackedEmbeddings,\n * { ctx },\n * );\n * console.log(`Cached creation time: ${Date.now() - time}ms`);\n *\n * ```\n */\nexport class CacheBackedEmbeddings extends Embeddings {\n protected underlyingEmbeddings: EmbeddingsInterface;\n\n protected documentEmbeddingStore: BaseStore<string, number[]>;\n\n constructor(fields: CacheBackedEmbeddingsFields) {\n super(fields);\n this.underlyingEmbeddings = fields.underlyingEmbeddings;\n this.documentEmbeddingStore = fields.documentEmbeddingStore;\n }\n\n /**\n * Embed query text.\n *\n * This method does not support caching at the moment.\n *\n * Support for caching queries is easy to implement, but might make\n * sense to hold off to see the most common patterns.\n *\n * If the cache has an eviction policy, we may need to be a bit more careful\n * about sharing the cache between documents and queries. Generally,\n * one is OK evicting query caches, but document caches should be kept.\n *\n * @param document The text to embed.\n * @returns The embedding for the given text.\n */\n async embedQuery(document: string): Promise<number[]> {\n return this.underlyingEmbeddings.embedQuery(document);\n }\n\n /**\n * Embed a list of texts.\n *\n * The method first checks the cache for the embeddings.\n * If the embeddings are not found, the method uses the underlying embedder\n * to embed the documents and stores the results in the cache.\n *\n * @param documents\n * @returns A list of embeddings for the given texts.\n */\n async embedDocuments(documents: string[]): Promise<number[][]> {\n const vectors = await this.documentEmbeddingStore.mget(documents);\n const missingIndicies = [];\n const missingDocuments = [];\n for (let i = 0; i < vectors.length; i += 1) {\n if (vectors[i] === undefined) {\n missingIndicies.push(i);\n missingDocuments.push(documents[i]);\n }\n }\n if (missingDocuments.length) {\n const missingVectors = await this.underlyingEmbeddings.embedDocuments(\n missingDocuments\n );\n const keyValuePairs: [string, number[]][] = missingDocuments.map(\n (document, i) => [document, missingVectors[i]]\n );\n await this.documentEmbeddingStore.mset(keyValuePairs);\n for (let i = 0; i < missingIndicies.length; i += 1) {\n vectors[missingIndicies[i]] = missingVectors[i];\n }\n }\n return vectors as number[][];\n }\n\n /**\n * Create a new CacheBackedEmbeddings instance from another embeddings instance\n * and a storage instance.\n * @param underlyingEmbeddings Embeddings used to populate the cache for new documents.\n * @param documentEmbeddingStore Stores raw document embedding values. Keys are hashes of the document content.\n * @param options.namespace Optional namespace for store keys.\n * @returns A new CacheBackedEmbeddings instance.\n */\n static fromBytesStore(\n underlyingEmbeddings: EmbeddingsInterface,\n documentEmbeddingStore: BaseStore<string, Uint8Array>,\n options?: {\n namespace?: string;\n }\n ) {\n const encoder = new TextEncoder();\n const decoder = new TextDecoder();\n const encoderBackedStore = new EncoderBackedStore<\n string,\n number[],\n Uint8Array\n >({\n store: documentEmbeddingStore,\n keyEncoder: (key) => (options?.namespace ?? \"\") + sha256(key),\n valueSerializer: (value) => encoder.encode(JSON.stringify(value)),\n valueDeserializer: (serializedValue) =>\n JSON.parse(decoder.decode(serializedValue)),\n });\n return new this({\n underlyingEmbeddings,\n documentEmbeddingStore: encoderBackedStore,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,IAAa,wBAAb,cAA2CA,uCAAW;CACpD,AAAU;CAEV,AAAU;CAEV,YAAYC,QAAqC;EAC/C,MAAM,OAAO;EACb,KAAK,uBAAuB,OAAO;EACnC,KAAK,yBAAyB,OAAO;CACtC;;;;;;;;;;;;;;;;CAiBD,MAAM,WAAWC,UAAqC;AACpD,SAAO,KAAK,qBAAqB,WAAW,SAAS;CACtD;;;;;;;;;;;CAYD,MAAM,eAAeC,WAA0C;EAC7D,MAAM,UAAU,MAAM,KAAK,uBAAuB,KAAK,UAAU;EACjE,MAAM,kBAAkB,CAAE;EAC1B,MAAM,mBAAmB,CAAE;AAC3B,OAAK,IAAI,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,EACvC,KAAI,QAAQ,OAAO,QAAW;GAC5B,gBAAgB,KAAK,EAAE;GACvB,iBAAiB,KAAK,UAAU,GAAG;EACpC;AAEH,MAAI,iBAAiB,QAAQ;GAC3B,MAAM,iBAAiB,MAAM,KAAK,qBAAqB,eACrD,iBACD;GACD,MAAMC,gBAAsC,iBAAiB,IAC3D,CAAC,UAAU,MAAM,CAAC,UAAU,eAAe,EAAG,EAC/C;GACD,MAAM,KAAK,uBAAuB,KAAK,cAAc;AACrD,QAAK,IAAI,IAAI,GAAG,IAAI,gBAAgB,QAAQ,KAAK,GAC/C,QAAQ,gBAAgB,MAAM,eAAe;EAEhD;AACD,SAAO;CACR;;;;;;;;;CAUD,OAAO,eACLC,sBACAC,wBACAC,SAGA;EACA,MAAM,UAAU,IAAI;EACpB,MAAM,UAAU,IAAI;EACpB,MAAM,qBAAqB,IAAIC,kDAI7B;GACA,OAAO;GACP,YAAY,CAAC,SAAS,SAAS,aAAa,8CAAa,IAAI;GAC7D,iBAAiB,CAAC,UAAU,QAAQ,OAAO,KAAK,UAAU,MAAM,CAAC;GACjE,mBAAmB,CAAC,oBAClB,KAAK,MAAM,QAAQ,OAAO,gBAAgB,CAAC;EAC9C;AACD,SAAO,IAAI,KAAK;GACd;GACA,wBAAwB;EACzB;CACF;AACF"}
|