langchain 1.0.0-alpha.6 → 1.0.0-alpha.8
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/dist/agents/ReactAgent.cjs +2 -2
- package/dist/agents/ReactAgent.cjs.map +1 -1
- package/dist/agents/ReactAgent.d.cts +1 -2
- package/dist/agents/ReactAgent.d.cts.map +1 -1
- package/dist/agents/ReactAgent.d.ts +1 -2
- package/dist/agents/ReactAgent.d.ts.map +1 -1
- package/dist/agents/ReactAgent.js +2 -2
- package/dist/agents/ReactAgent.js.map +1 -1
- package/dist/agents/RunnableCallable.cjs +10 -0
- package/dist/agents/RunnableCallable.cjs.map +1 -1
- package/dist/agents/RunnableCallable.d.cts +5 -0
- package/dist/agents/RunnableCallable.d.cts.map +1 -1
- package/dist/agents/RunnableCallable.d.ts +5 -0
- package/dist/agents/RunnableCallable.d.ts.map +1 -1
- package/dist/agents/RunnableCallable.js +10 -0
- package/dist/agents/RunnableCallable.js.map +1 -1
- package/dist/agents/annotation.cjs +14 -0
- package/dist/agents/annotation.cjs.map +1 -1
- package/dist/agents/annotation.d.cts +17 -5
- package/dist/agents/annotation.d.cts.map +1 -1
- package/dist/agents/annotation.d.ts +16 -4
- package/dist/agents/annotation.d.ts.map +1 -1
- package/dist/agents/annotation.js +12 -1
- package/dist/agents/annotation.js.map +1 -1
- package/dist/agents/createAgent.cjs.map +1 -1
- package/dist/agents/createAgent.js.map +1 -1
- package/dist/agents/errors.d.cts +9 -2
- package/dist/agents/errors.d.cts.map +1 -1
- package/dist/agents/errors.d.ts +9 -2
- package/dist/agents/errors.d.ts.map +1 -1
- package/dist/agents/index.cjs +3 -0
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +7 -6
- package/dist/agents/index.d.cts.map +1 -1
- package/dist/agents/index.d.ts +7 -6
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +4 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/interrupt.d.cts +18 -16
- package/dist/agents/interrupt.d.cts.map +1 -1
- package/dist/agents/interrupt.d.ts +16 -17
- package/dist/agents/interrupt.d.ts.map +1 -1
- package/dist/agents/interrupt.js +3 -1
- package/dist/agents/middlewareAgent/ReactAgent.cjs +394 -70
- package/dist/agents/middlewareAgent/ReactAgent.cjs.map +1 -1
- package/dist/agents/middlewareAgent/ReactAgent.d.cts +178 -11
- package/dist/agents/middlewareAgent/ReactAgent.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/ReactAgent.d.ts +178 -11
- package/dist/agents/middlewareAgent/ReactAgent.d.ts.map +1 -1
- package/dist/agents/middlewareAgent/ReactAgent.js +395 -71
- package/dist/agents/middlewareAgent/ReactAgent.js.map +1 -1
- package/dist/agents/middlewareAgent/annotation.cjs +10 -4
- package/dist/agents/middlewareAgent/annotation.cjs.map +1 -1
- package/dist/agents/middlewareAgent/annotation.js +10 -4
- package/dist/agents/middlewareAgent/annotation.js.map +1 -1
- package/dist/agents/middlewareAgent/constants.d.cts +5 -0
- package/dist/agents/middlewareAgent/constants.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/constants.d.ts +5 -0
- package/dist/agents/middlewareAgent/constants.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/index.cjs.map +1 -1
- package/dist/agents/middlewareAgent/index.js.map +1 -1
- package/dist/agents/middlewareAgent/middleware/callLimit.cjs +128 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.d.cts +119 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.d.ts +119 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.js +127 -0
- package/dist/agents/middlewareAgent/middleware/callLimit.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.cjs +278 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts +239 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts +239 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.js +276 -0
- package/dist/agents/middlewareAgent/middleware/contextEditing.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs +58 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts +46 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts +46 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js +58 -0
- package/dist/agents/middlewareAgent/middleware/dynamicSystemPrompt.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/hitl.cjs +192 -86
- package/dist/agents/middlewareAgent/middleware/hitl.cjs.map +1 -1
- package/dist/agents/middlewareAgent/middleware/hitl.d.cts +387 -62
- package/dist/agents/middlewareAgent/middleware/hitl.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/hitl.d.ts +387 -62
- package/dist/agents/middlewareAgent/middleware/hitl.d.ts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/hitl.js +193 -87
- package/dist/agents/middlewareAgent/middleware/hitl.js.map +1 -1
- package/dist/agents/middlewareAgent/middleware/index.cjs +29 -3
- package/dist/agents/middlewareAgent/middleware/index.cjs.map +1 -1
- package/dist/agents/middlewareAgent/middleware/index.d.cts +13 -4
- package/dist/agents/middlewareAgent/middleware/index.d.ts +13 -4
- package/dist/agents/middlewareAgent/middleware/index.js +20 -3
- package/dist/agents/middlewareAgent/middleware/index.js.map +1 -1
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs +193 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts +83 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts +83 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.js +192 -0
- package/dist/agents/middlewareAgent/middleware/llmToolSelector.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.cjs +67 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts +45 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts +45 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.js +67 -0
- package/dist/agents/middlewareAgent/middleware/modelFallback.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs +333 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts +155 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts +155 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.js +332 -0
- package/dist/agents/middlewareAgent/middleware/piiRedaction.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/promptCaching.cjs +64 -36
- package/dist/agents/middlewareAgent/middleware/promptCaching.cjs.map +1 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts +64 -19
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts +64 -19
- package/dist/agents/middlewareAgent/middleware/promptCaching.d.ts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/promptCaching.js +64 -36
- package/dist/agents/middlewareAgent/middleware/promptCaching.js.map +1 -1
- package/dist/agents/middlewareAgent/middleware/summarization.cjs +27 -35
- package/dist/agents/middlewareAgent/middleware/summarization.cjs.map +1 -1
- package/dist/agents/middlewareAgent/middleware/summarization.d.cts +12 -17
- package/dist/agents/middlewareAgent/middleware/summarization.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/summarization.d.ts +12 -17
- package/dist/agents/middlewareAgent/middleware/summarization.d.ts.map +1 -1
- package/dist/agents/middlewareAgent/middleware/summarization.js +28 -35
- package/dist/agents/middlewareAgent/middleware/summarization.js.map +1 -1
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs +242 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts +158 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts +158 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.js +240 -0
- package/dist/agents/middlewareAgent/middleware/toolCallLimit.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware/utils.cjs +26 -0
- package/dist/agents/middlewareAgent/middleware/utils.cjs.map +1 -0
- package/dist/agents/middlewareAgent/middleware/utils.d.cts +13 -0
- package/dist/agents/middlewareAgent/middleware/utils.d.cts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/utils.d.ts +13 -0
- package/dist/agents/middlewareAgent/middleware/utils.d.ts.map +1 -0
- package/dist/agents/middlewareAgent/middleware/utils.js +25 -0
- package/dist/agents/middlewareAgent/middleware/utils.js.map +1 -0
- package/dist/agents/middlewareAgent/middleware.cjs +9 -5
- package/dist/agents/middlewareAgent/middleware.cjs.map +1 -1
- package/dist/agents/middlewareAgent/middleware.d.cts +78 -7
- package/dist/agents/middlewareAgent/middleware.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/middleware.d.ts +78 -7
- package/dist/agents/middlewareAgent/middleware.d.ts.map +1 -1
- package/dist/agents/middlewareAgent/middleware.js +9 -5
- package/dist/agents/middlewareAgent/middleware.js.map +1 -1
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs +4 -4
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.cjs.map +1 -1
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.js +4 -4
- package/dist/agents/middlewareAgent/nodes/AfterModalNode.js.map +1 -1
- package/dist/agents/middlewareAgent/nodes/AgentNode.cjs +260 -117
- package/dist/agents/middlewareAgent/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/middlewareAgent/nodes/AgentNode.js +263 -120
- package/dist/agents/middlewareAgent/nodes/AgentNode.js.map +1 -1
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs +4 -4
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.cjs.map +1 -1
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js +4 -4
- package/dist/agents/middlewareAgent/nodes/BeforeModalNode.js.map +1 -1
- package/dist/agents/middlewareAgent/nodes/middleware.cjs +51 -25
- package/dist/agents/middlewareAgent/nodes/middleware.cjs.map +1 -1
- package/dist/agents/middlewareAgent/nodes/middleware.js +51 -26
- package/dist/agents/middlewareAgent/nodes/middleware.js.map +1 -1
- package/dist/agents/middlewareAgent/nodes/utils.cjs +20 -28
- package/dist/agents/middlewareAgent/nodes/utils.cjs.map +1 -1
- package/dist/agents/middlewareAgent/nodes/utils.js +20 -27
- package/dist/agents/middlewareAgent/nodes/utils.js.map +1 -1
- package/dist/agents/middlewareAgent/types.d.cts +182 -90
- package/dist/agents/middlewareAgent/types.d.cts.map +1 -1
- package/dist/agents/middlewareAgent/types.d.ts +182 -90
- package/dist/agents/middlewareAgent/types.d.ts.map +1 -1
- package/dist/agents/model.cjs +13 -0
- package/dist/agents/model.cjs.map +1 -0
- package/dist/agents/model.js +11 -0
- package/dist/agents/model.js.map +1 -0
- package/dist/agents/nodes/AgentNode.cjs +56 -28
- package/dist/agents/nodes/AgentNode.cjs.map +1 -1
- package/dist/agents/nodes/AgentNode.js +57 -29
- package/dist/agents/nodes/AgentNode.js.map +1 -1
- package/dist/agents/nodes/ToolNode.cjs +1 -1
- package/dist/agents/nodes/ToolNode.cjs.map +1 -1
- package/dist/agents/nodes/ToolNode.d.cts +2 -2
- package/dist/agents/nodes/ToolNode.js +1 -1
- package/dist/agents/nodes/ToolNode.js.map +1 -1
- package/dist/agents/responses.cjs +52 -10
- package/dist/agents/responses.cjs.map +1 -1
- package/dist/agents/responses.d.cts +12 -20
- package/dist/agents/responses.d.cts.map +1 -1
- package/dist/agents/responses.d.ts +12 -20
- package/dist/agents/responses.d.ts.map +1 -1
- package/dist/agents/responses.js +52 -11
- package/dist/agents/responses.js.map +1 -1
- package/dist/agents/tests/utils.cjs +77 -0
- package/dist/agents/tests/utils.cjs.map +1 -0
- package/dist/agents/tests/utils.d.cts +53 -0
- package/dist/agents/tests/utils.d.cts.map +1 -0
- package/dist/agents/tests/utils.d.ts +53 -0
- package/dist/agents/tests/utils.d.ts.map +1 -0
- package/dist/agents/tests/utils.js +76 -0
- package/dist/agents/tests/utils.js.map +1 -0
- package/dist/agents/types.cjs +7 -0
- package/dist/agents/types.cjs.map +1 -0
- package/dist/agents/types.d.cts +40 -7
- package/dist/agents/types.d.cts.map +1 -1
- package/dist/agents/types.d.ts +40 -7
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/agents/types.js +6 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/agents/utils.cjs +5 -23
- package/dist/agents/utils.cjs.map +1 -1
- package/dist/agents/utils.js +2 -19
- package/dist/agents/utils.js.map +1 -1
- package/dist/chat_models/universal.cjs +7 -0
- package/dist/chat_models/universal.cjs.map +1 -1
- package/dist/chat_models/universal.d.cts +7 -2
- package/dist/chat_models/universal.d.cts.map +1 -1
- package/dist/chat_models/universal.d.ts +7 -2
- package/dist/chat_models/universal.d.ts.map +1 -1
- package/dist/chat_models/universal.js +7 -0
- package/dist/chat_models/universal.js.map +1 -1
- package/dist/embeddings/cache_backed.d.ts +1 -1
- package/dist/hub/base.cjs +4 -1
- package/dist/hub/base.cjs.map +1 -1
- package/dist/hub/base.js +4 -1
- package/dist/hub/base.js.map +1 -1
- package/dist/index.cjs +97 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +24 -8
- package/dist/index.d.ts +24 -8
- package/dist/index.js +52 -6
- package/dist/index.js.map +1 -1
- package/dist/load/import_constants.cjs +0 -19
- package/dist/load/import_constants.cjs.map +1 -1
- package/dist/load/import_constants.js +0 -19
- package/dist/load/import_constants.js.map +1 -1
- package/dist/load/import_map.cjs +3 -114
- package/dist/load/import_map.cjs.map +1 -1
- package/dist/load/import_map.js +4 -115
- package/dist/load/import_map.js.map +1 -1
- package/dist/load/serializable.d.cts +1 -10
- package/dist/load/serializable.d.ts +1 -10
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs +5 -4
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.cjs.map +1 -1
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js +3 -2
- package/dist/node_modules/.pnpm/langsmith@0.3.64_@opentelemetry_api@1.9.0_openai@5.11.0_ws@8.18.3_bufferutil@4.0.9_utf-8-validate@6.0.5__zod@3.25.76_/node_modules/langsmith/dist/utils/async_caller.js.map +1 -1
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs +83 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js +79 -0
- package/dist/node_modules/.pnpm/p-retry@4.6.2/node_modules/p-retry/index.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs +16 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js +13 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/index.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs +77 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js +74 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry.js.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs +115 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.cjs.map +1 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js +112 -0
- package/dist/node_modules/.pnpm/retry@0.13.1/node_modules/retry/lib/retry_operation.js.map +1 -0
- package/dist/storage/encoder_backed.cjs +1 -1
- package/dist/storage/encoder_backed.d.cts +1 -1
- package/dist/storage/encoder_backed.d.ts +1 -1
- package/dist/storage/encoder_backed.js +1 -1
- package/dist/storage/file_system.cjs +1 -1
- package/dist/storage/file_system.js +1 -1
- package/package.json +39 -652
- package/dist/chains/analyze_documents_chain.cjs +0 -83
- package/dist/chains/analyze_documents_chain.cjs.map +0 -1
- package/dist/chains/analyze_documents_chain.d.cts +0 -58
- package/dist/chains/analyze_documents_chain.d.cts.map +0 -1
- package/dist/chains/analyze_documents_chain.d.ts +0 -58
- package/dist/chains/analyze_documents_chain.d.ts.map +0 -1
- package/dist/chains/analyze_documents_chain.js +0 -82
- package/dist/chains/analyze_documents_chain.js.map +0 -1
- package/dist/chains/api/api_chain.cjs +0 -100
- package/dist/chains/api/api_chain.cjs.map +0 -1
- package/dist/chains/api/api_chain.d.cts +0 -63
- package/dist/chains/api/api_chain.d.cts.map +0 -1
- package/dist/chains/api/api_chain.d.ts +0 -63
- package/dist/chains/api/api_chain.d.ts.map +0 -1
- package/dist/chains/api/api_chain.js +0 -100
- package/dist/chains/api/api_chain.js.map +0 -1
- package/dist/chains/api/prompts.cjs +0 -38
- package/dist/chains/api/prompts.cjs.map +0 -1
- package/dist/chains/api/prompts.js +0 -36
- package/dist/chains/api/prompts.js.map +0 -1
- package/dist/chains/base.cjs +0 -180
- package/dist/chains/base.cjs.map +0 -1
- package/dist/chains/base.d.cts +0 -88
- package/dist/chains/base.d.cts.map +0 -1
- package/dist/chains/base.d.ts +0 -88
- package/dist/chains/base.d.ts.map +0 -1
- package/dist/chains/base.js +0 -179
- package/dist/chains/base.js.map +0 -1
- package/dist/chains/chat_vector_db_chain.cjs +0 -130
- package/dist/chains/chat_vector_db_chain.cjs.map +0 -1
- package/dist/chains/chat_vector_db_chain.d.cts +0 -62
- package/dist/chains/chat_vector_db_chain.d.cts.map +0 -1
- package/dist/chains/chat_vector_db_chain.d.ts +0 -62
- package/dist/chains/chat_vector_db_chain.d.ts.map +0 -1
- package/dist/chains/chat_vector_db_chain.js +0 -129
- package/dist/chains/chat_vector_db_chain.js.map +0 -1
- package/dist/chains/combine_docs_chain.cjs +0 -275
- package/dist/chains/combine_docs_chain.cjs.map +0 -1
- package/dist/chains/combine_docs_chain.d.cts +0 -126
- package/dist/chains/combine_docs_chain.d.cts.map +0 -1
- package/dist/chains/combine_docs_chain.d.ts +0 -126
- package/dist/chains/combine_docs_chain.d.ts.map +0 -1
- package/dist/chains/combine_docs_chain.js +0 -272
- package/dist/chains/combine_docs_chain.js.map +0 -1
- package/dist/chains/combine_documents/base.cjs +0 -22
- package/dist/chains/combine_documents/base.cjs.map +0 -1
- package/dist/chains/combine_documents/base.js +0 -18
- package/dist/chains/combine_documents/base.js.map +0 -1
- package/dist/chains/combine_documents/index.cjs +0 -16
- package/dist/chains/combine_documents/index.cjs.map +0 -1
- package/dist/chains/combine_documents/index.d.cts +0 -2
- package/dist/chains/combine_documents/index.d.ts +0 -2
- package/dist/chains/combine_documents/index.js +0 -10
- package/dist/chains/combine_documents/index.js.map +0 -1
- package/dist/chains/combine_documents/reduce.cjs +0 -73
- package/dist/chains/combine_documents/reduce.cjs.map +0 -1
- package/dist/chains/combine_documents/reduce.d.cts +0 -36
- package/dist/chains/combine_documents/reduce.d.cts.map +0 -1
- package/dist/chains/combine_documents/reduce.d.ts +0 -36
- package/dist/chains/combine_documents/reduce.d.ts.map +0 -1
- package/dist/chains/combine_documents/reduce.js +0 -66
- package/dist/chains/combine_documents/reduce.js.map +0 -1
- package/dist/chains/combine_documents/stuff.cjs +0 -41
- package/dist/chains/combine_documents/stuff.cjs.map +0 -1
- package/dist/chains/combine_documents/stuff.d.cts +0 -40
- package/dist/chains/combine_documents/stuff.d.cts.map +0 -1
- package/dist/chains/combine_documents/stuff.d.ts +0 -40
- package/dist/chains/combine_documents/stuff.d.ts.map +0 -1
- package/dist/chains/combine_documents/stuff.js +0 -40
- package/dist/chains/combine_documents/stuff.js.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.cjs +0 -131
- package/dist/chains/constitutional_ai/constitutional_chain.cjs.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts +0 -79
- package/dist/chains/constitutional_ai/constitutional_chain.d.cts.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts +0 -79
- package/dist/chains/constitutional_ai/constitutional_chain.d.ts.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_chain.js +0 -131
- package/dist/chains/constitutional_ai/constitutional_chain.js.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_principle.cjs +0 -322
- package/dist/chains/constitutional_ai/constitutional_principle.cjs.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts +0 -50
- package/dist/chains/constitutional_ai/constitutional_principle.d.cts.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts +0 -50
- package/dist/chains/constitutional_ai/constitutional_principle.d.ts.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_principle.js +0 -320
- package/dist/chains/constitutional_ai/constitutional_principle.js.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs +0 -96
- package/dist/chains/constitutional_ai/constitutional_prompts.cjs.map +0 -1
- package/dist/chains/constitutional_ai/constitutional_prompts.js +0 -94
- package/dist/chains/constitutional_ai/constitutional_prompts.js.map +0 -1
- package/dist/chains/conversation.cjs +0 -50
- package/dist/chains/conversation.cjs.map +0 -1
- package/dist/chains/conversation.d.cts +0 -34
- package/dist/chains/conversation.d.cts.map +0 -1
- package/dist/chains/conversation.d.ts +0 -34
- package/dist/chains/conversation.d.ts.map +0 -1
- package/dist/chains/conversation.js +0 -48
- package/dist/chains/conversation.js.map +0 -1
- package/dist/chains/conversational_retrieval_chain.cjs +0 -218
- package/dist/chains/conversational_retrieval_chain.cjs.map +0 -1
- package/dist/chains/conversational_retrieval_chain.d.cts +0 -152
- package/dist/chains/conversational_retrieval_chain.d.cts.map +0 -1
- package/dist/chains/conversational_retrieval_chain.d.ts +0 -152
- package/dist/chains/conversational_retrieval_chain.d.ts.map +0 -1
- package/dist/chains/conversational_retrieval_chain.js +0 -217
- package/dist/chains/conversational_retrieval_chain.js.map +0 -1
- package/dist/chains/graph_qa/cypher.cjs +0 -133
- package/dist/chains/graph_qa/cypher.cjs.map +0 -1
- package/dist/chains/graph_qa/cypher.d.cts +0 -76
- package/dist/chains/graph_qa/cypher.d.cts.map +0 -1
- package/dist/chains/graph_qa/cypher.d.ts +0 -76
- package/dist/chains/graph_qa/cypher.d.ts.map +0 -1
- package/dist/chains/graph_qa/cypher.js +0 -126
- package/dist/chains/graph_qa/cypher.js.map +0 -1
- package/dist/chains/graph_qa/prompts.cjs +0 -46
- package/dist/chains/graph_qa/prompts.cjs.map +0 -1
- package/dist/chains/graph_qa/prompts.js +0 -44
- package/dist/chains/graph_qa/prompts.js.map +0 -1
- package/dist/chains/history_aware_retriever.cjs +0 -55
- package/dist/chains/history_aware_retriever.cjs.map +0 -1
- package/dist/chains/history_aware_retriever.d.cts +0 -64
- package/dist/chains/history_aware_retriever.d.cts.map +0 -1
- package/dist/chains/history_aware_retriever.d.ts +0 -64
- package/dist/chains/history_aware_retriever.d.ts.map +0 -1
- package/dist/chains/history_aware_retriever.js +0 -49
- package/dist/chains/history_aware_retriever.js.map +0 -1
- package/dist/chains/index.cjs +0 -106
- package/dist/chains/index.cjs.map +0 -1
- package/dist/chains/index.d.cts +0 -25
- package/dist/chains/index.d.ts +0 -25
- package/dist/chains/index.js +0 -67
- package/dist/chains/index.js.map +0 -1
- package/dist/chains/llm_chain.cjs +0 -155
- package/dist/chains/llm_chain.cjs.map +0 -1
- package/dist/chains/llm_chain.d.cts +0 -97
- package/dist/chains/llm_chain.d.cts.map +0 -1
- package/dist/chains/llm_chain.d.ts +0 -97
- package/dist/chains/llm_chain.d.ts.map +0 -1
- package/dist/chains/llm_chain.js +0 -154
- package/dist/chains/llm_chain.js.map +0 -1
- package/dist/chains/load.cjs +0 -48
- package/dist/chains/load.cjs.map +0 -1
- package/dist/chains/load.d.cts +0 -30
- package/dist/chains/load.d.cts.map +0 -1
- package/dist/chains/load.d.ts +0 -30
- package/dist/chains/load.d.ts.map +0 -1
- package/dist/chains/load.js +0 -42
- package/dist/chains/load.js.map +0 -1
- package/dist/chains/openai_functions/base.cjs +0 -139
- package/dist/chains/openai_functions/base.cjs.map +0 -1
- package/dist/chains/openai_functions/base.d.cts +0 -172
- package/dist/chains/openai_functions/base.d.cts.map +0 -1
- package/dist/chains/openai_functions/base.d.ts +0 -172
- package/dist/chains/openai_functions/base.d.ts.map +0 -1
- package/dist/chains/openai_functions/base.js +0 -137
- package/dist/chains/openai_functions/base.js.map +0 -1
- package/dist/chains/openai_functions/extraction.cjs +0 -71
- package/dist/chains/openai_functions/extraction.cjs.map +0 -1
- package/dist/chains/openai_functions/extraction.d.cts +0 -29
- package/dist/chains/openai_functions/extraction.d.cts.map +0 -1
- package/dist/chains/openai_functions/extraction.d.ts +0 -29
- package/dist/chains/openai_functions/extraction.d.ts.map +0 -1
- package/dist/chains/openai_functions/extraction.js +0 -69
- package/dist/chains/openai_functions/extraction.js.map +0 -1
- package/dist/chains/openai_functions/index.cjs +0 -33
- package/dist/chains/openai_functions/index.cjs.map +0 -1
- package/dist/chains/openai_functions/index.d.cts +0 -5
- package/dist/chains/openai_functions/index.d.ts +0 -5
- package/dist/chains/openai_functions/index.js +0 -21
- package/dist/chains/openai_functions/index.js.map +0 -1
- package/dist/chains/openai_functions/openapi.cjs +0 -287
- package/dist/chains/openai_functions/openapi.cjs.map +0 -1
- package/dist/chains/openai_functions/openapi.d.cts +0 -61
- package/dist/chains/openai_functions/openapi.d.cts.map +0 -1
- package/dist/chains/openai_functions/openapi.d.ts +0 -61
- package/dist/chains/openai_functions/openapi.d.ts.map +0 -1
- package/dist/chains/openai_functions/openapi.js +0 -285
- package/dist/chains/openai_functions/openapi.js.map +0 -1
- package/dist/chains/openai_functions/tagging.cjs +0 -72
- package/dist/chains/openai_functions/tagging.cjs.map +0 -1
- package/dist/chains/openai_functions/tagging.d.cts +0 -47
- package/dist/chains/openai_functions/tagging.d.cts.map +0 -1
- package/dist/chains/openai_functions/tagging.d.ts +0 -47
- package/dist/chains/openai_functions/tagging.d.ts.map +0 -1
- package/dist/chains/openai_functions/tagging.js +0 -70
- package/dist/chains/openai_functions/tagging.js.map +0 -1
- package/dist/chains/query_constructor/index.cjs +0 -145
- package/dist/chains/query_constructor/index.cjs.map +0 -1
- package/dist/chains/query_constructor/index.d.cts +0 -82
- package/dist/chains/query_constructor/index.d.cts.map +0 -1
- package/dist/chains/query_constructor/index.d.ts +0 -82
- package/dist/chains/query_constructor/index.d.ts.map +0 -1
- package/dist/chains/query_constructor/index.js +0 -130
- package/dist/chains/query_constructor/index.js.map +0 -1
- package/dist/chains/query_constructor/ir.cjs +0 -22
- package/dist/chains/query_constructor/ir.cjs.map +0 -1
- package/dist/chains/query_constructor/ir.d.cts +0 -1
- package/dist/chains/query_constructor/ir.d.ts +0 -1
- package/dist/chains/query_constructor/ir.js +0 -12
- package/dist/chains/query_constructor/ir.js.map +0 -1
- package/dist/chains/query_constructor/parser.cjs +0 -80
- package/dist/chains/query_constructor/parser.cjs.map +0 -1
- package/dist/chains/query_constructor/parser.d.cts +0 -43
- package/dist/chains/query_constructor/parser.d.cts.map +0 -1
- package/dist/chains/query_constructor/parser.d.ts +0 -43
- package/dist/chains/query_constructor/parser.d.ts.map +0 -1
- package/dist/chains/query_constructor/parser.js +0 -79
- package/dist/chains/query_constructor/parser.js.map +0 -1
- package/dist/chains/query_constructor/prompt.cjs +0 -137
- package/dist/chains/query_constructor/prompt.cjs.map +0 -1
- package/dist/chains/query_constructor/prompt.d.cts +0 -22
- package/dist/chains/query_constructor/prompt.d.cts.map +0 -1
- package/dist/chains/query_constructor/prompt.d.ts +0 -22
- package/dist/chains/query_constructor/prompt.d.ts.map +0 -1
- package/dist/chains/query_constructor/prompt.js +0 -132
- package/dist/chains/query_constructor/prompt.js.map +0 -1
- package/dist/chains/question_answering/load.cjs +0 -99
- package/dist/chains/question_answering/load.cjs.map +0 -1
- package/dist/chains/question_answering/load.d.cts +0 -72
- package/dist/chains/question_answering/load.d.cts.map +0 -1
- package/dist/chains/question_answering/load.d.ts +0 -72
- package/dist/chains/question_answering/load.d.ts.map +0 -1
- package/dist/chains/question_answering/load.js +0 -96
- package/dist/chains/question_answering/load.js.map +0 -1
- package/dist/chains/question_answering/map_reduce_prompts.cjs +0 -61
- package/dist/chains/question_answering/map_reduce_prompts.cjs.map +0 -1
- package/dist/chains/question_answering/map_reduce_prompts.js +0 -59
- package/dist/chains/question_answering/map_reduce_prompts.js.map +0 -1
- package/dist/chains/question_answering/refine_prompts.cjs +0 -60
- package/dist/chains/question_answering/refine_prompts.cjs.map +0 -1
- package/dist/chains/question_answering/refine_prompts.js +0 -58
- package/dist/chains/question_answering/refine_prompts.js.map +0 -1
- package/dist/chains/question_answering/stuff_prompts.cjs +0 -20
- package/dist/chains/question_answering/stuff_prompts.cjs.map +0 -1
- package/dist/chains/question_answering/stuff_prompts.js +0 -19
- package/dist/chains/question_answering/stuff_prompts.js.map +0 -1
- package/dist/chains/retrieval.cjs +0 -55
- package/dist/chains/retrieval.cjs.map +0 -1
- package/dist/chains/retrieval.d.cts +0 -77
- package/dist/chains/retrieval.d.cts.map +0 -1
- package/dist/chains/retrieval.d.ts +0 -77
- package/dist/chains/retrieval.d.ts.map +0 -1
- package/dist/chains/retrieval.js +0 -49
- package/dist/chains/retrieval.js.map +0 -1
- package/dist/chains/retrieval_qa.cjs +0 -106
- package/dist/chains/retrieval_qa.cjs.map +0 -1
- package/dist/chains/retrieval_qa.d.cts +0 -81
- package/dist/chains/retrieval_qa.d.cts.map +0 -1
- package/dist/chains/retrieval_qa.d.ts +0 -81
- package/dist/chains/retrieval_qa.d.ts.map +0 -1
- package/dist/chains/retrieval_qa.js +0 -106
- package/dist/chains/retrieval_qa.js.map +0 -1
- package/dist/chains/router/llm_router.cjs +0 -50
- package/dist/chains/router/llm_router.cjs.map +0 -1
- package/dist/chains/router/llm_router.d.cts +0 -54
- package/dist/chains/router/llm_router.d.cts.map +0 -1
- package/dist/chains/router/llm_router.d.ts +0 -54
- package/dist/chains/router/llm_router.d.ts.map +0 -1
- package/dist/chains/router/llm_router.js +0 -50
- package/dist/chains/router/llm_router.js.map +0 -1
- package/dist/chains/router/multi_prompt.cjs +0 -116
- package/dist/chains/router/multi_prompt.cjs.map +0 -1
- package/dist/chains/router/multi_prompt.d.cts +0 -76
- package/dist/chains/router/multi_prompt.d.cts.map +0 -1
- package/dist/chains/router/multi_prompt.d.ts +0 -76
- package/dist/chains/router/multi_prompt.d.ts.map +0 -1
- package/dist/chains/router/multi_prompt.js +0 -115
- package/dist/chains/router/multi_prompt.js.map +0 -1
- package/dist/chains/router/multi_prompt_prompt.cjs +0 -22
- package/dist/chains/router/multi_prompt_prompt.cjs.map +0 -1
- package/dist/chains/router/multi_prompt_prompt.js +0 -21
- package/dist/chains/router/multi_prompt_prompt.js.map +0 -1
- package/dist/chains/router/multi_retrieval_prompt.cjs +0 -22
- package/dist/chains/router/multi_retrieval_prompt.cjs.map +0 -1
- package/dist/chains/router/multi_retrieval_prompt.js +0 -21
- package/dist/chains/router/multi_retrieval_prompt.js.map +0 -1
- package/dist/chains/router/multi_retrieval_qa.cjs +0 -137
- package/dist/chains/router/multi_retrieval_qa.cjs.map +0 -1
- package/dist/chains/router/multi_retrieval_qa.d.cts +0 -100
- package/dist/chains/router/multi_retrieval_qa.d.cts.map +0 -1
- package/dist/chains/router/multi_retrieval_qa.d.ts +0 -100
- package/dist/chains/router/multi_retrieval_qa.d.ts.map +0 -1
- package/dist/chains/router/multi_retrieval_qa.js +0 -136
- package/dist/chains/router/multi_retrieval_qa.js.map +0 -1
- package/dist/chains/router/multi_route.cjs +0 -69
- package/dist/chains/router/multi_route.cjs.map +0 -1
- package/dist/chains/router/multi_route.d.cts +0 -69
- package/dist/chains/router/multi_route.d.cts.map +0 -1
- package/dist/chains/router/multi_route.d.ts +0 -69
- package/dist/chains/router/multi_route.d.ts.map +0 -1
- package/dist/chains/router/multi_route.js +0 -68
- package/dist/chains/router/multi_route.js.map +0 -1
- package/dist/chains/router/utils.cjs +0 -18
- package/dist/chains/router/utils.cjs.map +0 -1
- package/dist/chains/router/utils.js +0 -17
- package/dist/chains/router/utils.js.map +0 -1
- package/dist/chains/sequential_chain.cjs +0 -255
- package/dist/chains/sequential_chain.cjs.map +0 -1
- package/dist/chains/sequential_chain.d.cts +0 -158
- package/dist/chains/sequential_chain.d.cts.map +0 -1
- package/dist/chains/sequential_chain.d.ts +0 -158
- package/dist/chains/sequential_chain.d.ts.map +0 -1
- package/dist/chains/sequential_chain.js +0 -254
- package/dist/chains/sequential_chain.js.map +0 -1
- package/dist/chains/serde.d.cts +0 -156
- package/dist/chains/serde.d.cts.map +0 -1
- package/dist/chains/serde.d.ts +0 -156
- package/dist/chains/serde.d.ts.map +0 -1
- package/dist/chains/sql_db/index.cjs +0 -35
- package/dist/chains/sql_db/index.cjs.map +0 -1
- package/dist/chains/sql_db/index.d.cts +0 -3
- package/dist/chains/sql_db/index.d.ts +0 -3
- package/dist/chains/sql_db/index.js +0 -21
- package/dist/chains/sql_db/index.js.map +0 -1
- package/dist/chains/sql_db/sql_db_chain.cjs +0 -196
- package/dist/chains/sql_db/sql_db_chain.cjs.map +0 -1
- package/dist/chains/sql_db/sql_db_chain.d.cts +0 -124
- package/dist/chains/sql_db/sql_db_chain.d.cts.map +0 -1
- package/dist/chains/sql_db/sql_db_chain.d.ts +0 -124
- package/dist/chains/sql_db/sql_db_chain.d.ts.map +0 -1
- package/dist/chains/sql_db/sql_db_chain.js +0 -194
- package/dist/chains/sql_db/sql_db_chain.js.map +0 -1
- package/dist/chains/sql_db/sql_db_prompt.cjs +0 -194
- package/dist/chains/sql_db/sql_db_prompt.cjs.map +0 -1
- package/dist/chains/sql_db/sql_db_prompt.d.cts +0 -44
- package/dist/chains/sql_db/sql_db_prompt.d.cts.map +0 -1
- package/dist/chains/sql_db/sql_db_prompt.d.ts +0 -44
- package/dist/chains/sql_db/sql_db_prompt.d.ts.map +0 -1
- package/dist/chains/sql_db/sql_db_prompt.js +0 -186
- package/dist/chains/sql_db/sql_db_prompt.js.map +0 -1
- package/dist/chains/summarization/load.cjs +0 -74
- package/dist/chains/summarization/load.cjs.map +0 -1
- package/dist/chains/summarization/load.d.cts +0 -33
- package/dist/chains/summarization/load.d.cts.map +0 -1
- package/dist/chains/summarization/load.d.ts +0 -33
- package/dist/chains/summarization/load.d.ts.map +0 -1
- package/dist/chains/summarization/load.js +0 -74
- package/dist/chains/summarization/load.js.map +0 -1
- package/dist/chains/summarization/refine_prompts.cjs +0 -24
- package/dist/chains/summarization/refine_prompts.cjs.map +0 -1
- package/dist/chains/summarization/refine_prompts.js +0 -23
- package/dist/chains/summarization/refine_prompts.js.map +0 -1
- package/dist/chains/summarization/stuff_prompts.cjs +0 -19
- package/dist/chains/summarization/stuff_prompts.cjs.map +0 -1
- package/dist/chains/summarization/stuff_prompts.js +0 -18
- package/dist/chains/summarization/stuff_prompts.js.map +0 -1
- package/dist/chains/transform.cjs +0 -43
- package/dist/chains/transform.cjs.map +0 -1
- package/dist/chains/transform.d.cts +0 -44
- package/dist/chains/transform.d.cts.map +0 -1
- package/dist/chains/transform.d.ts +0 -44
- package/dist/chains/transform.d.ts.map +0 -1
- package/dist/chains/transform.js +0 -43
- package/dist/chains/transform.js.map +0 -1
- package/dist/chains/vector_db_qa.cjs +0 -95
- package/dist/chains/vector_db_qa.cjs.map +0 -1
- package/dist/chains/vector_db_qa.d.cts +0 -66
- package/dist/chains/vector_db_qa.d.cts.map +0 -1
- package/dist/chains/vector_db_qa.d.ts +0 -66
- package/dist/chains/vector_db_qa.d.ts.map +0 -1
- package/dist/chains/vector_db_qa.js +0 -95
- package/dist/chains/vector_db_qa.js.map +0 -1
- package/dist/document.cjs +0 -21
- package/dist/document.cjs.map +0 -1
- package/dist/document.d.cts +0 -2
- package/dist/document.d.ts +0 -2
- package/dist/document.js +0 -10
- package/dist/document.js.map +0 -1
- package/dist/document_loaders/base.cjs +0 -22
- package/dist/document_loaders/base.cjs.map +0 -1
- package/dist/document_loaders/base.d.cts +0 -1
- package/dist/document_loaders/base.d.ts +0 -1
- package/dist/document_loaders/base.js +0 -12
- package/dist/document_loaders/base.js.map +0 -1
- package/dist/document_loaders/fs/buffer.cjs +0 -69
- package/dist/document_loaders/fs/buffer.cjs.map +0 -1
- package/dist/document_loaders/fs/buffer.d.cts +0 -46
- package/dist/document_loaders/fs/buffer.d.cts.map +0 -1
- package/dist/document_loaders/fs/buffer.d.ts +0 -46
- package/dist/document_loaders/fs/buffer.d.ts.map +0 -1
- package/dist/document_loaders/fs/buffer.js +0 -63
- package/dist/document_loaders/fs/buffer.js.map +0 -1
- package/dist/document_loaders/fs/directory.cjs +0 -116
- package/dist/document_loaders/fs/directory.cjs.map +0 -1
- package/dist/document_loaders/fs/directory.d.cts +0 -76
- package/dist/document_loaders/fs/directory.d.cts.map +0 -1
- package/dist/document_loaders/fs/directory.d.ts +0 -76
- package/dist/document_loaders/fs/directory.d.ts.map +0 -1
- package/dist/document_loaders/fs/directory.js +0 -109
- package/dist/document_loaders/fs/directory.js.map +0 -1
- package/dist/document_loaders/fs/json.cjs +0 -128
- package/dist/document_loaders/fs/json.cjs.map +0 -1
- package/dist/document_loaders/fs/json.d.cts +0 -65
- package/dist/document_loaders/fs/json.d.cts.map +0 -1
- package/dist/document_loaders/fs/json.d.ts +0 -65
- package/dist/document_loaders/fs/json.d.ts.map +0 -1
- package/dist/document_loaders/fs/json.js +0 -121
- package/dist/document_loaders/fs/json.js.map +0 -1
- package/dist/document_loaders/fs/multi_file.cjs +0 -82
- package/dist/document_loaders/fs/multi_file.cjs.map +0 -1
- package/dist/document_loaders/fs/multi_file.d.cts +0 -43
- package/dist/document_loaders/fs/multi_file.d.cts.map +0 -1
- package/dist/document_loaders/fs/multi_file.d.ts +0 -43
- package/dist/document_loaders/fs/multi_file.d.ts.map +0 -1
- package/dist/document_loaders/fs/multi_file.js +0 -76
- package/dist/document_loaders/fs/multi_file.js.map +0 -1
- package/dist/document_loaders/fs/text.cjs +0 -101
- package/dist/document_loaders/fs/text.cjs.map +0 -1
- package/dist/document_loaders/fs/text.d.cts +0 -57
- package/dist/document_loaders/fs/text.d.cts.map +0 -1
- package/dist/document_loaders/fs/text.d.ts +0 -57
- package/dist/document_loaders/fs/text.d.ts.map +0 -1
- package/dist/document_loaders/fs/text.js +0 -95
- package/dist/document_loaders/fs/text.js.map +0 -1
- package/dist/evaluation/agents/index.cjs +0 -1
- package/dist/evaluation/agents/index.js +0 -1
- package/dist/evaluation/agents/prompt.cjs +0 -132
- package/dist/evaluation/agents/prompt.cjs.map +0 -1
- package/dist/evaluation/agents/prompt.js +0 -130
- package/dist/evaluation/agents/prompt.js.map +0 -1
- package/dist/evaluation/agents/trajectory.cjs +0 -132
- package/dist/evaluation/agents/trajectory.cjs.map +0 -1
- package/dist/evaluation/agents/trajectory.d.cts +0 -61
- package/dist/evaluation/agents/trajectory.d.cts.map +0 -1
- package/dist/evaluation/agents/trajectory.d.ts +0 -61
- package/dist/evaluation/agents/trajectory.d.ts.map +0 -1
- package/dist/evaluation/agents/trajectory.js +0 -130
- package/dist/evaluation/agents/trajectory.js.map +0 -1
- package/dist/evaluation/base.cjs +0 -169
- package/dist/evaluation/base.cjs.map +0 -1
- package/dist/evaluation/base.d.cts +0 -240
- package/dist/evaluation/base.d.cts.map +0 -1
- package/dist/evaluation/base.d.ts +0 -240
- package/dist/evaluation/base.d.ts.map +0 -1
- package/dist/evaluation/base.js +0 -164
- package/dist/evaluation/base.js.map +0 -1
- package/dist/evaluation/comparison/index.cjs +0 -1
- package/dist/evaluation/comparison/index.js +0 -1
- package/dist/evaluation/comparison/pairwise.cjs +0 -178
- package/dist/evaluation/comparison/pairwise.cjs.map +0 -1
- package/dist/evaluation/comparison/pairwise.d.cts +0 -56
- package/dist/evaluation/comparison/pairwise.d.cts.map +0 -1
- package/dist/evaluation/comparison/pairwise.d.ts +0 -56
- package/dist/evaluation/comparison/pairwise.d.ts.map +0 -1
- package/dist/evaluation/comparison/pairwise.js +0 -175
- package/dist/evaluation/comparison/pairwise.js.map +0 -1
- package/dist/evaluation/comparison/prompt.cjs +0 -77
- package/dist/evaluation/comparison/prompt.cjs.map +0 -1
- package/dist/evaluation/comparison/prompt.js +0 -75
- package/dist/evaluation/comparison/prompt.js.map +0 -1
- package/dist/evaluation/criteria/criteria.cjs +0 -164
- package/dist/evaluation/criteria/criteria.cjs.map +0 -1
- package/dist/evaluation/criteria/criteria.d.cts +0 -85
- package/dist/evaluation/criteria/criteria.d.cts.map +0 -1
- package/dist/evaluation/criteria/criteria.d.ts +0 -85
- package/dist/evaluation/criteria/criteria.d.ts.map +0 -1
- package/dist/evaluation/criteria/criteria.js +0 -161
- package/dist/evaluation/criteria/criteria.js.map +0 -1
- package/dist/evaluation/criteria/index.cjs +0 -1
- package/dist/evaluation/criteria/index.js +0 -1
- package/dist/evaluation/criteria/prompt.cjs +0 -50
- package/dist/evaluation/criteria/prompt.cjs.map +0 -1
- package/dist/evaluation/criteria/prompt.js +0 -48
- package/dist/evaluation/criteria/prompt.js.map +0 -1
- package/dist/evaluation/embedding_distance/base.cjs +0 -108
- package/dist/evaluation/embedding_distance/base.cjs.map +0 -1
- package/dist/evaluation/embedding_distance/base.d.cts +0 -82
- package/dist/evaluation/embedding_distance/base.d.cts.map +0 -1
- package/dist/evaluation/embedding_distance/base.d.ts +0 -82
- package/dist/evaluation/embedding_distance/base.d.ts.map +0 -1
- package/dist/evaluation/embedding_distance/base.js +0 -105
- package/dist/evaluation/embedding_distance/base.js.map +0 -1
- package/dist/evaluation/embedding_distance/index.cjs +0 -1
- package/dist/evaluation/embedding_distance/index.js +0 -1
- package/dist/evaluation/index.cjs +0 -54
- package/dist/evaluation/index.cjs.map +0 -1
- package/dist/evaluation/index.d.cts +0 -8
- package/dist/evaluation/index.d.ts +0 -8
- package/dist/evaluation/index.js +0 -35
- package/dist/evaluation/index.js.map +0 -1
- package/dist/evaluation/loader.cjs +0 -57
- package/dist/evaluation/loader.cjs.map +0 -1
- package/dist/evaluation/loader.d.cts +0 -38
- package/dist/evaluation/loader.d.cts.map +0 -1
- package/dist/evaluation/loader.d.ts +0 -38
- package/dist/evaluation/loader.d.ts.map +0 -1
- package/dist/evaluation/loader.js +0 -56
- package/dist/evaluation/loader.js.map +0 -1
- package/dist/evaluation/qa/eval_chain.cjs +0 -41
- package/dist/evaluation/qa/eval_chain.cjs.map +0 -1
- package/dist/evaluation/qa/eval_chain.d.cts +0 -22
- package/dist/evaluation/qa/eval_chain.d.cts.map +0 -1
- package/dist/evaluation/qa/eval_chain.d.ts +0 -22
- package/dist/evaluation/qa/eval_chain.d.ts.map +0 -1
- package/dist/evaluation/qa/eval_chain.js +0 -41
- package/dist/evaluation/qa/eval_chain.js.map +0 -1
- package/dist/evaluation/qa/index.cjs +0 -1
- package/dist/evaluation/qa/index.js +0 -1
- package/dist/evaluation/qa/prompt.cjs +0 -31
- package/dist/evaluation/qa/prompt.cjs.map +0 -1
- package/dist/evaluation/qa/prompt.js +0 -30
- package/dist/evaluation/qa/prompt.js.map +0 -1
- package/dist/evaluation/types.d.cts +0 -40
- package/dist/evaluation/types.d.cts.map +0 -1
- package/dist/evaluation/types.d.ts +0 -40
- package/dist/evaluation/types.d.ts.map +0 -1
- package/dist/langchain-core/dist/load/map_keys.d.cts +0 -10
- package/dist/langchain-core/dist/load/map_keys.d.cts.map +0 -1
- package/dist/langchain-core/dist/load/serializable.d.cts +0 -82
- package/dist/langchain-core/dist/load/serializable.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/base.d.cts +0 -125
- package/dist/langchain-core/dist/messages/base.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/content/base.d.cts +0 -22
- package/dist/langchain-core/dist/messages/content/base.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/content/data.d.cts +0 -96
- package/dist/langchain-core/dist/messages/content/data.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/content/index.d.cts +0 -102
- package/dist/langchain-core/dist/messages/content/index.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/content/multimodal.d.cts +0 -110
- package/dist/langchain-core/dist/messages/content/multimodal.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/content/tools.d.cts +0 -153
- package/dist/langchain-core/dist/messages/content/tools.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/message.d.cts +0 -598
- package/dist/langchain-core/dist/messages/message.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/metadata.d.cts +0 -97
- package/dist/langchain-core/dist/messages/metadata.d.cts.map +0 -1
- package/dist/langchain-core/dist/messages/utils.d.cts +0 -75
- package/dist/langchain-core/dist/messages/utils.d.cts.map +0 -1
- package/dist/langchain-core/dist/prompt_values.d.cts +0 -13
- package/dist/langchain-core/dist/prompt_values.d.cts.map +0 -1
- package/dist/langchain-core/dist/utils/types/index.d.cts +0 -8
- package/dist/langchain-core/dist/utils/types/index.d.cts.map +0 -1
- package/dist/libs/langchain-core/dist/load/map_keys.d.ts +0 -10
- package/dist/libs/langchain-core/dist/load/map_keys.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/load/serializable.d.ts +0 -82
- package/dist/libs/langchain-core/dist/load/serializable.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/base.d.ts +0 -125
- package/dist/libs/langchain-core/dist/messages/base.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/content/base.d.ts +0 -22
- package/dist/libs/langchain-core/dist/messages/content/base.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/content/data.d.ts +0 -96
- package/dist/libs/langchain-core/dist/messages/content/data.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/content/index.d.ts +0 -102
- package/dist/libs/langchain-core/dist/messages/content/index.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts +0 -110
- package/dist/libs/langchain-core/dist/messages/content/multimodal.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/content/tools.d.ts +0 -153
- package/dist/libs/langchain-core/dist/messages/content/tools.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/message.d.ts +0 -598
- package/dist/libs/langchain-core/dist/messages/message.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/metadata.d.ts +0 -97
- package/dist/libs/langchain-core/dist/messages/metadata.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/messages/utils.d.ts +0 -75
- package/dist/libs/langchain-core/dist/messages/utils.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/prompt_values.d.ts +0 -13
- package/dist/libs/langchain-core/dist/prompt_values.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/utils/types/index.d.ts +0 -10
- package/dist/libs/langchain-core/dist/utils/types/index.d.ts.map +0 -1
- package/dist/libs/langchain-core/dist/utils/types/zod.d.ts +0 -1
- package/dist/load/map_keys.d.cts +0 -8
- package/dist/load/map_keys.d.cts.map +0 -1
- package/dist/load/map_keys.d.ts +0 -8
- package/dist/load/map_keys.d.ts.map +0 -1
- package/dist/load/serializable.d.cts.map +0 -1
- package/dist/load/serializable.d.ts.map +0 -1
- package/dist/memory/buffer_memory.cjs +0 -80
- package/dist/memory/buffer_memory.cjs.map +0 -1
- package/dist/memory/buffer_memory.d.cts +0 -67
- package/dist/memory/buffer_memory.d.cts.map +0 -1
- package/dist/memory/buffer_memory.d.ts +0 -67
- package/dist/memory/buffer_memory.d.ts.map +0 -1
- package/dist/memory/buffer_memory.js +0 -79
- package/dist/memory/buffer_memory.js.map +0 -1
- package/dist/memory/buffer_token_memory.cjs +0 -80
- package/dist/memory/buffer_token_memory.cjs.map +0 -1
- package/dist/memory/buffer_token_memory.d.cts +0 -67
- package/dist/memory/buffer_token_memory.d.cts.map +0 -1
- package/dist/memory/buffer_token_memory.d.ts +0 -67
- package/dist/memory/buffer_token_memory.d.ts.map +0 -1
- package/dist/memory/buffer_token_memory.js +0 -79
- package/dist/memory/buffer_token_memory.js.map +0 -1
- package/dist/memory/buffer_window_memory.cjs +0 -77
- package/dist/memory/buffer_window_memory.cjs.map +0 -1
- package/dist/memory/buffer_window_memory.d.cts +0 -64
- package/dist/memory/buffer_window_memory.d.cts.map +0 -1
- package/dist/memory/buffer_window_memory.d.ts +0 -64
- package/dist/memory/buffer_window_memory.d.ts.map +0 -1
- package/dist/memory/buffer_window_memory.js +0 -76
- package/dist/memory/buffer_window_memory.js.map +0 -1
- package/dist/memory/chat_memory.cjs +0 -53
- package/dist/memory/chat_memory.cjs.map +0 -1
- package/dist/memory/chat_memory.d.cts +0 -42
- package/dist/memory/chat_memory.d.cts.map +0 -1
- package/dist/memory/chat_memory.d.ts +0 -42
- package/dist/memory/chat_memory.d.ts.map +0 -1
- package/dist/memory/chat_memory.js +0 -47
- package/dist/memory/chat_memory.js.map +0 -1
- package/dist/memory/combined_memory.cjs +0 -88
- package/dist/memory/combined_memory.cjs.map +0 -1
- package/dist/memory/combined_memory.d.cts +0 -60
- package/dist/memory/combined_memory.d.cts.map +0 -1
- package/dist/memory/combined_memory.d.ts +0 -60
- package/dist/memory/combined_memory.d.ts.map +0 -1
- package/dist/memory/combined_memory.js +0 -88
- package/dist/memory/combined_memory.js.map +0 -1
- package/dist/memory/entity_memory.cjs +0 -144
- package/dist/memory/entity_memory.cjs.map +0 -1
- package/dist/memory/entity_memory.d.cts +0 -99
- package/dist/memory/entity_memory.d.cts.map +0 -1
- package/dist/memory/entity_memory.d.ts +0 -99
- package/dist/memory/entity_memory.d.ts.map +0 -1
- package/dist/memory/entity_memory.js +0 -143
- package/dist/memory/entity_memory.js.map +0 -1
- package/dist/memory/index.cjs +0 -85
- package/dist/memory/index.cjs.map +0 -1
- package/dist/memory/index.d.cts +0 -14
- package/dist/memory/index.d.ts +0 -14
- package/dist/memory/index.js +0 -39
- package/dist/memory/index.js.map +0 -1
- package/dist/memory/prompt.cjs +0 -124
- package/dist/memory/prompt.cjs.map +0 -1
- package/dist/memory/prompt.d.cts +0 -12
- package/dist/memory/prompt.d.cts.map +0 -1
- package/dist/memory/prompt.d.ts +0 -12
- package/dist/memory/prompt.d.ts.map +0 -1
- package/dist/memory/prompt.js +0 -120
- package/dist/memory/prompt.js.map +0 -1
- package/dist/memory/stores/entity/base.cjs +0 -13
- package/dist/memory/stores/entity/base.cjs.map +0 -1
- package/dist/memory/stores/entity/base.d.cts +0 -18
- package/dist/memory/stores/entity/base.d.cts.map +0 -1
- package/dist/memory/stores/entity/base.d.ts +0 -18
- package/dist/memory/stores/entity/base.d.ts.map +0 -1
- package/dist/memory/stores/entity/base.js +0 -12
- package/dist/memory/stores/entity/base.js.map +0 -1
- package/dist/memory/stores/entity/in_memory.cjs +0 -64
- package/dist/memory/stores/entity/in_memory.cjs.map +0 -1
- package/dist/memory/stores/entity/in_memory.js +0 -64
- package/dist/memory/stores/entity/in_memory.js.map +0 -1
- package/dist/memory/summary.cjs +0 -127
- package/dist/memory/summary.cjs.map +0 -1
- package/dist/memory/summary.d.cts +0 -101
- package/dist/memory/summary.d.cts.map +0 -1
- package/dist/memory/summary.d.ts +0 -101
- package/dist/memory/summary.d.ts.map +0 -1
- package/dist/memory/summary.js +0 -125
- package/dist/memory/summary.js.map +0 -1
- package/dist/memory/summary_buffer.cjs +0 -117
- package/dist/memory/summary_buffer.cjs.map +0 -1
- package/dist/memory/summary_buffer.d.cts +0 -90
- package/dist/memory/summary_buffer.d.cts.map +0 -1
- package/dist/memory/summary_buffer.d.ts +0 -90
- package/dist/memory/summary_buffer.d.ts.map +0 -1
- package/dist/memory/summary_buffer.js +0 -116
- package/dist/memory/summary_buffer.js.map +0 -1
- package/dist/memory/vector_store.cjs +0 -87
- package/dist/memory/vector_store.cjs.map +0 -1
- package/dist/memory/vector_store.d.cts +0 -81
- package/dist/memory/vector_store.d.cts.map +0 -1
- package/dist/memory/vector_store.d.ts +0 -81
- package/dist/memory/vector_store.d.ts.map +0 -1
- package/dist/memory/vector_store.js +0 -86
- package/dist/memory/vector_store.js.map +0 -1
- package/dist/output_parsers/combining.cjs +0 -61
- package/dist/output_parsers/combining.cjs.map +0 -1
- package/dist/output_parsers/combining.d.cts +0 -46
- package/dist/output_parsers/combining.d.cts.map +0 -1
- package/dist/output_parsers/combining.d.ts +0 -46
- package/dist/output_parsers/combining.d.ts.map +0 -1
- package/dist/output_parsers/combining.js +0 -60
- package/dist/output_parsers/combining.js.map +0 -1
- package/dist/output_parsers/datetime.cjs +0 -46
- package/dist/output_parsers/datetime.cjs.map +0 -1
- package/dist/output_parsers/datetime.d.cts +0 -33
- package/dist/output_parsers/datetime.d.cts.map +0 -1
- package/dist/output_parsers/datetime.d.ts +0 -33
- package/dist/output_parsers/datetime.d.ts.map +0 -1
- package/dist/output_parsers/datetime.js +0 -45
- package/dist/output_parsers/datetime.js.map +0 -1
- package/dist/output_parsers/expression.cjs +0 -86
- package/dist/output_parsers/expression.cjs.map +0 -1
- package/dist/output_parsers/expression.d.cts +0 -53
- package/dist/output_parsers/expression.d.cts.map +0 -1
- package/dist/output_parsers/expression.d.ts +0 -53
- package/dist/output_parsers/expression.d.ts.map +0 -1
- package/dist/output_parsers/expression.js +0 -79
- package/dist/output_parsers/expression.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs +0 -38
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js +0 -38
- package/dist/output_parsers/expression_type_handlers/array_literal_expression_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/base.cjs +0 -130
- package/dist/output_parsers/expression_type_handlers/base.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/base.d.cts +0 -108
- package/dist/output_parsers/expression_type_handlers/base.d.cts.map +0 -1
- package/dist/output_parsers/expression_type_handlers/base.d.ts +0 -108
- package/dist/output_parsers/expression_type_handlers/base.d.ts.map +0 -1
- package/dist/output_parsers/expression_type_handlers/base.js +0 -129
- package/dist/output_parsers/expression_type_handlers/base.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs +0 -38
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js +0 -38
- package/dist/output_parsers/expression_type_handlers/boolean_literal_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs +0 -64
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.js +0 -64
- package/dist/output_parsers/expression_type_handlers/call_expression_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.cjs +0 -68
- package/dist/output_parsers/expression_type_handlers/factory.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.cts +0 -35
- package/dist/output_parsers/expression_type_handlers/factory.d.cts.map +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.d.ts +0 -35
- package/dist/output_parsers/expression_type_handlers/factory.d.ts.map +0 -1
- package/dist/output_parsers/expression_type_handlers/factory.js +0 -68
- package/dist/output_parsers/expression_type_handlers/factory.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs +0 -299
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js +0 -298
- package/dist/output_parsers/expression_type_handlers/grammar/parser_grammar.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs +0 -40
- package/dist/output_parsers/expression_type_handlers/identifier_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/identifier_handler.js +0 -40
- package/dist/output_parsers/expression_type_handlers/identifier_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs +0 -48
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.js +0 -48
- package/dist/output_parsers/expression_type_handlers/member_expression_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs +0 -36
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js +0 -36
- package/dist/output_parsers/expression_type_handlers/numeric_literal_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs +0 -40
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js +0 -40
- package/dist/output_parsers/expression_type_handlers/object_literal_expression_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs +0 -45
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js +0 -45
- package/dist/output_parsers/expression_type_handlers/property_assignment_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs +0 -37
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.cjs.map +0 -1
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.js +0 -37
- package/dist/output_parsers/expression_type_handlers/string_literal_handler.js.map +0 -1
- package/dist/output_parsers/expression_type_handlers/types.d.cts +0 -95
- package/dist/output_parsers/expression_type_handlers/types.d.cts.map +0 -1
- package/dist/output_parsers/expression_type_handlers/types.d.ts +0 -95
- package/dist/output_parsers/expression_type_handlers/types.d.ts.map +0 -1
- package/dist/output_parsers/fix.cjs +0 -92
- package/dist/output_parsers/fix.cjs.map +0 -1
- package/dist/output_parsers/fix.d.cts +0 -60
- package/dist/output_parsers/fix.d.cts.map +0 -1
- package/dist/output_parsers/fix.d.ts +0 -60
- package/dist/output_parsers/fix.d.ts.map +0 -1
- package/dist/output_parsers/fix.js +0 -91
- package/dist/output_parsers/fix.js.map +0 -1
- package/dist/output_parsers/http_response.cjs +0 -53
- package/dist/output_parsers/http_response.cjs.map +0 -1
- package/dist/output_parsers/http_response.d.cts +0 -33
- package/dist/output_parsers/http_response.d.cts.map +0 -1
- package/dist/output_parsers/http_response.d.ts +0 -33
- package/dist/output_parsers/http_response.d.ts.map +0 -1
- package/dist/output_parsers/http_response.js +0 -52
- package/dist/output_parsers/http_response.js.map +0 -1
- package/dist/output_parsers/index.cjs +0 -74
- package/dist/output_parsers/index.cjs.map +0 -1
- package/dist/output_parsers/index.d.cts +0 -11
- package/dist/output_parsers/index.d.ts +0 -11
- package/dist/output_parsers/index.js +0 -37
- package/dist/output_parsers/index.js.map +0 -1
- package/dist/output_parsers/noop.cjs +0 -43
- package/dist/output_parsers/noop.cjs.map +0 -1
- package/dist/output_parsers/noop.js +0 -42
- package/dist/output_parsers/noop.js.map +0 -1
- package/dist/output_parsers/openai_functions.cjs +0 -145
- package/dist/output_parsers/openai_functions.cjs.map +0 -1
- package/dist/output_parsers/openai_functions.d.cts +0 -85
- package/dist/output_parsers/openai_functions.d.cts.map +0 -1
- package/dist/output_parsers/openai_functions.d.ts +0 -85
- package/dist/output_parsers/openai_functions.d.ts.map +0 -1
- package/dist/output_parsers/openai_functions.js +0 -142
- package/dist/output_parsers/openai_functions.js.map +0 -1
- package/dist/output_parsers/openai_tools.cjs +0 -89
- package/dist/output_parsers/openai_tools.cjs.map +0 -1
- package/dist/output_parsers/openai_tools.d.cts +0 -69
- package/dist/output_parsers/openai_tools.d.cts.map +0 -1
- package/dist/output_parsers/openai_tools.d.ts +0 -69
- package/dist/output_parsers/openai_tools.d.ts.map +0 -1
- package/dist/output_parsers/openai_tools.js +0 -87
- package/dist/output_parsers/openai_tools.js.map +0 -1
- package/dist/output_parsers/prompts.cjs +0 -25
- package/dist/output_parsers/prompts.cjs.map +0 -1
- package/dist/output_parsers/prompts.js +0 -24
- package/dist/output_parsers/prompts.js.map +0 -1
- package/dist/output_parsers/regex.cjs +0 -74
- package/dist/output_parsers/regex.cjs.map +0 -1
- package/dist/output_parsers/regex.d.cts +0 -49
- package/dist/output_parsers/regex.d.cts.map +0 -1
- package/dist/output_parsers/regex.d.ts +0 -49
- package/dist/output_parsers/regex.d.ts.map +0 -1
- package/dist/output_parsers/regex.js +0 -73
- package/dist/output_parsers/regex.js.map +0 -1
- package/dist/output_parsers/router.cjs +0 -40
- package/dist/output_parsers/router.cjs.map +0 -1
- package/dist/output_parsers/router.d.cts +0 -36
- package/dist/output_parsers/router.d.cts.map +0 -1
- package/dist/output_parsers/router.d.ts +0 -36
- package/dist/output_parsers/router.d.ts.map +0 -1
- package/dist/output_parsers/router.js +0 -39
- package/dist/output_parsers/router.js.map +0 -1
- package/dist/output_parsers/structured.cjs +0 -164
- package/dist/output_parsers/structured.cjs.map +0 -1
- package/dist/output_parsers/structured.d.cts +0 -97
- package/dist/output_parsers/structured.d.cts.map +0 -1
- package/dist/output_parsers/structured.d.ts +0 -97
- package/dist/output_parsers/structured.d.ts.map +0 -1
- package/dist/output_parsers/structured.js +0 -161
- package/dist/output_parsers/structured.js.map +0 -1
- package/dist/retrievers/contextual_compression.cjs +0 -53
- package/dist/retrievers/contextual_compression.cjs.map +0 -1
- package/dist/retrievers/contextual_compression.d.cts +0 -42
- package/dist/retrievers/contextual_compression.d.cts.map +0 -1
- package/dist/retrievers/contextual_compression.d.ts +0 -42
- package/dist/retrievers/contextual_compression.d.ts.map +0 -1
- package/dist/retrievers/contextual_compression.js +0 -47
- package/dist/retrievers/contextual_compression.js.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract.cjs +0 -103
- package/dist/retrievers/document_compressors/chain_extract.cjs.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract.d.cts +0 -47
- package/dist/retrievers/document_compressors/chain_extract.d.cts.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract.d.ts +0 -47
- package/dist/retrievers/document_compressors/chain_extract.d.ts.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract.js +0 -97
- package/dist/retrievers/document_compressors/chain_extract.js.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract_prompt.cjs +0 -16
- package/dist/retrievers/document_compressors/chain_extract_prompt.cjs.map +0 -1
- package/dist/retrievers/document_compressors/chain_extract_prompt.js +0 -15
- package/dist/retrievers/document_compressors/chain_extract_prompt.js.map +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.cjs +0 -74
- package/dist/retrievers/document_compressors/embeddings_filter.cjs.map +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts +0 -58
- package/dist/retrievers/document_compressors/embeddings_filter.d.cts.map +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts +0 -58
- package/dist/retrievers/document_compressors/embeddings_filter.d.ts.map +0 -1
- package/dist/retrievers/document_compressors/embeddings_filter.js +0 -68
- package/dist/retrievers/document_compressors/embeddings_filter.js.map +0 -1
- package/dist/retrievers/document_compressors/index.cjs +0 -69
- package/dist/retrievers/document_compressors/index.cjs.map +0 -1
- package/dist/retrievers/document_compressors/index.d.cts +0 -61
- package/dist/retrievers/document_compressors/index.d.cts.map +0 -1
- package/dist/retrievers/document_compressors/index.d.ts +0 -61
- package/dist/retrievers/document_compressors/index.d.ts.map +0 -1
- package/dist/retrievers/document_compressors/index.js +0 -62
- package/dist/retrievers/document_compressors/index.js.map +0 -1
- package/dist/retrievers/ensemble.cjs +0 -76
- package/dist/retrievers/ensemble.cjs.map +0 -1
- package/dist/retrievers/ensemble.d.cts +0 -39
- package/dist/retrievers/ensemble.d.cts.map +0 -1
- package/dist/retrievers/ensemble.d.ts +0 -39
- package/dist/retrievers/ensemble.d.ts.map +0 -1
- package/dist/retrievers/ensemble.js +0 -70
- package/dist/retrievers/ensemble.js.map +0 -1
- package/dist/retrievers/hyde.cjs +0 -128
- package/dist/retrievers/hyde.cjs.map +0 -1
- package/dist/retrievers/hyde.d.cts +0 -61
- package/dist/retrievers/hyde.d.cts.map +0 -1
- package/dist/retrievers/hyde.d.ts +0 -61
- package/dist/retrievers/hyde.d.ts.map +0 -1
- package/dist/retrievers/hyde.js +0 -121
- package/dist/retrievers/hyde.js.map +0 -1
- package/dist/retrievers/matryoshka_retriever.cjs +0 -116
- package/dist/retrievers/matryoshka_retriever.cjs.map +0 -1
- package/dist/retrievers/matryoshka_retriever.d.cts +0 -99
- package/dist/retrievers/matryoshka_retriever.d.cts.map +0 -1
- package/dist/retrievers/matryoshka_retriever.d.ts +0 -99
- package/dist/retrievers/matryoshka_retriever.d.ts.map +0 -1
- package/dist/retrievers/matryoshka_retriever.js +0 -110
- package/dist/retrievers/matryoshka_retriever.js.map +0 -1
- package/dist/retrievers/multi_query.cjs +0 -150
- package/dist/retrievers/multi_query.cjs.map +0 -1
- package/dist/retrievers/multi_query.d.cts +0 -59
- package/dist/retrievers/multi_query.d.cts.map +0 -1
- package/dist/retrievers/multi_query.d.ts +0 -59
- package/dist/retrievers/multi_query.d.ts.map +0 -1
- package/dist/retrievers/multi_query.js +0 -144
- package/dist/retrievers/multi_query.js.map +0 -1
- package/dist/retrievers/multi_vector.cjs +0 -67
- package/dist/retrievers/multi_vector.cjs.map +0 -1
- package/dist/retrievers/multi_vector.d.cts +0 -51
- package/dist/retrievers/multi_vector.d.cts.map +0 -1
- package/dist/retrievers/multi_vector.d.ts +0 -51
- package/dist/retrievers/multi_vector.d.ts.map +0 -1
- package/dist/retrievers/multi_vector.js +0 -61
- package/dist/retrievers/multi_vector.js.map +0 -1
- package/dist/retrievers/parent_document.cjs +0 -137
- package/dist/retrievers/parent_document.cjs.map +0 -1
- package/dist/retrievers/parent_document.d.cts +0 -92
- package/dist/retrievers/parent_document.d.cts.map +0 -1
- package/dist/retrievers/parent_document.d.ts +0 -92
- package/dist/retrievers/parent_document.d.ts.map +0 -1
- package/dist/retrievers/parent_document.js +0 -131
- package/dist/retrievers/parent_document.js.map +0 -1
- package/dist/retrievers/score_threshold.cjs +0 -43
- package/dist/retrievers/score_threshold.cjs.map +0 -1
- package/dist/retrievers/score_threshold.d.cts +0 -20
- package/dist/retrievers/score_threshold.d.cts.map +0 -1
- package/dist/retrievers/score_threshold.d.ts +0 -20
- package/dist/retrievers/score_threshold.d.ts.map +0 -1
- package/dist/retrievers/score_threshold.js +0 -37
- package/dist/retrievers/score_threshold.js.map +0 -1
- package/dist/retrievers/self_query/functional.cjs +0 -21
- package/dist/retrievers/self_query/functional.cjs.map +0 -1
- package/dist/retrievers/self_query/functional.d.cts +0 -2
- package/dist/retrievers/self_query/functional.d.ts +0 -2
- package/dist/retrievers/self_query/functional.js +0 -10
- package/dist/retrievers/self_query/functional.js.map +0 -1
- package/dist/retrievers/self_query/index.cjs +0 -130
- package/dist/retrievers/self_query/index.cjs.map +0 -1
- package/dist/retrievers/self_query/index.d.cts +0 -79
- package/dist/retrievers/self_query/index.d.cts.map +0 -1
- package/dist/retrievers/self_query/index.d.ts +0 -79
- package/dist/retrievers/self_query/index.d.ts.map +0 -1
- package/dist/retrievers/self_query/index.js +0 -106
- package/dist/retrievers/self_query/index.js.map +0 -1
- package/dist/retrievers/time_weighted.cjs +0 -236
- package/dist/retrievers/time_weighted.cjs.map +0 -1
- package/dist/retrievers/time_weighted.d.cts +0 -142
- package/dist/retrievers/time_weighted.d.cts.map +0 -1
- package/dist/retrievers/time_weighted.d.ts +0 -142
- package/dist/retrievers/time_weighted.d.ts.map +0 -1
- package/dist/retrievers/time_weighted.js +0 -228
- package/dist/retrievers/time_weighted.js.map +0 -1
- package/dist/sql_db.cjs +0 -119
- package/dist/sql_db.cjs.map +0 -1
- package/dist/sql_db.d.cts +0 -60
- package/dist/sql_db.d.cts.map +0 -1
- package/dist/sql_db.d.ts +0 -60
- package/dist/sql_db.d.ts.map +0 -1
- package/dist/sql_db.js +0 -113
- package/dist/sql_db.js.map +0 -1
- package/dist/stores/doc/base.cjs +0 -20
- package/dist/stores/doc/base.cjs.map +0 -1
- package/dist/stores/doc/base.d.cts +0 -15
- package/dist/stores/doc/base.d.cts.map +0 -1
- package/dist/stores/doc/base.d.ts +0 -15
- package/dist/stores/doc/base.d.ts.map +0 -1
- package/dist/stores/doc/base.js +0 -14
- package/dist/stores/doc/base.js.map +0 -1
- package/dist/stores/doc/in_memory.cjs +0 -94
- package/dist/stores/doc/in_memory.cjs.map +0 -1
- package/dist/stores/doc/in_memory.d.cts +0 -53
- package/dist/stores/doc/in_memory.d.cts.map +0 -1
- package/dist/stores/doc/in_memory.d.ts +0 -53
- package/dist/stores/doc/in_memory.d.ts.map +0 -1
- package/dist/stores/doc/in_memory.js +0 -87
- package/dist/stores/doc/in_memory.js.map +0 -1
- package/dist/stores/file/base.cjs +0 -13
- package/dist/stores/file/base.cjs.map +0 -1
- package/dist/stores/file/base.d.cts +0 -15
- package/dist/stores/file/base.d.cts.map +0 -1
- package/dist/stores/file/base.d.ts +0 -15
- package/dist/stores/file/base.d.ts.map +0 -1
- package/dist/stores/file/base.js +0 -12
- package/dist/stores/file/base.js.map +0 -1
- package/dist/stores/file/in_memory.cjs +0 -53
- package/dist/stores/file/in_memory.cjs.map +0 -1
- package/dist/stores/file/in_memory.d.cts +0 -33
- package/dist/stores/file/in_memory.d.cts.map +0 -1
- package/dist/stores/file/in_memory.d.ts +0 -33
- package/dist/stores/file/in_memory.d.ts.map +0 -1
- package/dist/stores/file/in_memory.js +0 -47
- package/dist/stores/file/in_memory.js.map +0 -1
- package/dist/stores/file/node.cjs +0 -52
- package/dist/stores/file/node.cjs.map +0 -1
- package/dist/stores/file/node.d.cts +0 -29
- package/dist/stores/file/node.d.cts.map +0 -1
- package/dist/stores/file/node.d.ts +0 -29
- package/dist/stores/file/node.d.ts.map +0 -1
- package/dist/stores/file/node.js +0 -46
- package/dist/stores/file/node.js.map +0 -1
- package/dist/stores/message/in_memory.cjs +0 -21
- package/dist/stores/message/in_memory.cjs.map +0 -1
- package/dist/stores/message/in_memory.d.cts +0 -2
- package/dist/stores/message/in_memory.d.ts +0 -2
- package/dist/stores/message/in_memory.js +0 -10
- package/dist/stores/message/in_memory.js.map +0 -1
- package/dist/text_splitter.cjs +0 -22
- package/dist/text_splitter.cjs.map +0 -1
- package/dist/text_splitter.d.cts +0 -1
- package/dist/text_splitter.d.ts +0 -1
- package/dist/text_splitter.js +0 -12
- package/dist/text_splitter.js.map +0 -1
- package/dist/tools/chain.cjs +0 -36
- package/dist/tools/chain.cjs.map +0 -1
- package/dist/tools/chain.d.cts +0 -32
- package/dist/tools/chain.d.cts.map +0 -1
- package/dist/tools/chain.d.ts +0 -32
- package/dist/tools/chain.d.ts.map +0 -1
- package/dist/tools/chain.js +0 -30
- package/dist/tools/chain.js.map +0 -1
- package/dist/tools/fs.cjs +0 -56
- package/dist/tools/fs.cjs.map +0 -1
- package/dist/tools/fs.d.cts +0 -92
- package/dist/tools/fs.d.cts.map +0 -1
- package/dist/tools/fs.d.ts +0 -92
- package/dist/tools/fs.d.ts.map +0 -1
- package/dist/tools/fs.js +0 -54
- package/dist/tools/fs.js.map +0 -1
- package/dist/tools/index.cjs +0 -68
- package/dist/tools/index.cjs.map +0 -1
- package/dist/tools/index.d.cts +0 -8
- package/dist/tools/index.d.ts +0 -8
- package/dist/tools/index.js +0 -30
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/json.cjs +0 -107
- package/dist/tools/json.cjs.map +0 -1
- package/dist/tools/json.d.cts +0 -65
- package/dist/tools/json.d.cts.map +0 -1
- package/dist/tools/json.d.ts +0 -65
- package/dist/tools/json.d.ts.map +0 -1
- package/dist/tools/json.js +0 -104
- package/dist/tools/json.js.map +0 -1
- package/dist/tools/render.cjs +0 -55
- package/dist/tools/render.cjs.map +0 -1
- package/dist/tools/render.d.cts +0 -32
- package/dist/tools/render.d.cts.map +0 -1
- package/dist/tools/render.d.ts +0 -32
- package/dist/tools/render.d.ts.map +0 -1
- package/dist/tools/render.js +0 -48
- package/dist/tools/render.js.map +0 -1
- package/dist/tools/requests.cjs +0 -73
- package/dist/tools/requests.cjs.map +0 -1
- package/dist/tools/requests.d.cts +0 -56
- package/dist/tools/requests.d.cts.map +0 -1
- package/dist/tools/requests.d.ts +0 -56
- package/dist/tools/requests.d.ts.map +0 -1
- package/dist/tools/requests.js +0 -71
- package/dist/tools/requests.js.map +0 -1
- package/dist/tools/retriever.cjs +0 -30
- package/dist/tools/retriever.cjs.map +0 -1
- package/dist/tools/retriever.d.cts +0 -19
- package/dist/tools/retriever.d.cts.map +0 -1
- package/dist/tools/retriever.d.ts +0 -19
- package/dist/tools/retriever.d.ts.map +0 -1
- package/dist/tools/retriever.js +0 -24
- package/dist/tools/retriever.js.map +0 -1
- package/dist/tools/sql.cjs +0 -165
- package/dist/tools/sql.cjs.map +0 -1
- package/dist/tools/sql.d.cts +0 -86
- package/dist/tools/sql.d.cts.map +0 -1
- package/dist/tools/sql.d.ts +0 -86
- package/dist/tools/sql.d.ts.map +0 -1
- package/dist/tools/sql.js +0 -156
- package/dist/tools/sql.js.map +0 -1
- package/dist/tools/vectorstore.cjs +0 -45
- package/dist/tools/vectorstore.cjs.map +0 -1
- package/dist/tools/vectorstore.d.cts +0 -40
- package/dist/tools/vectorstore.d.cts.map +0 -1
- package/dist/tools/vectorstore.d.ts +0 -40
- package/dist/tools/vectorstore.d.ts.map +0 -1
- package/dist/tools/vectorstore.js +0 -44
- package/dist/tools/vectorstore.js.map +0 -1
- package/dist/tools/webbrowser.cjs +0 -176
- package/dist/tools/webbrowser.cjs.map +0 -1
- package/dist/tools/webbrowser.d.cts +0 -69
- package/dist/tools/webbrowser.d.cts.map +0 -1
- package/dist/tools/webbrowser.d.ts +0 -69
- package/dist/tools/webbrowser.d.ts.map +0 -1
- package/dist/tools/webbrowser.js +0 -168
- package/dist/tools/webbrowser.js.map +0 -1
- package/dist/types/expression-parser.d.cts +0 -91
- package/dist/types/expression-parser.d.cts.map +0 -1
- package/dist/types/expression-parser.d.ts +0 -91
- package/dist/types/expression-parser.d.ts.map +0 -1
- package/dist/types/type-utils.d.cts +0 -7
- package/dist/types/type-utils.d.cts.map +0 -1
- package/dist/types/type-utils.d.ts +0 -7
- package/dist/types/type-utils.d.ts.map +0 -1
- package/dist/util/document.cjs +0 -23
- package/dist/util/document.cjs.map +0 -1
- package/dist/util/document.d.cts +0 -15
- package/dist/util/document.d.cts.map +0 -1
- package/dist/util/document.d.ts +0 -15
- package/dist/util/document.d.ts.map +0 -1
- package/dist/util/document.js +0 -17
- package/dist/util/document.js.map +0 -1
- package/dist/util/entrypoint_deprecation.cjs +0 -1
- package/dist/util/entrypoint_deprecation.js +0 -1
- package/dist/util/env.cjs +0 -2
- package/dist/util/env.js +0 -1
- package/dist/util/extname.cjs +0 -7
- package/dist/util/extname.cjs.map +0 -1
- package/dist/util/extname.js +0 -6
- package/dist/util/extname.js.map +0 -1
- package/dist/util/hub.cjs +0 -39
- package/dist/util/hub.cjs.map +0 -1
- package/dist/util/hub.js +0 -38
- package/dist/util/hub.js.map +0 -1
- package/dist/util/load.cjs +0 -15
- package/dist/util/load.cjs.map +0 -1
- package/dist/util/load.d.cts +0 -6
- package/dist/util/load.d.cts.map +0 -1
- package/dist/util/load.d.ts +0 -6
- package/dist/util/load.d.ts.map +0 -1
- package/dist/util/load.js +0 -14
- package/dist/util/load.js.map +0 -1
- package/dist/util/math.cjs +0 -22
- package/dist/util/math.cjs.map +0 -1
- package/dist/util/math.d.cts +0 -1
- package/dist/util/math.d.ts +0 -1
- package/dist/util/math.js +0 -12
- package/dist/util/math.js.map +0 -1
- package/dist/util/ml-distance/distances.cjs +0 -35
- package/dist/util/ml-distance/distances.cjs.map +0 -1
- package/dist/util/ml-distance/distances.js +0 -33
- package/dist/util/ml-distance/distances.js.map +0 -1
- package/dist/util/ml-distance/similarities.cjs +0 -23
- package/dist/util/ml-distance/similarities.cjs.map +0 -1
- package/dist/util/ml-distance/similarities.d.cts +0 -11
- package/dist/util/ml-distance/similarities.d.cts.map +0 -1
- package/dist/util/ml-distance/similarities.d.ts +0 -11
- package/dist/util/ml-distance/similarities.d.ts.map +0 -1
- package/dist/util/ml-distance/similarities.js +0 -22
- package/dist/util/ml-distance/similarities.js.map +0 -1
- package/dist/util/ml-distance-euclidean/euclidean.cjs +0 -14
- package/dist/util/ml-distance-euclidean/euclidean.cjs.map +0 -1
- package/dist/util/ml-distance-euclidean/euclidean.js +0 -13
- package/dist/util/ml-distance-euclidean/euclidean.js.map +0 -1
- package/dist/util/openapi.cjs +0 -149
- package/dist/util/openapi.cjs.map +0 -1
- package/dist/util/openapi.d.cts +0 -83
- package/dist/util/openapi.d.cts.map +0 -1
- package/dist/util/openapi.d.ts +0 -83
- package/dist/util/openapi.d.ts.map +0 -1
- package/dist/util/openapi.js +0 -148
- package/dist/util/openapi.js.map +0 -1
- package/dist/util/parse.cjs +0 -22
- package/dist/util/parse.cjs.map +0 -1
- package/dist/util/parse.js +0 -21
- package/dist/util/parse.js.map +0 -1
- package/dist/util/set.cjs +0 -35
- package/dist/util/set.cjs.map +0 -1
- package/dist/util/set.js +0 -32
- package/dist/util/set.js.map +0 -1
- package/dist/util/sql_utils.cjs +0 -178
- package/dist/util/sql_utils.cjs.map +0 -1
- package/dist/util/sql_utils.d.cts +0 -31
- package/dist/util/sql_utils.d.cts.map +0 -1
- package/dist/util/sql_utils.d.ts +0 -31
- package/dist/util/sql_utils.d.ts.map +0 -1
- package/dist/util/sql_utils.js +0 -173
- package/dist/util/sql_utils.js.map +0 -1
- package/dist/util/time.cjs +0 -25
- package/dist/util/time.cjs.map +0 -1
- package/dist/util/time.d.cts +0 -10
- package/dist/util/time.d.cts.map +0 -1
- package/dist/util/time.d.ts +0 -10
- package/dist/util/time.d.ts.map +0 -1
- package/dist/util/time.js +0 -19
- package/dist/util/time.js.map +0 -1
- package/dist/vectorstores/memory.cjs +0 -265
- package/dist/vectorstores/memory.cjs.map +0 -1
- package/dist/vectorstores/memory.d.cts +0 -216
- package/dist/vectorstores/memory.d.cts.map +0 -1
- package/dist/vectorstores/memory.d.ts +0 -216
- package/dist/vectorstores/memory.d.ts.map +0 -1
- package/dist/vectorstores/memory.js +0 -259
- package/dist/vectorstores/memory.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":["BaseMessage","countTokensApproximately"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.d.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport declare function countTokensApproximately(messages: BaseMessage[]): number;\n"],"mappings":";;;;;;AAMA;;;iBAAwBC,wBAAAA,WAAmCD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
|
|
3
|
+
//#region src/agents/middlewareAgent/middleware/utils.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Default token counter that approximates based on character count
|
|
7
|
+
* @param messages Messages to count tokens for
|
|
8
|
+
* @returns Approximate token count
|
|
9
|
+
*/
|
|
10
|
+
declare function countTokensApproximately(messages: BaseMessage[]): number;
|
|
11
|
+
//#endregion
|
|
12
|
+
export { countTokensApproximately };
|
|
13
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":["BaseMessage","countTokensApproximately"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.d.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport declare function countTokensApproximately(messages: BaseMessage[]): number;\n"],"mappings":";;;;;;AAMA;;;iBAAwBC,wBAAAA,WAAmCD"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
//#region src/agents/middlewareAgent/middleware/utils.ts
|
|
2
|
+
/**
|
|
3
|
+
* Default token counter that approximates based on character count
|
|
4
|
+
* @param messages Messages to count tokens for
|
|
5
|
+
* @returns Approximate token count
|
|
6
|
+
*/
|
|
7
|
+
function countTokensApproximately(messages) {
|
|
8
|
+
let totalChars = 0;
|
|
9
|
+
for (const msg of messages) {
|
|
10
|
+
let textContent;
|
|
11
|
+
if (typeof msg.content === "string") textContent = msg.content;
|
|
12
|
+
else if (Array.isArray(msg.content)) textContent = msg.content.map((item) => {
|
|
13
|
+
if (typeof item === "string") return item;
|
|
14
|
+
if (item.type === "text" && "text" in item) return item.text;
|
|
15
|
+
return "";
|
|
16
|
+
}).join("");
|
|
17
|
+
else textContent = "";
|
|
18
|
+
totalChars += textContent.length;
|
|
19
|
+
}
|
|
20
|
+
return Math.ceil(totalChars / 4);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
export { countTokensApproximately };
|
|
25
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","names":["messages: BaseMessage[]","textContent: string"],"sources":["../../../../src/agents/middlewareAgent/middleware/utils.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\n\n/**\n * Default token counter that approximates based on character count\n * @param messages Messages to count tokens for\n * @returns Approximate token count\n */\nexport function countTokensApproximately(messages: BaseMessage[]): number {\n let totalChars = 0;\n for (const msg of messages) {\n let textContent: string;\n if (typeof msg.content === \"string\") {\n textContent = msg.content;\n } else if (Array.isArray(msg.content)) {\n textContent = msg.content\n .map((item) => {\n if (typeof item === \"string\") return item;\n if (item.type === \"text\" && \"text\" in item) return item.text;\n return \"\";\n })\n .join(\"\");\n } else {\n textContent = \"\";\n }\n totalChars += textContent.length;\n }\n // Approximate 1 token = 4 characters\n return Math.ceil(totalChars / 4);\n}\n"],"mappings":";;;;;;AAOA,SAAgB,yBAAyBA,UAAiC;CACxE,IAAI,aAAa;AACjB,MAAK,MAAM,OAAO,UAAU;EAC1B,IAAIC;AACJ,MAAI,OAAO,IAAI,YAAY,UACzB,cAAc,IAAI;WACT,MAAM,QAAQ,IAAI,QAAQ,EACnC,cAAc,IAAI,QACf,IAAI,CAAC,SAAS;AACb,OAAI,OAAO,SAAS,SAAU,QAAO;AACrC,OAAI,KAAK,SAAS,UAAU,UAAU,KAAM,QAAO,KAAK;AACxD,UAAO;EACR,EAAC,CACD,KAAK,GAAG;OAEX,cAAc;EAEhB,cAAc,YAAY;CAC3B;AAED,QAAO,KAAK,KAAK,aAAa,EAAE;AACjC"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @param config.name - The name of the middleware
|
|
8
8
|
* @param config.stateSchema - The schema of the middleware state
|
|
9
9
|
* @param config.contextSchema - The schema of the middleware context
|
|
10
|
-
* @param config.
|
|
10
|
+
* @param config.modifyModelRequest - The function to prepare the model request
|
|
11
11
|
* @param config.beforeModel - The function to run before the model call
|
|
12
12
|
* @param config.afterModel - The function to run after the model call
|
|
13
13
|
* @returns A middleware instance
|
|
@@ -34,11 +34,15 @@ function createMiddleware(config) {
|
|
|
34
34
|
const middleware = {
|
|
35
35
|
name: config.name,
|
|
36
36
|
stateSchema: config.stateSchema,
|
|
37
|
-
contextSchema: config.contextSchema
|
|
37
|
+
contextSchema: config.contextSchema,
|
|
38
|
+
beforeModelJumpTo: config.beforeModelJumpTo,
|
|
39
|
+
afterModelJumpTo: config.afterModelJumpTo,
|
|
40
|
+
tools: config.tools ?? []
|
|
38
41
|
};
|
|
39
|
-
if (config.
|
|
40
|
-
if (config.
|
|
41
|
-
if (config.
|
|
42
|
+
if (config.modifyModelRequest) middleware.modifyModelRequest = async (options, state, runtime) => Promise.resolve(config.modifyModelRequest(options, state, runtime));
|
|
43
|
+
if (config.retryModelRequest) middleware.retryModelRequest = async (error, request, state, runtime, attempt) => Promise.resolve(config.retryModelRequest(error, request, state, runtime, attempt));
|
|
44
|
+
if (config.beforeModel) middleware.beforeModel = async (state, runtime) => Promise.resolve(config.beforeModel(state, runtime));
|
|
45
|
+
if (config.afterModel) middleware.afterModel = async (state, runtime) => Promise.resolve(config.afterModel(state, runtime));
|
|
42
46
|
return middleware;
|
|
43
47
|
}
|
|
44
48
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.cjs","names":["config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n afterModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport type {\n AgentMiddleware,\n Runtime,\n Controls,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n} from \"./types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.prepareModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends z.ZodObject<any> | undefined = undefined,\n TContextSchema extends z.ZodObject<any> | undefined = undefined\n>(config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n afterModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n };\n\n if (config.prepareModelRequest) {\n middleware.prepareModelRequest = async (options, state, runtime) =>\n Promise.resolve(config.prepareModelRequest!(options, state, runtime));\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime, controls) =>\n Promise.resolve(config.beforeModel!(state, runtime, controls));\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime, controls) =>\n Promise.resolve(config.afterModel!(state, runtime, controls));\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,iBAGdA,QAkDgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;CACvB;AAED,KAAI,OAAO,qBACT,WAAW,sBAAsB,OAAO,SAAS,OAAO,YACtD,QAAQ,QAAQ,OAAO,oBAAqB,SAAS,OAAO,QAAQ,CAAC;AAGzE,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,SAAS,aAC9C,QAAQ,QAAQ,OAAO,YAAa,OAAO,SAAS,SAAS,CAAC;AAGlE,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,SAAS,aAC7C,QAAQ,QAAQ,OAAO,WAAY,OAAO,SAAS,SAAS,CAAC;AAGjE,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"middleware.cjs","names":["config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodDefault,\n InteropZodOptional,\n InferInteropZodInput,\n InferInteropZodOutput,\n} from \"@langchain/core/utils/types\";\nimport type {\n AgentMiddleware,\n Runtime,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n JumpToTarget,\n} from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends InteropZodObject | undefined = undefined,\n TContextSchema extends\n | InteropZodObject\n | InteropZodOptional<InteropZodObject>\n | InteropZodDefault<InteropZodObject>\n | undefined = undefined\n>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n beforeModelJumpTo: config.beforeModelJumpTo,\n afterModelJumpTo: config.afterModelJumpTo,\n tools: config.tools ?? [],\n };\n\n if (config.modifyModelRequest) {\n middleware.modifyModelRequest = async (options, state, runtime) =>\n Promise.resolve(\n config.modifyModelRequest!(\n options,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.retryModelRequest) {\n middleware.retryModelRequest = async (\n error,\n request,\n state,\n runtime,\n attempt\n ) =>\n Promise.resolve(\n config.retryModelRequest!(\n error,\n request,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt\n )\n );\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime) =>\n Promise.resolve(\n config.beforeModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime) =>\n Promise.resolve(\n config.afterModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,iBAOdA,QAqKgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,mBAAmB,OAAO;EAC1B,kBAAkB,OAAO;EACzB,OAAO,OAAO,SAAS,CAAE;CAC1B;AAED,KAAI,OAAO,oBACT,WAAW,qBAAqB,OAAO,SAAS,OAAO,YACrD,QAAQ,QACN,OAAO,mBACL,SACA,OACA,QASD,CACF;AAGL,KAAI,OAAO,mBACT,WAAW,oBAAoB,OAC7B,OACA,SACA,OACA,SACA,YAEA,QAAQ,QACN,OAAO,kBACL,OACA,SACA,OACA,SASA,QACD,CACF;AAGL,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,YACrC,QAAQ,QACN,OAAO,YACL,OACA,QASD,CACF;AAGL,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,YACpC,QAAQ,QACN,OAAO,WACL,OACA,QASD,CACF;AAGL,QAAO;AACR"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ClientTool, ServerTool } from "../types.cjs";
|
|
2
|
+
import { AgentBuiltInState, AgentMiddleware, JumpToTarget, MiddlewareResult, ModelRequest, Runtime } from "./types.cjs";
|
|
3
|
+
import { InferInteropZodInput, InferInteropZodOutput, InteropZodDefault, InteropZodObject, InteropZodOptional } from "@langchain/core/utils/types";
|
|
3
4
|
|
|
4
5
|
//#region src/agents/middlewareAgent/middleware.d.ts
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ import { z } from "zod/v3";
|
|
|
10
11
|
* @param config.name - The name of the middleware
|
|
11
12
|
* @param config.stateSchema - The schema of the middleware state
|
|
12
13
|
* @param config.contextSchema - The schema of the middleware context
|
|
13
|
-
* @param config.
|
|
14
|
+
* @param config.modifyModelRequest - The function to prepare the model request
|
|
14
15
|
* @param config.beforeModel - The function to run before the model call
|
|
15
16
|
* @param config.afterModel - The function to run after the model call
|
|
16
17
|
* @returns A middleware instance
|
|
@@ -33,13 +34,83 @@ import { z } from "zod/v3";
|
|
|
33
34
|
* });
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
|
-
declare function createMiddleware<TSchema extends
|
|
37
|
+
declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {
|
|
38
|
+
/**
|
|
39
|
+
* The name of the middleware
|
|
40
|
+
*/
|
|
37
41
|
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:
|
|
44
|
+
* - A Zod object
|
|
45
|
+
* - A Zod optional object
|
|
46
|
+
* - A Zod default object
|
|
47
|
+
* - Undefined
|
|
48
|
+
*/
|
|
38
49
|
stateSchema?: TSchema;
|
|
50
|
+
/**
|
|
51
|
+
* The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:
|
|
52
|
+
* - A Zod object
|
|
53
|
+
* - A Zod optional object
|
|
54
|
+
* - A Zod default object
|
|
55
|
+
* - Undefined
|
|
56
|
+
*/
|
|
39
57
|
contextSchema?: TContextSchema;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.
|
|
60
|
+
*/
|
|
61
|
+
beforeModelJumpTo?: JumpToTarget[];
|
|
62
|
+
/**
|
|
63
|
+
* Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.
|
|
64
|
+
*/
|
|
65
|
+
afterModelJumpTo?: JumpToTarget[];
|
|
66
|
+
/**
|
|
67
|
+
* Additional tools registered by the middleware.
|
|
68
|
+
*/
|
|
69
|
+
tools?: (ClientTool | ServerTool)[];
|
|
70
|
+
/**
|
|
71
|
+
* The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.
|
|
72
|
+
* It allows to modify the model request before it is passed to the model.
|
|
73
|
+
*
|
|
74
|
+
* @param request - The model request
|
|
75
|
+
* @param request.model - The model to use for this step.
|
|
76
|
+
* @param request.messages - The messages to send to the model.
|
|
77
|
+
* @param request.systemPrompt - The system message for this step.
|
|
78
|
+
* @param request.toolChoice - The tool choice configuration for this step.
|
|
79
|
+
* @param request.tools - The tools to make available for this step.
|
|
80
|
+
* @param state - The middleware state
|
|
81
|
+
* @param runtime - The middleware runtime
|
|
82
|
+
* @returns The modified model request or undefined to pass through
|
|
83
|
+
*/
|
|
84
|
+
modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
|
|
85
|
+
/**
|
|
86
|
+
* The function to handle model invocation errors and optionally retry.
|
|
87
|
+
*
|
|
88
|
+
* @param error - The exception that occurred during model invocation
|
|
89
|
+
* @param request - The original model request that failed
|
|
90
|
+
* @param state - The current agent state
|
|
91
|
+
* @param runtime - The runtime context
|
|
92
|
+
* @param attempt - The current attempt number (1-indexed)
|
|
93
|
+
* @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)
|
|
94
|
+
*/
|
|
95
|
+
retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;
|
|
96
|
+
/**
|
|
97
|
+
* The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.
|
|
98
|
+
* It allows to modify the state of the agent.
|
|
99
|
+
*
|
|
100
|
+
* @param state - The middleware state
|
|
101
|
+
* @param runtime - The middleware runtime
|
|
102
|
+
* @returns The modified middleware state or undefined to pass through
|
|
103
|
+
*/
|
|
104
|
+
beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
|
|
105
|
+
/**
|
|
106
|
+
* The function to run after the model call. This function is called after the model is invoked and before any tools are called.
|
|
107
|
+
* It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.
|
|
108
|
+
*
|
|
109
|
+
* @param state - The middleware state
|
|
110
|
+
* @param runtime - The middleware runtime
|
|
111
|
+
* @returns The modified middleware state or undefined to pass through
|
|
112
|
+
*/
|
|
113
|
+
afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
|
|
43
114
|
}): AgentMiddleware<TSchema, TContextSchema, any>;
|
|
44
115
|
//#endregion
|
|
45
116
|
export { createMiddleware };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.cts","names":["z","AgentMiddleware","Runtime","Controls","MiddlewareResult","AgentBuiltInState","ModelRequest","createMiddleware","ZodObject","TSchema","TContextSchema","infer","Promise","Partial"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport type { AgentMiddleware, Runtime, Controls, MiddlewareResult, AgentBuiltInState, ModelRequest } from \"./types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.prepareModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends z.ZodObject<any> | undefined = undefined, TContextSchema extends z.ZodObject<any> | undefined = undefined>(config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (options: ModelRequest, state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>, controls: Controls<(TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState>) => Promise<MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>;\n afterModel?: (state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>, controls: Controls<(TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState>) => Promise<MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":";;;;;;AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKmHE,iBAL3FK,gBAK2FL,CAAAA,gBAL1DF,CAAAA,CAAEQ,SAKwDN,CAAAA,GAAAA,CAAAA,GAAAA,SAAAA,GAAAA,SAAAA,EAAAA,uBALOF,CAAAA,CAAEQ,SAKTN,CAAAA,GAAAA,CAAAA,GAAAA,SAAAA,GAAAA,SAAAA,CAAAA,CAAAA,MAAAA,EAAAA;EAAO,IAA8FO,EAAAA,MAAAA;EAAO,WAAWD,CAAAA,EAHxNC,OAGwND;EAAS,aAAgBC,CAAAA,EAF/OC,cAE+OD;EAAO,mBAAbE,CAAAA,EAAAA,CAAAA,OAAAA,EADzNL,YACyNK,EAAAA,KAAAA,EAAAA,CADnMF,OACmME,SADnLX,CAAAA,CAAEQ,SACiLG,CAAAA,GAAAA,CAAAA,GADhKX,CAAAA,CAAEW,KAC8JA,CADxJF,OACwJE,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GADvIN,iBACuIM,EAAAA,OAAAA,EAD3GT,OAC2GS,CADnGD,cACmGC,SAD5EX,CAAAA,CAAEQ,SAC0EG,CAAAA,GAAAA,CAAAA,GADzDX,CAAAA,CAAEW,KACuDA,CADjDD,cACiDC,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,EAAAA,GADvBC,OACuBD,CADfL,YACeK,GAAAA,IAAAA,CAAAA,GADQL,YACRK,GAAAA,IAAAA;EAAK,WAAkBN,CAAAA,EAAAA,CAAAA,KAAAA,EAAAA,CAAzPI,OAAyPJ,SAAzOL,CAAAA,CAAEQ,SAAuOH,CAAAA,GAAAA,CAAAA,GAAtNL,CAAAA,CAAEW,KAAoNN,CAA9MI,OAA8MJ,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAA7LA,iBAA6LA,EAAAA,OAAAA,EAAjKH,OAAiKG,CAAzJK,cAAyJL,SAAlIL,CAAAA,CAAEQ,SAAgIH,CAAAA,GAAAA,CAAAA,GAA/GL,CAAAA,CAAEW,KAA6GN,CAAvGK,cAAuGL,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,EAAAA,QAAAA,EAAtEF,QAAsEE,CAAAA,CAA5DI,OAA4DJ,SAA5CL,CAAAA,CAAEQ,SAA0CH,CAAAA,GAAAA,CAAAA,GAAzBL,CAAAA,CAAEW,KAAuBN,CAAjBI,OAAiBJ,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GAAAA,iBAAAA,CAAAA,EAAAA,GAAuBO,OAAvBP,CAA+BD,gBAA/BC,CAAgDQ,OAAhDR,CAAwDI,OAAxDJ,SAAwEL,CAAAA,CAAEQ,SAA1EH,CAAAA,GAAAA,CAAAA,GAA2FL,CAAAA,CAAEW,KAA7FN,CAAmGI,OAAnGJ,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAAsHD,gBAAtHC,CAAuIQ,OAAvIR,CAA+II,OAA/IJ,SAA+JL,CAAAA,CAAEQ,SAAjKH,CAAAA,GAAAA,CAAAA,GAAkLL,CAAAA,CAAEW,KAApLN,CAA0LI,OAA1LJ,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA;EAAiB,UAAvFF,CAAAA,EAAAA,CAAAA,KAAAA,EAAAA,CACpLM,OADoLN,SACpKH,CAAAA,CAAEQ,SADkKL,CAAAA,GAAAA,CAAAA,GACjJH,CAAAA,CAAEW,KAD+IR,CACzIM,OADyIN,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GACxHE,iBADwHF,EAAAA,OAAAA,EAC5FD,OAD4FC,CACpFO,cADoFP,SAC7DH,CAAAA,CAAEQ,SAD2DL,CAAAA,GAAAA,CAAAA,GAC1CH,CAAAA,CAAEW,KADwCR,CAClCO,cADkCP,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,EAAAA,QAAAA,EACDA,QADCA,CAAAA,CACSM,OADTN,SACyBH,CAAAA,CAAEQ,SAD3BL,CAAAA,GAAAA,CAAAA,GAC4CH,CAAAA,CAAEW,KAD9CR,CACoDM,OADpDN,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,GACqEE,iBADrEF,CAAAA,EAAAA,GAC4FS,OAD5FT,CACoGC,gBADpGD,CACqHU,OADrHV,CAC6HM,OAD7HN,SAC6IH,CAAAA,CAAEQ,SAD/IL,CAAAA,GAAAA,CAAAA,GACgKH,CAAAA,CAAEW,KADlKR,CACwKM,OADxKN,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,GAC2LC,gBAD3LD,CAC4MU,OAD5MV,CACoNM,OADpNN,SACoOH,CAAAA,CAAEQ,SADtOL,CAAAA,GAAAA,CAAAA,GACuPH,CAAAA,CAAEW,KADzPR,CAC+PM,OAD/PN,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA;CAAQ,CAAA,EAElNF,eAFwUQ,CAExTA,OAFwTA,EAE/SC,cAF+SD,EAAAA,GAAAA,CAAAA"}
|
|
1
|
+
{"version":3,"file":"middleware.d.cts","names":["InteropZodObject","InteropZodDefault","InteropZodOptional","InferInteropZodInput","InferInteropZodOutput","AgentMiddleware","Runtime","MiddlewareResult","AgentBuiltInState","ModelRequest","JumpToTarget","ClientTool","ServerTool","createMiddleware","TSchema","TContextSchema","Partial","Promise","Error"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodDefault, InteropZodOptional, InferInteropZodInput, InferInteropZodOutput } from \"@langchain/core/utils/types\";\nimport type { AgentMiddleware, Runtime, MiddlewareResult, AgentBuiltInState, ModelRequest, JumpToTarget } from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ClientTool, ServerTool } from "../types.js";
|
|
2
|
+
import { AgentBuiltInState, AgentMiddleware, JumpToTarget, MiddlewareResult, ModelRequest, Runtime } from "./types.js";
|
|
3
|
+
import { InferInteropZodInput, InferInteropZodOutput, InteropZodDefault, InteropZodObject, InteropZodOptional } from "@langchain/core/utils/types";
|
|
3
4
|
|
|
4
5
|
//#region src/agents/middlewareAgent/middleware.d.ts
|
|
5
6
|
|
|
@@ -10,7 +11,7 @@ import { z } from "zod/v3";
|
|
|
10
11
|
* @param config.name - The name of the middleware
|
|
11
12
|
* @param config.stateSchema - The schema of the middleware state
|
|
12
13
|
* @param config.contextSchema - The schema of the middleware context
|
|
13
|
-
* @param config.
|
|
14
|
+
* @param config.modifyModelRequest - The function to prepare the model request
|
|
14
15
|
* @param config.beforeModel - The function to run before the model call
|
|
15
16
|
* @param config.afterModel - The function to run after the model call
|
|
16
17
|
* @returns A middleware instance
|
|
@@ -33,13 +34,83 @@ import { z } from "zod/v3";
|
|
|
33
34
|
* });
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
|
-
declare function createMiddleware<TSchema extends
|
|
37
|
+
declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {
|
|
38
|
+
/**
|
|
39
|
+
* The name of the middleware
|
|
40
|
+
*/
|
|
37
41
|
name: string;
|
|
42
|
+
/**
|
|
43
|
+
* The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:
|
|
44
|
+
* - A Zod object
|
|
45
|
+
* - A Zod optional object
|
|
46
|
+
* - A Zod default object
|
|
47
|
+
* - Undefined
|
|
48
|
+
*/
|
|
38
49
|
stateSchema?: TSchema;
|
|
50
|
+
/**
|
|
51
|
+
* The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:
|
|
52
|
+
* - A Zod object
|
|
53
|
+
* - A Zod optional object
|
|
54
|
+
* - A Zod default object
|
|
55
|
+
* - Undefined
|
|
56
|
+
*/
|
|
39
57
|
contextSchema?: TContextSchema;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.
|
|
60
|
+
*/
|
|
61
|
+
beforeModelJumpTo?: JumpToTarget[];
|
|
62
|
+
/**
|
|
63
|
+
* Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.
|
|
64
|
+
*/
|
|
65
|
+
afterModelJumpTo?: JumpToTarget[];
|
|
66
|
+
/**
|
|
67
|
+
* Additional tools registered by the middleware.
|
|
68
|
+
*/
|
|
69
|
+
tools?: (ClientTool | ServerTool)[];
|
|
70
|
+
/**
|
|
71
|
+
* The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.
|
|
72
|
+
* It allows to modify the model request before it is passed to the model.
|
|
73
|
+
*
|
|
74
|
+
* @param request - The model request
|
|
75
|
+
* @param request.model - The model to use for this step.
|
|
76
|
+
* @param request.messages - The messages to send to the model.
|
|
77
|
+
* @param request.systemPrompt - The system message for this step.
|
|
78
|
+
* @param request.toolChoice - The tool choice configuration for this step.
|
|
79
|
+
* @param request.tools - The tools to make available for this step.
|
|
80
|
+
* @param state - The middleware state
|
|
81
|
+
* @param runtime - The middleware runtime
|
|
82
|
+
* @returns The modified model request or undefined to pass through
|
|
83
|
+
*/
|
|
84
|
+
modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;
|
|
85
|
+
/**
|
|
86
|
+
* The function to handle model invocation errors and optionally retry.
|
|
87
|
+
*
|
|
88
|
+
* @param error - The exception that occurred during model invocation
|
|
89
|
+
* @param request - The original model request that failed
|
|
90
|
+
* @param state - The current agent state
|
|
91
|
+
* @param runtime - The runtime context
|
|
92
|
+
* @param attempt - The current attempt number (1-indexed)
|
|
93
|
+
* @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)
|
|
94
|
+
*/
|
|
95
|
+
retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;
|
|
96
|
+
/**
|
|
97
|
+
* The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.
|
|
98
|
+
* It allows to modify the state of the agent.
|
|
99
|
+
*
|
|
100
|
+
* @param state - The middleware state
|
|
101
|
+
* @param runtime - The middleware runtime
|
|
102
|
+
* @returns The modified middleware state or undefined to pass through
|
|
103
|
+
*/
|
|
104
|
+
beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
|
|
105
|
+
/**
|
|
106
|
+
* The function to run after the model call. This function is called after the model is invoked and before any tools are called.
|
|
107
|
+
* It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.
|
|
108
|
+
*
|
|
109
|
+
* @param state - The middleware state
|
|
110
|
+
* @param runtime - The middleware runtime
|
|
111
|
+
* @returns The modified middleware state or undefined to pass through
|
|
112
|
+
*/
|
|
113
|
+
afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;
|
|
43
114
|
}): AgentMiddleware<TSchema, TContextSchema, any>;
|
|
44
115
|
//#endregion
|
|
45
116
|
export { createMiddleware };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.d.ts","names":["z","AgentMiddleware","Runtime","Controls","MiddlewareResult","AgentBuiltInState","ModelRequest","createMiddleware","ZodObject","TSchema","TContextSchema","infer","Promise","Partial"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport type { AgentMiddleware, Runtime, Controls, MiddlewareResult, AgentBuiltInState, ModelRequest } from \"./types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.prepareModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends z.ZodObject<any> | undefined = undefined, TContextSchema extends z.ZodObject<any> | undefined = undefined>(config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (options: ModelRequest, state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>, controls: Controls<(TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState>) => Promise<MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>;\n afterModel?: (state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}>, controls: Controls<(TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) & AgentBuiltInState>) => Promise<MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"middleware.d.ts","names":["InteropZodObject","InteropZodDefault","InteropZodOptional","InferInteropZodInput","InferInteropZodOutput","AgentMiddleware","Runtime","MiddlewareResult","AgentBuiltInState","ModelRequest","JumpToTarget","ClientTool","ServerTool","createMiddleware","TSchema","TContextSchema","Partial","Promise","Error"],"sources":["../../../src/agents/middlewareAgent/middleware.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodObject, InteropZodDefault, InteropZodOptional, InferInteropZodInput, InferInteropZodOutput } from \"@langchain/core/utils/types\";\nimport type { AgentMiddleware, Runtime, MiddlewareResult, AgentBuiltInState, ModelRequest, JumpToTarget } from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport declare function createMiddleware<TSchema extends InteropZodObject | undefined = undefined, TContextSchema extends InteropZodObject | InteropZodOptional<InteropZodObject> | InteropZodDefault<InteropZodObject> | undefined = undefined>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (options: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (error: Error, request: ModelRequest, state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>, attempt: number) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (state: (TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}) & AgentBuiltInState, runtime: Runtime<TContextSchema extends InteropZodObject ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodDefault<any> ? InferInteropZodOutput<TContextSchema> : TContextSchema extends InteropZodOptional<any> ? Partial<InferInteropZodOutput<TContextSchema>> : never>) => Promise<MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>> | MiddlewareResult<Partial<TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}>>;\n}): AgentMiddleware<TSchema, TContextSchema, any>;\n"],"mappings":"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"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @param config.name - The name of the middleware
|
|
7
7
|
* @param config.stateSchema - The schema of the middleware state
|
|
8
8
|
* @param config.contextSchema - The schema of the middleware context
|
|
9
|
-
* @param config.
|
|
9
|
+
* @param config.modifyModelRequest - The function to prepare the model request
|
|
10
10
|
* @param config.beforeModel - The function to run before the model call
|
|
11
11
|
* @param config.afterModel - The function to run after the model call
|
|
12
12
|
* @returns A middleware instance
|
|
@@ -33,11 +33,15 @@ function createMiddleware(config) {
|
|
|
33
33
|
const middleware = {
|
|
34
34
|
name: config.name,
|
|
35
35
|
stateSchema: config.stateSchema,
|
|
36
|
-
contextSchema: config.contextSchema
|
|
36
|
+
contextSchema: config.contextSchema,
|
|
37
|
+
beforeModelJumpTo: config.beforeModelJumpTo,
|
|
38
|
+
afterModelJumpTo: config.afterModelJumpTo,
|
|
39
|
+
tools: config.tools ?? []
|
|
37
40
|
};
|
|
38
|
-
if (config.
|
|
39
|
-
if (config.
|
|
40
|
-
if (config.
|
|
41
|
+
if (config.modifyModelRequest) middleware.modifyModelRequest = async (options, state, runtime) => Promise.resolve(config.modifyModelRequest(options, state, runtime));
|
|
42
|
+
if (config.retryModelRequest) middleware.retryModelRequest = async (error, request, state, runtime, attempt) => Promise.resolve(config.retryModelRequest(error, request, state, runtime, attempt));
|
|
43
|
+
if (config.beforeModel) middleware.beforeModel = async (state, runtime) => Promise.resolve(config.beforeModel(state, runtime));
|
|
44
|
+
if (config.afterModel) middleware.afterModel = async (state, runtime) => Promise.resolve(config.afterModel(state, runtime));
|
|
41
45
|
return middleware;
|
|
42
46
|
}
|
|
43
47
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middleware.js","names":["config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n afterModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { z } from \"zod/v3\";\nimport type {\n AgentMiddleware,\n Runtime,\n Controls,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n} from \"./types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.prepareModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends z.ZodObject<any> | undefined = undefined,\n TContextSchema extends z.ZodObject<any> | undefined = undefined\n>(config: {\n name: string;\n stateSchema?: TSchema;\n contextSchema?: TContextSchema;\n prepareModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n beforeModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n afterModel?: (\n state: (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends z.ZodObject<any> ? z.infer<TContextSchema> : {}\n >,\n controls: Controls<\n (TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}) &\n AgentBuiltInState\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >\n >\n | MiddlewareResult<\n Partial<TSchema extends z.ZodObject<any> ? z.infer<TSchema> : {}>\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n };\n\n if (config.prepareModelRequest) {\n middleware.prepareModelRequest = async (options, state, runtime) =>\n Promise.resolve(config.prepareModelRequest!(options, state, runtime));\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime, controls) =>\n Promise.resolve(config.beforeModel!(state, runtime, controls));\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime, controls) =>\n Promise.resolve(config.afterModel!(state, runtime, controls));\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,SAAgB,iBAGdA,QAkDgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;CACvB;AAED,KAAI,OAAO,qBACT,WAAW,sBAAsB,OAAO,SAAS,OAAO,YACtD,QAAQ,QAAQ,OAAO,oBAAqB,SAAS,OAAO,QAAQ,CAAC;AAGzE,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,SAAS,aAC9C,QAAQ,QAAQ,OAAO,YAAa,OAAO,SAAS,SAAS,CAAC;AAGlE,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,SAAS,aAC7C,QAAQ,QAAQ,OAAO,WAAY,OAAO,SAAS,SAAS,CAAC;AAGjE,QAAO;AACR"}
|
|
1
|
+
{"version":3,"file":"middleware.js","names":["config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}","middleware: AgentMiddleware<TSchema, TContextSchema, any>"],"sources":["../../../src/agents/middlewareAgent/middleware.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type {\n InteropZodObject,\n InteropZodDefault,\n InteropZodOptional,\n InferInteropZodInput,\n InferInteropZodOutput,\n} from \"@langchain/core/utils/types\";\nimport type {\n AgentMiddleware,\n Runtime,\n MiddlewareResult,\n AgentBuiltInState,\n ModelRequest,\n JumpToTarget,\n} from \"./types.js\";\nimport type { ClientTool, ServerTool } from \"../types.js\";\n\n/**\n * Creates a middleware instance with automatic schema inference.\n *\n * @param config - Middleware configuration\n * @param config.name - The name of the middleware\n * @param config.stateSchema - The schema of the middleware state\n * @param config.contextSchema - The schema of the middleware context\n * @param config.modifyModelRequest - The function to prepare the model request\n * @param config.beforeModel - The function to run before the model call\n * @param config.afterModel - The function to run after the model call\n * @returns A middleware instance\n *\n * @example\n * ```ts\n * const authMiddleware = createMiddleware({\n * name: \"AuthMiddleware\",\n * stateSchema: z.object({\n * isAuthenticated: z.boolean().default(false),\n * }),\n * contextSchema: z.object({\n * userId: z.string(),\n * }),\n * beforeModel: async (state, runtime, controls) => {\n * if (!state.isAuthenticated) {\n * return controls.terminate(new Error(\"Not authenticated\"));\n * }\n * },\n * });\n * ```\n */\nexport function createMiddleware<\n TSchema extends InteropZodObject | undefined = undefined,\n TContextSchema extends\n | InteropZodObject\n | InteropZodOptional<InteropZodObject>\n | InteropZodDefault<InteropZodObject>\n | undefined = undefined\n>(config: {\n /**\n * The name of the middleware\n */\n name: string;\n /**\n * The schema of the middleware state. Middleware state is persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n stateSchema?: TSchema;\n /**\n * The schema of the middleware context. Middleware context is read-only and not persisted between multiple invocations. It can be either:\n * - A Zod object\n * - A Zod optional object\n * - A Zod default object\n * - Undefined\n */\n contextSchema?: TContextSchema;\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `beforeModel` hook.\n */\n beforeModelJumpTo?: JumpToTarget[];\n /**\n * Explitictly defines which targets are allowed to be jumped to from the `afterModel` hook.\n */\n afterModelJumpTo?: JumpToTarget[];\n /**\n * Additional tools registered by the middleware.\n */\n tools?: (ClientTool | ServerTool)[];\n /**\n * The function to modify the model request. This function is called after the `beforeModel` hook of this middleware and before the model is invoked.\n * It allows to modify the model request before it is passed to the model.\n *\n * @param request - The model request\n * @param request.model - The model to use for this step.\n * @param request.messages - The messages to send to the model.\n * @param request.systemPrompt - The system message for this step.\n * @param request.toolChoice - The tool choice configuration for this step.\n * @param request.tools - The tools to make available for this step.\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified model request or undefined to pass through\n */\n modifyModelRequest?: (\n options: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to handle model invocation errors and optionally retry.\n *\n * @param error - The exception that occurred during model invocation\n * @param request - The original model request that failed\n * @param state - The current agent state\n * @param runtime - The runtime context\n * @param attempt - The current attempt number (1-indexed)\n * @returns Modified request to retry with, or undefined/null to propagate the error (re-raise)\n */\n retryModelRequest?: (\n error: Error,\n request: ModelRequest,\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt: number\n ) => Promise<ModelRequest | void> | ModelRequest | void;\n /**\n * The function to run before the model call. This function is called before the model is invoked and before the `modifyModelRequest` hook.\n * It allows to modify the state of the agent.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n beforeModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n /**\n * The function to run after the model call. This function is called after the model is invoked and before any tools are called.\n * It allows to modify the state of the agent after the model is invoked, e.g. to update tool call parameters.\n *\n * @param state - The middleware state\n * @param runtime - The middleware runtime\n * @returns The modified middleware state or undefined to pass through\n */\n afterModel?: (\n state: (TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}) &\n AgentBuiltInState,\n runtime: Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n ) =>\n | Promise<\n MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject\n ? InferInteropZodInput<TSchema>\n : {}\n >\n >\n >\n | MiddlewareResult<\n Partial<\n TSchema extends InteropZodObject ? InferInteropZodInput<TSchema> : {}\n >\n >;\n}): AgentMiddleware<TSchema, TContextSchema, any> {\n const middleware: AgentMiddleware<TSchema, TContextSchema, any> = {\n name: config.name,\n stateSchema: config.stateSchema,\n contextSchema: config.contextSchema,\n beforeModelJumpTo: config.beforeModelJumpTo,\n afterModelJumpTo: config.afterModelJumpTo,\n tools: config.tools ?? [],\n };\n\n if (config.modifyModelRequest) {\n middleware.modifyModelRequest = async (options, state, runtime) =>\n Promise.resolve(\n config.modifyModelRequest!(\n options,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.retryModelRequest) {\n middleware.retryModelRequest = async (\n error,\n request,\n state,\n runtime,\n attempt\n ) =>\n Promise.resolve(\n config.retryModelRequest!(\n error,\n request,\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >,\n attempt\n )\n );\n }\n\n if (config.beforeModel) {\n middleware.beforeModel = async (state, runtime) =>\n Promise.resolve(\n config.beforeModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n if (config.afterModel) {\n middleware.afterModel = async (state, runtime) =>\n Promise.resolve(\n config.afterModel!(\n state,\n runtime as Runtime<\n TContextSchema extends InteropZodObject\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodDefault<any>\n ? InferInteropZodOutput<TContextSchema>\n : TContextSchema extends InteropZodOptional<any>\n ? Partial<InferInteropZodOutput<TContextSchema>>\n : never\n >\n )\n );\n }\n\n return middleware;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgDA,SAAgB,iBAOdA,QAqKgD;CAChD,MAAMC,aAA4D;EAChE,MAAM,OAAO;EACb,aAAa,OAAO;EACpB,eAAe,OAAO;EACtB,mBAAmB,OAAO;EAC1B,kBAAkB,OAAO;EACzB,OAAO,OAAO,SAAS,CAAE;CAC1B;AAED,KAAI,OAAO,oBACT,WAAW,qBAAqB,OAAO,SAAS,OAAO,YACrD,QAAQ,QACN,OAAO,mBACL,SACA,OACA,QASD,CACF;AAGL,KAAI,OAAO,mBACT,WAAW,oBAAoB,OAC7B,OACA,SACA,OACA,SACA,YAEA,QAAQ,QACN,OAAO,kBACL,OACA,SACA,OACA,SASA,QACD,CACF;AAGL,KAAI,OAAO,aACT,WAAW,cAAc,OAAO,OAAO,YACrC,QAAQ,QACN,OAAO,YACL,OACA,QASD,CACF;AAGL,KAAI,OAAO,YACT,WAAW,aAAa,OAAO,OAAO,YACpC,QAAQ,QACN,OAAO,WACL,OACA,QASD,CACF;AAGL,QAAO;AACR"}
|
|
@@ -11,16 +11,16 @@ var AfterModelNode = class extends require_middleware.MiddlewareNode {
|
|
|
11
11
|
"afterModalNodes"
|
|
12
12
|
];
|
|
13
13
|
name;
|
|
14
|
-
constructor(middleware) {
|
|
14
|
+
constructor(middleware, options) {
|
|
15
15
|
super({
|
|
16
16
|
name: `AfterModelNode_${middleware.name}`,
|
|
17
17
|
func: async (state, config) => this.invokeMiddleware(state, config)
|
|
18
|
-
});
|
|
18
|
+
}, options);
|
|
19
19
|
this.middleware = middleware;
|
|
20
20
|
this.name = `AfterModelNode_${middleware.name}`;
|
|
21
21
|
}
|
|
22
|
-
runHook(state, runtime
|
|
23
|
-
return this.middleware.afterModel(state, runtime
|
|
22
|
+
runHook(state, runtime) {
|
|
23
|
+
return this.middleware.afterModel(state, runtime);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AfterModalNode.cjs","names":["MiddlewareNode","middleware: AgentMiddleware<any, any, any>","state: TStateSchema","config?: LangGraphRunnableConfig","runtime: Runtime<TContextSchema>"
|
|
1
|
+
{"version":3,"file":"AfterModalNode.cjs","names":["MiddlewareNode","middleware: AgentMiddleware<any, any, any>","options: MiddlewareNodeOptions","state: TStateSchema","config?: LangGraphRunnableConfig","runtime: Runtime<TContextSchema>"],"sources":["../../../../src/agents/middlewareAgent/nodes/AfterModalNode.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport { LangGraphRunnableConfig } from \"@langchain/langgraph\";\nimport { MiddlewareNode, MiddlewareNodeOptions } from \"./middleware.js\";\nimport type {\n AgentBuiltInState,\n AgentMiddleware,\n MiddlewareResult,\n Runtime,\n} from \"../types.js\";\n\n/**\n * Node for executing a single middleware's afterModel hook.\n */\nexport class AfterModelNode<\n TStateSchema extends Record<string, any> = Record<string, any>,\n TContextSchema extends Record<string, any> = Record<string, any>\n> extends MiddlewareNode<TStateSchema, TContextSchema> {\n lc_namespace = [\"langchain\", \"agents\", \"afterModalNodes\"];\n\n name: string;\n\n constructor(\n public middleware: AgentMiddleware<any, any, any>,\n options: MiddlewareNodeOptions\n ) {\n super(\n {\n name: `AfterModelNode_${middleware.name}`,\n func: async (state: TStateSchema, config?: LangGraphRunnableConfig) =>\n this.invokeMiddleware(state, config),\n },\n options\n );\n this.name = `AfterModelNode_${middleware.name}`;\n }\n\n runHook(state: TStateSchema, runtime: Runtime<TContextSchema>) {\n return this.middleware.afterModel!(\n state as Record<string, any> & AgentBuiltInState,\n runtime as Runtime<unknown>\n ) as Promise<MiddlewareResult<TStateSchema>>;\n }\n}\n"],"mappings":";;;;;;AAaA,IAAa,iBAAb,cAGUA,kCAA6C;CACrD,eAAe;EAAC;EAAa;EAAU;CAAkB;CAEzD;CAEA,YACSC,YACPC,SACA;EACA,MACE;GACE,MAAM,CAAC,eAAe,EAAE,WAAW,MAAM;GACzC,MAAM,OAAOC,OAAqBC,WAChC,KAAK,iBAAiB,OAAO,OAAO;EACvC,GACD,QACD;EAVM;EAWP,KAAK,OAAO,CAAC,eAAe,EAAE,WAAW,MAAM;CAChD;CAED,QAAQD,OAAqBE,SAAkC;AAC7D,SAAO,KAAK,WAAW,WACrB,OACA,QACD;CACF;AACF"}
|
|
@@ -11,16 +11,16 @@ var AfterModelNode = class extends MiddlewareNode {
|
|
|
11
11
|
"afterModalNodes"
|
|
12
12
|
];
|
|
13
13
|
name;
|
|
14
|
-
constructor(middleware) {
|
|
14
|
+
constructor(middleware, options) {
|
|
15
15
|
super({
|
|
16
16
|
name: `AfterModelNode_${middleware.name}`,
|
|
17
17
|
func: async (state, config) => this.invokeMiddleware(state, config)
|
|
18
|
-
});
|
|
18
|
+
}, options);
|
|
19
19
|
this.middleware = middleware;
|
|
20
20
|
this.name = `AfterModelNode_${middleware.name}`;
|
|
21
21
|
}
|
|
22
|
-
runHook(state, runtime
|
|
23
|
-
return this.middleware.afterModel(state, runtime
|
|
22
|
+
runHook(state, runtime) {
|
|
23
|
+
return this.middleware.afterModel(state, runtime);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
26
|
|