@langchain/core 0.3.71 → 1.0.0-alpha.1
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/README.md +3 -3
- package/dist/_virtual/rolldown_runtime.cjs +32 -0
- package/dist/_virtual/rolldown_runtime.js +11 -0
- package/dist/agents.cjs +12 -2
- package/dist/agents.cjs.map +1 -0
- package/dist/agents.d.cts +19 -0
- package/dist/agents.d.cts.map +1 -0
- package/dist/agents.d.ts +16 -10
- package/dist/agents.d.ts.map +1 -0
- package/dist/agents.js +6 -1
- package/dist/agents.js.map +1 -0
- package/dist/caches/base.cjs +99 -104
- package/dist/caches/base.cjs.map +1 -0
- package/dist/caches/base.d.cts +83 -0
- package/dist/caches/base.d.cts.map +1 -0
- package/dist/caches/base.d.ts +60 -45
- package/dist/caches/base.d.ts.map +1 -0
- package/dist/caches/base.js +91 -98
- package/dist/caches/base.js.map +1 -0
- package/dist/callbacks/base.cjs +112 -185
- package/dist/callbacks/base.cjs.map +1 -0
- package/dist/callbacks/base.d.cts +318 -0
- package/dist/callbacks/base.d.cts.map +1 -0
- package/dist/callbacks/base.d.ts +234 -222
- package/dist/callbacks/base.d.ts.map +1 -0
- package/dist/callbacks/base.js +107 -149
- package/dist/callbacks/base.js.map +1 -0
- package/dist/callbacks/dispatch/index.cjs +56 -46
- package/dist/callbacks/dispatch/index.cjs.map +1 -0
- package/dist/callbacks/dispatch/index.d.cts +43 -0
- package/dist/callbacks/dispatch/index.d.cts.map +1 -0
- package/dist/callbacks/dispatch/index.d.ts +10 -2
- package/dist/callbacks/dispatch/index.d.ts.map +1 -0
- package/dist/callbacks/dispatch/index.js +48 -41
- package/dist/callbacks/dispatch/index.js.map +1 -0
- package/dist/callbacks/dispatch/web.cjs +60 -56
- package/dist/callbacks/dispatch/web.cjs.map +1 -0
- package/dist/callbacks/dispatch/web.d.cts +40 -0
- package/dist/callbacks/dispatch/web.d.cts.map +1 -0
- package/dist/callbacks/dispatch/web.d.ts +10 -2
- package/dist/callbacks/dispatch/web.d.ts.map +1 -0
- package/dist/callbacks/dispatch/web.js +54 -53
- package/dist/callbacks/dispatch/web.js.map +1 -0
- package/dist/callbacks/manager.cjs +580 -877
- package/dist/callbacks/manager.cjs.map +1 -0
- package/dist/callbacks/manager.d.cts +192 -0
- package/dist/callbacks/manager.d.cts.map +1 -0
- package/dist/callbacks/manager.d.ts +146 -133
- package/dist/callbacks/manager.d.ts.map +1 -0
- package/dist/callbacks/manager.js +564 -863
- package/dist/callbacks/manager.js.map +1 -0
- package/dist/callbacks/promises.cjs +20 -6
- package/dist/callbacks/promises.cjs.map +1 -0
- package/dist/callbacks/promises.d.cts +2 -0
- package/dist/callbacks/promises.d.ts +1 -1
- package/dist/callbacks/promises.js +12 -1
- package/dist/callbacks/promises.js.map +1 -0
- package/dist/chat_history.cjs +126 -119
- package/dist/chat_history.cjs.map +1 -0
- package/dist/chat_history.d.cts +99 -0
- package/dist/chat_history.d.cts.map +1 -0
- package/dist/chat_history.d.ts +82 -75
- package/dist/chat_history.d.ts.map +1 -0
- package/dist/chat_history.js +118 -113
- package/dist/chat_history.js.map +1 -0
- package/dist/context.cjs +29 -18
- package/dist/context.cjs.map +1 -0
- package/dist/context.d.cts +7 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.ts +7 -2
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +18 -11
- package/dist/context.js.map +1 -0
- package/dist/document_loaders/base.cjs +31 -22
- package/dist/document_loaders/base.cjs.map +1 -0
- package/dist/document_loaders/base.d.cts +34 -0
- package/dist/document_loaders/base.d.cts.map +1 -0
- package/dist/document_loaders/base.d.ts +22 -16
- package/dist/document_loaders/base.d.ts.map +1 -0
- package/dist/document_loaders/base.js +26 -19
- package/dist/document_loaders/base.js.map +1 -0
- package/dist/document_loaders/langsmith.cjs +128 -195
- package/dist/document_loaders/langsmith.cjs.map +1 -0
- package/dist/document_loaders/langsmith.d.cts +103 -0
- package/dist/document_loaders/langsmith.d.cts.map +1 -0
- package/dist/document_loaders/langsmith.d.ts +52 -45
- package/dist/document_loaders/langsmith.d.ts.map +1 -0
- package/dist/document_loaders/langsmith.js +121 -190
- package/dist/document_loaders/langsmith.js.map +1 -0
- package/dist/documents/document.cjs +23 -40
- package/dist/documents/document.cjs.map +1 -0
- package/dist/documents/document.d.cts +50 -0
- package/dist/documents/document.d.cts.map +1 -0
- package/dist/documents/document.d.ts +44 -31
- package/dist/documents/document.d.ts.map +1 -0
- package/dist/documents/document.js +23 -37
- package/dist/documents/document.js.map +1 -0
- package/dist/documents/index.cjs +23 -18
- package/dist/documents/index.cjs.map +1 -0
- package/dist/documents/index.d.cts +3 -0
- package/dist/documents/index.d.ts +3 -2
- package/dist/documents/index.js +15 -2
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/transformers.cjs +46 -48
- package/dist/documents/transformers.cjs.map +1 -0
- package/dist/documents/transformers.d.cts +44 -0
- package/dist/documents/transformers.d.cts.map +1 -0
- package/dist/documents/transformers.d.ts +27 -21
- package/dist/documents/transformers.d.ts.map +1 -0
- package/dist/documents/transformers.js +45 -43
- package/dist/documents/transformers.js.map +1 -0
- package/dist/embeddings.cjs +28 -22
- package/dist/embeddings.cjs.map +1 -0
- package/dist/embeddings.d.cts +56 -0
- package/dist/embeddings.d.cts.map +1 -0
- package/dist/embeddings.d.ts +45 -39
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/embeddings.js +22 -18
- package/dist/embeddings.js.map +1 -0
- package/dist/errors/index.cjs +9 -8
- package/dist/errors/index.cjs.map +1 -0
- package/dist/errors/index.js +9 -6
- package/dist/errors/index.js.map +1 -0
- package/dist/example_selectors/base.cjs +15 -17
- package/dist/example_selectors/base.cjs.map +1 -0
- package/dist/example_selectors/base.d.cts +26 -0
- package/dist/example_selectors/base.d.cts.map +1 -0
- package/dist/example_selectors/base.d.ts +21 -15
- package/dist/example_selectors/base.d.ts.map +1 -0
- package/dist/example_selectors/base.js +15 -13
- package/dist/example_selectors/base.js.map +1 -0
- package/dist/example_selectors/conditional.cjs +56 -68
- package/dist/example_selectors/conditional.cjs.map +1 -0
- package/dist/example_selectors/conditional.d.cts +62 -0
- package/dist/example_selectors/conditional.d.cts.map +1 -0
- package/dist/example_selectors/conditional.d.ts +42 -43
- package/dist/example_selectors/conditional.d.ts.map +1 -0
- package/dist/example_selectors/conditional.js +54 -63
- package/dist/example_selectors/conditional.js.map +1 -0
- package/dist/example_selectors/index.cjs +33 -20
- package/dist/example_selectors/index.cjs.map +1 -0
- package/dist/example_selectors/index.d.cts +5 -0
- package/dist/example_selectors/index.d.ts +5 -4
- package/dist/example_selectors/index.js +21 -4
- package/dist/example_selectors/index.js.map +1 -0
- package/dist/example_selectors/length_based.cjs +118 -145
- package/dist/example_selectors/length_based.cjs.map +1 -0
- package/dist/example_selectors/length_based.d.cts +95 -0
- package/dist/example_selectors/length_based.d.cts.map +1 -0
- package/dist/example_selectors/length_based.d.ts +45 -39
- package/dist/example_selectors/length_based.d.ts.map +1 -0
- package/dist/example_selectors/length_based.js +118 -141
- package/dist/example_selectors/length_based.js.map +1 -0
- package/dist/example_selectors/semantic_similarity.cjs +118 -135
- package/dist/example_selectors/semantic_similarity.cjs.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.cts +97 -0
- package/dist/example_selectors/semantic_similarity.d.cts.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.ts +59 -53
- package/dist/example_selectors/semantic_similarity.d.ts.map +1 -0
- package/dist/example_selectors/semantic_similarity.js +117 -130
- package/dist/example_selectors/semantic_similarity.js.map +1 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/indexing/base.cjs +207 -272
- package/dist/indexing/base.cjs.map +1 -0
- package/dist/indexing/base.d.cts +125 -0
- package/dist/indexing/base.d.cts.map +1 -0
- package/dist/indexing/base.d.ts +88 -80
- package/dist/indexing/base.d.ts.map +1 -0
- package/dist/indexing/base.js +205 -267
- package/dist/indexing/base.js.map +1 -0
- package/dist/indexing/index.cjs +33 -18
- package/dist/indexing/index.cjs.map +1 -0
- package/dist/indexing/index.d.cts +3 -0
- package/dist/indexing/index.d.ts +3 -2
- package/dist/indexing/index.js +20 -2
- package/dist/indexing/index.js.map +1 -0
- package/dist/indexing/record_manager.cjs +11 -17
- package/dist/indexing/record_manager.cjs.map +1 -0
- package/dist/indexing/record_manager.d.cts +70 -0
- package/dist/indexing/record_manager.d.cts.map +1 -0
- package/dist/indexing/record_manager.d.ts +65 -59
- package/dist/indexing/record_manager.d.ts.map +1 -0
- package/dist/indexing/record_manager.js +10 -13
- package/dist/indexing/record_manager.js.map +1 -0
- package/dist/language_models/base.cjs +212 -293
- package/dist/language_models/base.cjs.map +1 -0
- package/dist/language_models/base.d.cts +301 -0
- package/dist/language_models/base.d.cts.map +1 -0
- package/dist/language_models/base.d.ts +256 -212
- package/dist/language_models/base.d.ts.map +1 -0
- package/dist/language_models/base.js +202 -285
- package/dist/language_models/base.js.map +1 -0
- package/dist/language_models/chat_models.cjs +500 -622
- package/dist/language_models/chat_models.cjs.map +1 -0
- package/dist/language_models/chat_models.d.cts +261 -0
- package/dist/language_models/chat_models.d.cts.map +1 -0
- package/dist/language_models/chat_models.d.ts +228 -172
- package/dist/language_models/chat_models.d.ts.map +1 -0
- package/dist/language_models/chat_models.js +492 -616
- package/dist/language_models/chat_models.js.map +1 -0
- package/dist/language_models/llms.cjs +328 -376
- package/dist/language_models/llms.cjs.map +1 -0
- package/dist/language_models/llms.d.cts +149 -0
- package/dist/language_models/llms.d.cts.map +1 -0
- package/dist/language_models/llms.d.ts +135 -115
- package/dist/language_models/llms.d.ts.map +1 -0
- package/dist/language_models/llms.js +321 -371
- package/dist/language_models/llms.js.map +1 -0
- package/dist/language_models/utils.cjs +19 -0
- package/dist/language_models/utils.cjs.map +1 -0
- package/dist/language_models/utils.js +17 -0
- package/dist/language_models/utils.js.map +1 -0
- package/dist/load/import_constants.cjs +7 -5
- package/dist/load/import_constants.cjs.map +1 -0
- package/dist/load/import_constants.js +6 -2
- package/dist/load/import_constants.js.map +1 -0
- package/dist/load/import_map.cjs +138 -79
- package/dist/load/import_map.cjs.map +1 -0
- package/dist/load/import_map.js +134 -44
- package/dist/load/import_map.js.map +1 -0
- package/dist/load/import_type.d.cts +7 -0
- package/dist/load/import_type.d.cts.map +1 -0
- package/dist/load/import_type.d.ts +7 -4
- package/dist/load/import_type.d.ts.map +1 -0
- package/dist/load/index.cjs +85 -192
- package/dist/load/index.cjs.map +1 -0
- package/dist/load/index.d.cts +12 -0
- package/dist/load/index.d.cts.map +1 -0
- package/dist/load/index.d.ts +11 -6
- package/dist/load/index.d.ts.map +1 -0
- package/dist/load/index.js +84 -155
- package/dist/load/index.js.map +1 -0
- package/dist/load/map_keys.cjs +16 -19
- package/dist/load/map_keys.cjs.map +1 -0
- package/dist/load/map_keys.d.cts +8 -0
- package/dist/load/map_keys.d.cts.map +1 -0
- package/dist/load/map_keys.d.ts +7 -8
- package/dist/load/map_keys.d.ts.map +1 -0
- package/dist/load/map_keys.js +14 -12
- package/dist/load/map_keys.js.map +1 -0
- package/dist/load/serializable.cjs +143 -185
- package/dist/load/serializable.cjs.map +1 -0
- package/dist/load/serializable.d.cts +82 -0
- package/dist/load/serializable.d.cts.map +1 -0
- package/dist/load/serializable.d.ts +74 -68
- package/dist/load/serializable.d.ts.map +1 -0
- package/dist/load/serializable.js +136 -180
- package/dist/load/serializable.js.map +1 -0
- package/dist/memory.cjs +60 -51
- package/dist/memory.cjs.map +1 -0
- package/dist/memory.d.cts +69 -0
- package/dist/memory.d.cts.map +1 -0
- package/dist/memory.d.ts +34 -27
- package/dist/memory.d.ts.map +1 -0
- package/dist/memory.js +54 -47
- package/dist/memory.js.map +1 -0
- package/dist/messages/ai.cjs +280 -333
- package/dist/messages/ai.cjs.map +1 -0
- package/dist/messages/ai.d.cts +148 -0
- package/dist/messages/ai.d.cts.map +1 -0
- package/dist/messages/ai.d.ts +119 -107
- package/dist/messages/ai.d.ts.map +1 -0
- package/dist/messages/ai.js +279 -328
- package/dist/messages/ai.js.map +1 -0
- package/dist/messages/base.cjs +225 -364
- package/dist/messages/base.cjs.map +1 -0
- package/dist/messages/base.d.cts +188 -0
- package/dist/messages/base.d.cts.map +1 -0
- package/dist/messages/base.d.ts +147 -147
- package/dist/messages/base.d.ts.map +1 -0
- package/dist/messages/base.js +222 -357
- package/dist/messages/base.js.map +1 -0
- package/dist/messages/block_translators/anthropic.cjs +320 -0
- package/dist/messages/block_translators/anthropic.cjs.map +1 -0
- package/dist/messages/block_translators/anthropic.js +319 -0
- package/dist/messages/block_translators/anthropic.js.map +1 -0
- package/dist/messages/block_translators/data.cjs +71 -0
- package/dist/messages/block_translators/data.cjs.map +1 -0
- package/dist/messages/block_translators/data.js +69 -0
- package/dist/messages/block_translators/data.js.map +1 -0
- package/dist/messages/block_translators/index.cjs +12 -0
- package/dist/messages/block_translators/index.cjs.map +1 -0
- package/dist/messages/block_translators/index.js +12 -0
- package/dist/messages/block_translators/index.js.map +1 -0
- package/dist/messages/block_translators/openai.cjs +324 -0
- package/dist/messages/block_translators/openai.cjs.map +1 -0
- package/dist/messages/block_translators/openai.js +323 -0
- package/dist/messages/block_translators/openai.js.map +1 -0
- package/dist/messages/block_translators/utils.cjs +35 -0
- package/dist/messages/block_translators/utils.cjs.map +1 -0
- package/dist/messages/block_translators/utils.js +28 -0
- package/dist/messages/block_translators/utils.js.map +1 -0
- package/dist/messages/chat.cjs +78 -86
- package/dist/messages/chat.cjs.map +1 -0
- package/dist/messages/chat.d.cts +37 -0
- package/dist/messages/chat.d.cts.map +1 -0
- package/dist/messages/chat.d.ts +27 -22
- package/dist/messages/chat.d.ts.map +1 -0
- package/dist/messages/chat.js +77 -81
- package/dist/messages/chat.js.map +1 -0
- package/dist/messages/content/base.d.cts +20 -0
- package/dist/messages/content/base.d.cts.map +1 -0
- package/dist/messages/content/base.d.ts +20 -0
- package/dist/messages/content/base.d.ts.map +1 -0
- package/dist/messages/content/data.cjs +146 -0
- package/dist/messages/content/data.cjs.map +1 -0
- package/dist/messages/content/data.d.cts +280 -0
- package/dist/messages/content/data.d.cts.map +1 -0
- package/dist/messages/content/data.d.ts +280 -0
- package/dist/messages/content/data.d.ts.map +1 -0
- package/dist/messages/content/data.js +137 -0
- package/dist/messages/content/data.js.map +1 -0
- package/dist/messages/content/index.cjs +14 -0
- package/dist/messages/content/index.cjs.map +1 -0
- package/dist/messages/content/index.d.cts +101 -0
- package/dist/messages/content/index.d.cts.map +1 -0
- package/dist/messages/content/index.d.ts +101 -0
- package/dist/messages/content/index.d.ts.map +1 -0
- package/dist/messages/content/index.js +14 -0
- package/dist/messages/content/index.js.map +1 -0
- package/dist/messages/content/multimodal.cjs +13 -0
- package/dist/messages/content/multimodal.cjs.map +1 -0
- package/dist/messages/content/multimodal.d.cts +108 -0
- package/dist/messages/content/multimodal.d.cts.map +1 -0
- package/dist/messages/content/multimodal.d.ts +108 -0
- package/dist/messages/content/multimodal.d.ts.map +1 -0
- package/dist/messages/content/multimodal.js +12 -0
- package/dist/messages/content/multimodal.js.map +1 -0
- package/dist/messages/content/tools.cjs +15 -0
- package/dist/messages/content/tools.cjs.map +1 -0
- package/dist/messages/content/tools.d.cts +151 -0
- package/dist/messages/content/tools.d.cts.map +1 -0
- package/dist/messages/content/tools.d.ts +151 -0
- package/dist/messages/content/tools.d.ts.map +1 -0
- package/dist/messages/content/tools.js +14 -0
- package/dist/messages/content/tools.js.map +1 -0
- package/dist/messages/function.cjs +49 -49
- package/dist/messages/function.cjs.map +1 -0
- package/dist/messages/function.d.cts +30 -0
- package/dist/messages/function.d.cts.map +1 -0
- package/dist/messages/function.d.ts +20 -16
- package/dist/messages/function.d.ts.map +1 -0
- package/dist/messages/function.js +48 -44
- package/dist/messages/function.js.map +1 -0
- package/dist/messages/human.cjs +47 -49
- package/dist/messages/human.cjs.map +1 -0
- package/dist/messages/human.d.cts +31 -0
- package/dist/messages/human.d.cts.map +1 -0
- package/dist/messages/human.d.ts +22 -22
- package/dist/messages/human.d.ts.map +1 -0
- package/dist/messages/human.js +46 -44
- package/dist/messages/human.js.map +1 -0
- package/dist/messages/index.cjs +139 -34
- package/dist/messages/index.cjs.map +1 -0
- package/dist/messages/index.d.cts +13 -0
- package/dist/messages/index.d.ts +13 -11
- package/dist/messages/index.js +78 -13
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/modifier.cjs +30 -33
- package/dist/messages/modifier.cjs.map +1 -0
- package/dist/messages/modifier.d.cts +24 -0
- package/dist/messages/modifier.d.cts.map +1 -0
- package/dist/messages/modifier.d.ts +18 -13
- package/dist/messages/modifier.d.ts.map +1 -0
- package/dist/messages/modifier.js +30 -29
- package/dist/messages/modifier.js.map +1 -0
- package/dist/messages/system.cjs +47 -49
- package/dist/messages/system.cjs.map +1 -0
- package/dist/messages/system.d.cts +31 -0
- package/dist/messages/system.d.cts.map +1 -0
- package/dist/messages/system.d.ts +22 -22
- package/dist/messages/system.d.ts.map +1 -0
- package/dist/messages/system.js +46 -44
- package/dist/messages/system.js.map +1 -0
- package/dist/messages/tool.cjs +153 -189
- package/dist/messages/tool.cjs.map +1 -0
- package/dist/messages/tool.d.cts +173 -0
- package/dist/messages/tool.d.cts.map +1 -0
- package/dist/messages/tool.d.ts +96 -90
- package/dist/messages/tool.d.ts.map +1 -0
- package/dist/messages/tool.js +145 -183
- package/dist/messages/tool.js.map +1 -0
- package/dist/messages/transformers.cjs +287 -431
- package/dist/messages/transformers.cjs.map +1 -0
- package/dist/messages/transformers.d.cts +472 -0
- package/dist/messages/transformers.d.cts.map +1 -0
- package/dist/messages/transformers.d.ts +111 -105
- package/dist/messages/transformers.d.ts.map +1 -0
- package/dist/messages/transformers.js +284 -425
- package/dist/messages/transformers.js.map +1 -0
- package/dist/messages/utils.cjs +172 -267
- package/dist/messages/utils.cjs.map +1 -0
- package/dist/messages/utils.d.cts +36 -0
- package/dist/messages/utils.d.cts.map +1 -0
- package/dist/messages/utils.d.ts +13 -8
- package/dist/messages/utils.d.ts.map +1 -0
- package/dist/messages/utils.js +170 -262
- package/dist/messages/utils.js.map +1 -0
- package/dist/output_parsers/base.cjs +104 -120
- package/dist/output_parsers/base.cjs.map +1 -0
- package/dist/output_parsers/base.d.cts +108 -0
- package/dist/output_parsers/base.d.cts.map +1 -0
- package/dist/output_parsers/base.d.ts +76 -71
- package/dist/output_parsers/base.d.ts.map +1 -0
- package/dist/output_parsers/base.js +102 -114
- package/dist/output_parsers/base.js.map +1 -0
- package/dist/output_parsers/bytes.cjs +27 -39
- package/dist/output_parsers/bytes.cjs.map +1 -0
- package/dist/output_parsers/bytes.d.cts +19 -0
- package/dist/output_parsers/bytes.d.cts.map +1 -0
- package/dist/output_parsers/bytes.d.ts +13 -7
- package/dist/output_parsers/bytes.d.ts.map +1 -0
- package/dist/output_parsers/bytes.js +27 -35
- package/dist/output_parsers/bytes.js.map +1 -0
- package/dist/output_parsers/index.cjs +66 -24
- package/dist/output_parsers/index.cjs.map +1 -0
- package/dist/output_parsers/index.d.cts +10 -0
- package/dist/output_parsers/index.d.ts +10 -8
- package/dist/output_parsers/index.js +40 -8
- package/dist/output_parsers/index.js.map +1 -0
- package/dist/output_parsers/json.cjs +36 -50
- package/dist/output_parsers/json.cjs.map +1 -0
- package/dist/output_parsers/json.d.cts +26 -0
- package/dist/output_parsers/json.d.cts.map +1 -0
- package/dist/output_parsers/json.d.ts +20 -11
- package/dist/output_parsers/json.d.ts.map +1 -0
- package/dist/output_parsers/json.js +36 -45
- package/dist/output_parsers/json.js.map +1 -0
- package/dist/output_parsers/list.cjs +155 -239
- package/dist/output_parsers/list.cjs.map +1 -0
- package/dist/output_parsers/list.d.cts +85 -0
- package/dist/output_parsers/list.d.cts.map +1 -0
- package/dist/output_parsers/list.d.ts +67 -58
- package/dist/output_parsers/list.d.ts.map +1 -0
- package/dist/output_parsers/list.js +151 -231
- package/dist/output_parsers/list.js.map +1 -0
- package/dist/output_parsers/openai_functions/index.cjs +22 -17
- package/dist/output_parsers/openai_functions/index.cjs.map +1 -0
- package/dist/output_parsers/openai_functions/index.d.cts +2 -0
- package/dist/output_parsers/openai_functions/index.d.ts +2 -1
- package/dist/output_parsers/openai_functions/index.js +14 -1
- package/dist/output_parsers/openai_functions/index.js.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs +140 -203
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +90 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts +68 -58
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.js +138 -197
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.js.map +1 -0
- package/dist/output_parsers/openai_tools/index.cjs +26 -17
- package/dist/output_parsers/openai_tools/index.cjs.map +1 -0
- package/dist/output_parsers/openai_tools/index.d.cts +2 -0
- package/dist/output_parsers/openai_tools/index.d.ts +2 -1
- package/dist/output_parsers/openai_tools/index.js +16 -1
- package/dist/output_parsers/openai_tools/index.js.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +176 -256
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +120 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +98 -70
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +173 -249
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -0
- package/dist/output_parsers/string.cjs +70 -84
- package/dist/output_parsers/string.cjs.map +1 -0
- package/dist/output_parsers/string.d.cts +45 -0
- package/dist/output_parsers/string.d.cts.map +1 -0
- package/dist/output_parsers/string.d.ts +25 -19
- package/dist/output_parsers/string.d.ts.map +1 -0
- package/dist/output_parsers/string.js +70 -80
- package/dist/output_parsers/string.js.map +1 -0
- package/dist/output_parsers/structured.cjs +148 -181
- package/dist/output_parsers/structured.cjs.map +1 -0
- package/dist/output_parsers/structured.d.cts +97 -0
- package/dist/output_parsers/structured.d.cts.map +1 -0
- package/dist/output_parsers/structured.d.ts +82 -74
- package/dist/output_parsers/structured.d.ts.map +1 -0
- package/dist/output_parsers/structured.js +144 -174
- package/dist/output_parsers/structured.js.map +1 -0
- package/dist/output_parsers/transform.cjs +79 -109
- package/dist/output_parsers/transform.cjs.map +1 -0
- package/dist/output_parsers/transform.d.cts +41 -0
- package/dist/output_parsers/transform.d.cts.map +1 -0
- package/dist/output_parsers/transform.d.ts +29 -22
- package/dist/output_parsers/transform.d.ts.map +1 -0
- package/dist/output_parsers/transform.js +77 -104
- package/dist/output_parsers/transform.js.map +1 -0
- package/dist/output_parsers/xml.cjs +95 -129
- package/dist/output_parsers/xml.cjs.map +1 -0
- package/dist/output_parsers/xml.d.cts +34 -0
- package/dist/output_parsers/xml.d.cts.map +1 -0
- package/dist/output_parsers/xml.d.ts +29 -24
- package/dist/output_parsers/xml.d.ts.map +1 -0
- package/dist/output_parsers/xml.js +93 -124
- package/dist/output_parsers/xml.js.map +1 -0
- package/dist/outputs.cjs +57 -57
- package/dist/outputs.cjs.map +1 -0
- package/dist/outputs.d.cts +72 -0
- package/dist/outputs.d.cts.map +1 -0
- package/dist/outputs.d.ts +55 -44
- package/dist/outputs.d.ts.map +1 -0
- package/dist/outputs.js +50 -53
- package/dist/outputs.js.map +1 -0
- package/dist/prompt_values.cjs +101 -148
- package/dist/prompt_values.cjs.map +1 -0
- package/dist/prompt_values.d.cts +83 -0
- package/dist/prompt_values.d.cts.map +1 -0
- package/dist/prompt_values.d.ts +53 -48
- package/dist/prompt_values.d.ts.map +1 -0
- package/dist/prompt_values.js +90 -139
- package/dist/prompt_values.js.map +1 -0
- package/dist/prompts/base.cjs +106 -173
- package/dist/prompts/base.cjs.map +1 -0
- package/dist/prompts/base.d.cts +108 -0
- package/dist/prompts/base.d.cts.map +1 -0
- package/dist/prompts/base.d.ts +98 -85
- package/dist/prompts/base.d.ts.map +1 -0
- package/dist/prompts/base.js +106 -136
- package/dist/prompts/base.js.map +1 -0
- package/dist/prompts/chat.cjs +533 -786
- package/dist/prompts/chat.cjs.map +1 -0
- package/dist/prompts/chat.d.cts +296 -0
- package/dist/prompts/chat.d.cts.map +1 -0
- package/dist/prompts/chat.d.ts +191 -136
- package/dist/prompts/chat.d.ts.map +1 -0
- package/dist/prompts/chat.js +522 -771
- package/dist/prompts/chat.js.map +1 -0
- package/dist/prompts/dict.cjs +60 -110
- package/dist/prompts/dict.cjs.map +1 -0
- package/dist/prompts/dict.d.cts +23 -0
- package/dist/prompts/dict.d.cts.map +1 -0
- package/dist/prompts/dict.d.ts +19 -14
- package/dist/prompts/dict.d.ts.map +1 -0
- package/dist/prompts/dict.js +58 -104
- package/dist/prompts/dict.js.map +1 -0
- package/dist/prompts/few_shot.cjs +239 -352
- package/dist/prompts/few_shot.cjs.map +1 -0
- package/dist/prompts/few_shot.d.cts +204 -0
- package/dist/prompts/few_shot.d.cts.map +1 -0
- package/dist/prompts/few_shot.d.ts +157 -148
- package/dist/prompts/few_shot.d.ts.map +1 -0
- package/dist/prompts/few_shot.js +237 -346
- package/dist/prompts/few_shot.js.map +1 -0
- package/dist/prompts/image.cjs +92 -126
- package/dist/prompts/image.cjs.map +1 -0
- package/dist/prompts/image.d.cts +86 -0
- package/dist/prompts/image.d.cts.map +1 -0
- package/dist/prompts/image.d.ts +76 -60
- package/dist/prompts/image.d.ts.map +1 -0
- package/dist/prompts/image.js +92 -122
- package/dist/prompts/image.js.map +1 -0
- package/dist/prompts/index.cjs +79 -27
- package/dist/prompts/index.cjs.map +1 -0
- package/dist/prompts/index.d.cts +12 -0
- package/dist/prompts/index.d.ts +12 -11
- package/dist/prompts/index.js +47 -11
- package/dist/prompts/index.js.map +1 -0
- package/dist/prompts/pipeline.cjs +128 -142
- package/dist/prompts/pipeline.cjs.map +1 -0
- package/dist/prompts/pipeline.d.cts +104 -0
- package/dist/prompts/pipeline.d.cts.map +1 -0
- package/dist/prompts/pipeline.d.ts +48 -42
- package/dist/prompts/pipeline.d.ts.map +1 -0
- package/dist/prompts/pipeline.js +127 -137
- package/dist/prompts/pipeline.js.map +1 -0
- package/dist/prompts/prompt.cjs +131 -164
- package/dist/prompts/prompt.cjs.map +1 -0
- package/dist/prompts/prompt.d.cts +134 -0
- package/dist/prompts/prompt.d.cts.map +1 -0
- package/dist/prompts/prompt.d.ts +106 -79
- package/dist/prompts/prompt.d.ts.map +1 -0
- package/dist/prompts/prompt.js +131 -160
- package/dist/prompts/prompt.js.map +1 -0
- package/dist/prompts/serde.d.cts +50 -0
- package/dist/prompts/serde.d.cts.map +1 -0
- package/dist/prompts/serde.d.ts +24 -17
- package/dist/prompts/serde.d.ts.map +1 -0
- package/dist/prompts/string.cjs +23 -23
- package/dist/prompts/string.cjs.map +1 -0
- package/dist/prompts/string.d.cts +27 -0
- package/dist/prompts/string.d.cts.map +1 -0
- package/dist/prompts/string.d.ts +21 -11
- package/dist/prompts/string.d.ts.map +1 -0
- package/dist/prompts/string.js +23 -19
- package/dist/prompts/string.js.map +1 -0
- package/dist/prompts/structured.cjs +46 -70
- package/dist/prompts/structured.cjs.map +1 -0
- package/dist/prompts/structured.d.cts +40 -0
- package/dist/prompts/structured.d.cts.map +1 -0
- package/dist/prompts/structured.d.ts +33 -14
- package/dist/prompts/structured.d.ts.map +1 -0
- package/dist/prompts/structured.js +46 -66
- package/dist/prompts/structured.js.map +1 -0
- package/dist/prompts/template.cjs +138 -157
- package/dist/prompts/template.cjs.map +1 -0
- package/dist/prompts/template.d.cts +48 -0
- package/dist/prompts/template.d.cts.map +1 -0
- package/dist/prompts/template.d.ts +24 -19
- package/dist/prompts/template.d.ts.map +1 -0
- package/dist/prompts/template.js +135 -150
- package/dist/prompts/template.js.map +1 -0
- package/dist/retrievers/document_compressors/base.cjs +21 -11
- package/dist/retrievers/document_compressors/base.cjs.map +1 -0
- package/dist/retrievers/document_compressors/base.d.cts +25 -0
- package/dist/retrievers/document_compressors/base.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/base.d.ts +20 -13
- package/dist/retrievers/document_compressors/base.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/base.js +16 -8
- package/dist/retrievers/document_compressors/base.js.map +1 -0
- package/dist/retrievers/index.cjs +119 -129
- package/dist/retrievers/index.cjs.map +1 -0
- package/dist/retrievers/index.d.cts +144 -0
- package/dist/retrievers/index.d.cts.map +1 -0
- package/dist/retrievers/index.d.ts +98 -88
- package/dist/retrievers/index.d.ts.map +1 -0
- package/dist/retrievers/index.js +113 -125
- package/dist/retrievers/index.js.map +1 -0
- package/dist/runnables/base.cjs +1808 -2401
- package/dist/runnables/base.cjs.map +1 -0
- package/dist/runnables/base.d.cts +990 -0
- package/dist/runnables/base.d.cts.map +1 -0
- package/dist/runnables/base.d.ts +633 -586
- package/dist/runnables/base.d.ts.map +1 -0
- package/dist/runnables/base.js +1790 -2375
- package/dist/runnables/base.js.map +1 -0
- package/dist/runnables/branch.cjs +151 -205
- package/dist/runnables/branch.cjs.map +1 -0
- package/dist/runnables/branch.d.cts +94 -0
- package/dist/runnables/branch.d.cts.map +1 -0
- package/dist/runnables/branch.d.ts +50 -51
- package/dist/runnables/branch.d.ts.map +1 -0
- package/dist/runnables/branch.js +151 -201
- package/dist/runnables/branch.js.map +1 -0
- package/dist/runnables/config.cjs +136 -212
- package/dist/runnables/config.cjs.map +1 -0
- package/dist/runnables/config.d.cts +26 -0
- package/dist/runnables/config.d.cts.map +1 -0
- package/dist/runnables/config.d.ts +18 -7
- package/dist/runnables/config.d.ts.map +1 -0
- package/dist/runnables/config.js +134 -207
- package/dist/runnables/config.js.map +1 -0
- package/dist/runnables/graph.cjs +215 -260
- package/dist/runnables/graph.cjs.map +1 -0
- package/dist/runnables/graph.d.cts +52 -0
- package/dist/runnables/graph.d.cts.map +1 -0
- package/dist/runnables/graph.d.ts +49 -41
- package/dist/runnables/graph.d.ts.map +1 -0
- package/dist/runnables/graph.js +206 -253
- package/dist/runnables/graph.js.map +1 -0
- package/dist/runnables/graph_mermaid.cjs +86 -141
- package/dist/runnables/graph_mermaid.cjs.map +1 -0
- package/dist/runnables/graph_mermaid.js +86 -139
- package/dist/runnables/graph_mermaid.js.map +1 -0
- package/dist/runnables/history.cjs +160 -260
- package/dist/runnables/history.cjs.map +1 -0
- package/dist/runnables/history.d.cts +104 -0
- package/dist/runnables/history.d.cts.map +1 -0
- package/dist/runnables/history.d.ts +38 -26
- package/dist/runnables/history.d.ts.map +1 -0
- package/dist/runnables/history.js +160 -256
- package/dist/runnables/history.js.map +1 -0
- package/dist/runnables/index.cjs +65 -31
- package/dist/runnables/index.cjs.map +1 -0
- package/dist/runnables/index.d.cts +8 -0
- package/dist/runnables/index.d.ts +8 -7
- package/dist/runnables/index.js +38 -6
- package/dist/runnables/index.js.map +1 -0
- package/dist/runnables/iter.cjs +27 -42
- package/dist/runnables/iter.cjs.map +1 -0
- package/dist/runnables/iter.js +26 -37
- package/dist/runnables/iter.js.map +1 -0
- package/dist/runnables/passthrough.cjs +97 -125
- package/dist/runnables/passthrough.cjs.map +1 -0
- package/dist/runnables/passthrough.d.cts +76 -0
- package/dist/runnables/passthrough.d.cts.map +1 -0
- package/dist/runnables/passthrough.d.ts +46 -40
- package/dist/runnables/passthrough.d.ts.map +1 -0
- package/dist/runnables/passthrough.js +97 -121
- package/dist/runnables/passthrough.js.map +1 -0
- package/dist/runnables/remote.cjs +387 -508
- package/dist/runnables/remote.cjs.map +1 -0
- package/dist/runnables/remote.d.cts +73 -0
- package/dist/runnables/remote.d.cts.map +1 -0
- package/dist/runnables/remote.d.ts +52 -40
- package/dist/runnables/remote.d.ts.map +1 -0
- package/dist/runnables/remote.js +379 -502
- package/dist/runnables/remote.js.map +1 -0
- package/dist/runnables/router.cjs +74 -95
- package/dist/runnables/router.cjs.map +1 -0
- package/dist/runnables/router.d.cts +58 -0
- package/dist/runnables/router.d.cts.map +1 -0
- package/dist/runnables/router.d.ts +27 -21
- package/dist/runnables/router.d.ts.map +1 -0
- package/dist/runnables/router.js +74 -91
- package/dist/runnables/router.js.map +1 -0
- package/dist/runnables/types.d.cts +81 -0
- package/dist/runnables/types.d.cts.map +1 -0
- package/dist/runnables/types.d.ts +68 -55
- package/dist/runnables/types.d.ts.map +1 -0
- package/dist/runnables/utils.cjs +40 -85
- package/dist/runnables/utils.cjs.map +1 -0
- package/dist/runnables/utils.js +40 -82
- package/dist/runnables/utils.js.map +1 -0
- package/dist/runnables/wrappers.cjs +14 -15
- package/dist/runnables/wrappers.cjs.map +1 -0
- package/dist/runnables/wrappers.js +14 -12
- package/dist/runnables/wrappers.js.map +1 -0
- package/dist/singletons/async_local_storage/context.cjs +167 -177
- package/dist/singletons/async_local_storage/context.cjs.map +1 -0
- package/dist/singletons/async_local_storage/context.d.cts +163 -0
- package/dist/singletons/async_local_storage/context.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/context.d.ts +17 -9
- package/dist/singletons/async_local_storage/context.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/context.js +168 -175
- package/dist/singletons/async_local_storage/context.js.map +1 -0
- package/dist/singletons/async_local_storage/globals.cjs +11 -8
- package/dist/singletons/async_local_storage/globals.cjs.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.cts +11 -0
- package/dist/singletons/async_local_storage/globals.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.ts +10 -8
- package/dist/singletons/async_local_storage/globals.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/globals.js +11 -6
- package/dist/singletons/async_local_storage/globals.js.map +1 -0
- package/dist/singletons/async_local_storage/index.cjs +55 -65
- package/dist/singletons/async_local_storage/index.cjs.map +1 -0
- package/dist/singletons/async_local_storage/index.d.cts +18 -0
- package/dist/singletons/async_local_storage/index.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/index.d.ts +13 -9
- package/dist/singletons/async_local_storage/index.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/index.js +53 -61
- package/dist/singletons/async_local_storage/index.js.map +1 -0
- package/dist/singletons/callbacks.cjs +43 -60
- package/dist/singletons/callbacks.cjs.map +1 -0
- package/dist/singletons/callbacks.d.cts +16 -0
- package/dist/singletons/callbacks.d.cts.map +1 -0
- package/dist/singletons/callbacks.d.ts +8 -3
- package/dist/singletons/callbacks.d.ts.map +1 -0
- package/dist/singletons/callbacks.js +43 -54
- package/dist/singletons/callbacks.js.map +1 -0
- package/dist/singletons/index.cjs +23 -8
- package/dist/singletons/index.cjs.map +1 -0
- package/dist/singletons/index.d.cts +3 -0
- package/dist/singletons/index.d.ts +3 -4
- package/dist/singletons/index.js +14 -3
- package/dist/singletons/index.js.map +1 -0
- package/dist/singletons/tracer.cjs +13 -19
- package/dist/singletons/tracer.cjs.map +1 -0
- package/dist/singletons/tracer.js +13 -15
- package/dist/singletons/tracer.js.map +1 -0
- package/dist/stores.cjs +78 -87
- package/dist/stores.cjs.map +1 -0
- package/dist/stores.d.cts +111 -0
- package/dist/stores.d.cts.map +1 -0
- package/dist/stores.d.ts +84 -78
- package/dist/stores.d.ts.map +1 -0
- package/dist/stores.js +71 -82
- package/dist/stores.js.map +1 -0
- package/dist/structured_query/base.cjs +86 -136
- package/dist/structured_query/base.cjs.map +1 -0
- package/dist/structured_query/base.d.cts +75 -0
- package/dist/structured_query/base.d.cts.map +1 -0
- package/dist/structured_query/base.d.ts +53 -47
- package/dist/structured_query/base.d.ts.map +1 -0
- package/dist/structured_query/base.js +86 -132
- package/dist/structured_query/base.js.map +1 -0
- package/dist/structured_query/functional.cjs +163 -234
- package/dist/structured_query/functional.cjs.map +1 -0
- package/dist/structured_query/functional.d.cts +98 -0
- package/dist/structured_query/functional.d.cts.map +1 -0
- package/dist/structured_query/functional.d.ts +72 -67
- package/dist/structured_query/functional.d.ts.map +1 -0
- package/dist/structured_query/functional.js +163 -230
- package/dist/structured_query/functional.js.map +1 -0
- package/dist/structured_query/index.cjs +55 -20
- package/dist/structured_query/index.cjs.map +1 -0
- package/dist/structured_query/index.d.cts +5 -0
- package/dist/structured_query/index.d.ts +5 -4
- package/dist/structured_query/index.js +32 -4
- package/dist/structured_query/index.js.map +1 -0
- package/dist/structured_query/ir.cjs +76 -132
- package/dist/structured_query/ir.cjs.map +1 -0
- package/dist/structured_query/ir.d.cts +143 -0
- package/dist/structured_query/ir.d.cts.map +1 -0
- package/dist/structured_query/ir.d.ts +61 -56
- package/dist/structured_query/ir.d.ts.map +1 -0
- package/dist/structured_query/ir.js +69 -124
- package/dist/structured_query/ir.js.map +1 -0
- package/dist/structured_query/utils.cjs +58 -83
- package/dist/structured_query/utils.cjs.map +1 -0
- package/dist/structured_query/utils.d.cts +40 -0
- package/dist/structured_query/utils.d.cts.map +1 -0
- package/dist/structured_query/utils.d.ts +14 -7
- package/dist/structured_query/utils.d.ts.map +1 -0
- package/dist/structured_query/utils.js +57 -80
- package/dist/structured_query/utils.js.map +1 -0
- package/dist/tools/index.cjs +311 -437
- package/dist/tools/index.cjs.map +1 -0
- package/dist/tools/index.d.cts +209 -0
- package/dist/tools/index.d.cts.map +1 -0
- package/dist/tools/index.d.ts +153 -149
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +295 -424
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/types.cjs +44 -52
- package/dist/tools/types.cjs.map +1 -0
- package/dist/tools/types.d.cts +280 -0
- package/dist/tools/types.d.cts.map +1 -0
- package/dist/tools/types.d.ts +146 -138
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +45 -50
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/utils.cjs +20 -32
- package/dist/tools/utils.cjs.map +1 -0
- package/dist/tools/utils.d.cts +14 -0
- package/dist/tools/utils.d.cts.map +1 -0
- package/dist/tools/utils.d.ts +8 -10
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tools/utils.js +20 -29
- package/dist/tools/utils.js.map +1 -0
- package/dist/tracers/base.cjs +441 -529
- package/dist/tracers/base.cjs.map +1 -0
- package/dist/tracers/base.d.cts +304 -0
- package/dist/tracers/base.d.cts.map +1 -0
- package/dist/tracers/base.d.ts +296 -271
- package/dist/tracers/base.d.ts.map +1 -0
- package/dist/tracers/base.js +435 -525
- package/dist/tracers/base.js.map +1 -0
- package/dist/tracers/console.cjs +206 -223
- package/dist/tracers/console.cjs.map +1 -0
- package/dist/tracers/console.d.cts +125 -0
- package/dist/tracers/console.d.cts.map +1 -0
- package/dist/tracers/console.d.ts +109 -101
- package/dist/tracers/console.d.ts.map +1 -0
- package/dist/tracers/console.js +199 -215
- package/dist/tracers/console.js.map +1 -0
- package/dist/tracers/event_stream.cjs +357 -529
- package/dist/tracers/event_stream.cjs.map +1 -0
- package/dist/tracers/event_stream.d.cts +98 -0
- package/dist/tracers/event_stream.d.cts.map +1 -0
- package/dist/tracers/event_stream.d.ts +87 -129
- package/dist/tracers/event_stream.d.ts.map +1 -0
- package/dist/tracers/event_stream.js +355 -523
- package/dist/tracers/event_stream.js.map +1 -0
- package/dist/tracers/initialize.cjs +40 -29
- package/dist/tracers/initialize.cjs.map +1 -0
- package/dist/tracers/initialize.d.cts +26 -0
- package/dist/tracers/initialize.d.cts.map +1 -0
- package/dist/tracers/initialize.d.ts +8 -2
- package/dist/tracers/initialize.d.ts.map +1 -0
- package/dist/tracers/initialize.js +33 -25
- package/dist/tracers/initialize.js.map +1 -0
- package/dist/tracers/log_stream.cjs +264 -425
- package/dist/tracers/log_stream.cjs.map +1 -0
- package/dist/tracers/log_stream.d.cts +129 -0
- package/dist/tracers/log_stream.d.cts.map +1 -0
- package/dist/tracers/log_stream.d.ts +103 -92
- package/dist/tracers/log_stream.d.ts.map +1 -0
- package/dist/tracers/log_stream.js +255 -418
- package/dist/tracers/log_stream.js.map +1 -0
- package/dist/tracers/root_listener.cjs +41 -80
- package/dist/tracers/root_listener.cjs.map +1 -0
- package/dist/tracers/root_listener.js +41 -76
- package/dist/tracers/root_listener.js.map +1 -0
- package/dist/tracers/run_collector.cjs +44 -48
- package/dist/tracers/run_collector.cjs.map +1 -0
- package/dist/tracers/run_collector.d.cts +34 -0
- package/dist/tracers/run_collector.d.cts.map +1 -0
- package/dist/tracers/run_collector.d.ts +27 -19
- package/dist/tracers/run_collector.d.ts.map +1 -0
- package/dist/tracers/run_collector.js +38 -44
- package/dist/tracers/run_collector.js.map +1 -0
- package/dist/tracers/tracer_langchain.cjs +91 -123
- package/dist/tracers/tracer_langchain.cjs.map +1 -0
- package/dist/tracers/tracer_langchain.d.cts +49 -0
- package/dist/tracers/tracer_langchain.d.cts.map +1 -0
- package/dist/tracers/tracer_langchain.d.ts +43 -38
- package/dist/tracers/tracer_langchain.d.ts.map +1 -0
- package/dist/tracers/tracer_langchain.js +84 -118
- package/dist/tracers/tracer_langchain.js.map +1 -0
- package/dist/tracers/tracer_langchain_v1.cjs +166 -198
- package/dist/tracers/tracer_langchain_v1.cjs.map +1 -0
- package/dist/tracers/tracer_langchain_v1.d.cts +64 -0
- package/dist/tracers/tracer_langchain_v1.d.cts.map +1 -0
- package/dist/tracers/tracer_langchain_v1.d.ts +56 -51
- package/dist/tracers/tracer_langchain_v1.d.ts.map +1 -0
- package/dist/tracers/tracer_langchain_v1.js +158 -192
- package/dist/tracers/tracer_langchain_v1.js.map +1 -0
- package/dist/types/_internal.d.cts +8 -0
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.ts +8 -1
- package/dist/types/_internal.d.ts.map +1 -0
- package/dist/types/stream.cjs +12 -2
- package/dist/types/stream.cjs.map +1 -0
- package/dist/types/stream.d.cts +3 -0
- package/dist/types/stream.d.ts +3 -2
- package/dist/types/stream.js +6 -1
- package/dist/types/stream.js.map +1 -0
- package/dist/types/type-utils.d.cts +7 -0
- package/dist/types/type-utils.d.cts.map +1 -0
- package/dist/types/type-utils.d.ts +7 -1
- package/dist/types/type-utils.d.ts.map +1 -0
- package/dist/utils/async_caller.cjs +80 -122
- package/dist/utils/async_caller.cjs.map +1 -0
- package/dist/utils/async_caller.d.cts +52 -0
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts +36 -29
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/async_caller.js +73 -114
- package/dist/utils/async_caller.js.map +1 -0
- package/dist/utils/callbacks.cjs +14 -14
- package/dist/utils/callbacks.cjs.map +1 -0
- package/dist/utils/callbacks.js +15 -11
- package/dist/utils/callbacks.js.map +1 -0
- package/dist/utils/chunk_array.cjs +18 -8
- package/dist/utils/chunk_array.cjs.map +1 -0
- package/dist/utils/chunk_array.d.cts +5 -0
- package/dist/utils/chunk_array.d.cts.map +1 -0
- package/dist/utils/chunk_array.d.ts +5 -1
- package/dist/utils/chunk_array.d.ts.map +1 -0
- package/dist/utils/chunk_array.js +14 -6
- package/dist/utils/chunk_array.js.map +1 -0
- package/dist/utils/env.cjs +62 -72
- package/dist/utils/env.cjs.map +1 -0
- package/dist/utils/env.d.cts +36 -0
- package/dist/utils/env.d.cts.map +1 -0
- package/dist/utils/env.d.ts +30 -22
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/env.js +54 -66
- package/dist/utils/env.js.map +1 -0
- package/dist/utils/event_source_parse.cjs +172 -225
- package/dist/utils/event_source_parse.cjs.map +1 -0
- package/dist/utils/event_source_parse.d.cts +47 -0
- package/dist/utils/event_source_parse.d.cts.map +1 -0
- package/dist/utils/event_source_parse.d.ts +22 -14
- package/dist/utils/event_source_parse.d.ts.map +1 -0
- package/dist/utils/event_source_parse.js +164 -220
- package/dist/utils/event_source_parse.js.map +1 -0
- package/dist/utils/fast-json-patch/index.cjs +14 -58
- package/dist/utils/fast-json-patch/index.cjs.map +1 -0
- package/dist/utils/fast-json-patch/index.js +14 -15
- package/dist/utils/fast-json-patch/index.js.map +1 -0
- package/dist/utils/fast-json-patch/src/core.cjs +319 -445
- package/dist/utils/fast-json-patch/src/core.cjs.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.cts +80 -0
- package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.ts +38 -69
- package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.js +314 -442
- package/dist/utils/fast-json-patch/src/core.js.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.cjs +72 -231
- package/dist/utils/fast-json-patch/src/duplex.cjs.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.cts +11 -0
- package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.ts +7 -19
- package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.js +73 -226
- package/dist/utils/fast-json-patch/src/duplex.js.map +1 -0
- package/dist/utils/fast-json-patch/src/helpers.cjs +99 -171
- package/dist/utils/fast-json-patch/src/helpers.cjs.map +1 -0
- package/dist/utils/fast-json-patch/src/helpers.js +99 -166
- package/dist/utils/fast-json-patch/src/helpers.js.map +1 -0
- package/dist/utils/function_calling.cjs +62 -59
- package/dist/utils/function_calling.cjs.map +1 -0
- package/dist/utils/function_calling.d.cts +43 -0
- package/dist/utils/function_calling.d.cts.map +1 -0
- package/dist/utils/function_calling.d.ts +22 -15
- package/dist/utils/function_calling.d.ts.map +1 -0
- package/dist/utils/function_calling.js +51 -50
- package/dist/utils/function_calling.js.map +1 -0
- package/dist/utils/hash.cjs +21 -7
- package/dist/utils/hash.cjs.map +1 -0
- package/dist/utils/hash.d.cts +14 -0
- package/dist/utils/hash.d.cts.map +1 -0
- package/dist/utils/hash.d.ts +9 -3
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +14 -2
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/js-sha1/hash.cjs +272 -356
- package/dist/utils/js-sha1/hash.cjs.map +1 -0
- package/dist/utils/js-sha1/hash.d.cts +9 -0
- package/dist/utils/js-sha1/hash.d.cts.map +1 -0
- package/dist/utils/js-sha1/hash.d.ts +5 -1
- package/dist/utils/js-sha1/hash.d.ts.map +1 -0
- package/dist/utils/js-sha1/hash.js +268 -356
- package/dist/utils/js-sha1/hash.js.map +1 -0
- package/dist/utils/js-sha256/hash.cjs +332 -430
- package/dist/utils/js-sha256/hash.cjs.map +1 -0
- package/dist/utils/js-sha256/hash.d.cts +5 -0
- package/dist/utils/js-sha256/hash.d.cts.map +1 -0
- package/dist/utils/js-sha256/hash.d.ts +5 -1
- package/dist/utils/js-sha256/hash.d.ts.map +1 -0
- package/dist/utils/js-sha256/hash.js +328 -430
- package/dist/utils/js-sha256/hash.js.map +1 -0
- package/dist/utils/json.cjs +47 -101
- package/dist/utils/json.cjs.map +1 -0
- package/dist/utils/json.d.cts +8 -0
- package/dist/utils/json.d.cts.map +1 -0
- package/dist/utils/json.d.ts +8 -2
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +47 -99
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/json_patch.cjs +22 -6
- package/dist/utils/json_patch.cjs.map +1 -0
- package/dist/utils/json_patch.d.cts +3 -0
- package/dist/utils/json_patch.d.ts +3 -1
- package/dist/utils/json_patch.js +15 -1
- package/dist/utils/json_patch.js.map +1 -0
- package/dist/utils/json_schema.cjs +77 -92
- package/dist/utils/json_schema.cjs.map +1 -0
- package/dist/utils/json_schema.d.cts +28 -0
- package/dist/utils/json_schema.d.cts.map +1 -0
- package/dist/utils/json_schema.d.ts +15 -6
- package/dist/utils/json_schema.d.ts.map +1 -0
- package/dist/utils/json_schema.js +58 -85
- package/dist/utils/json_schema.js.map +1 -0
- package/dist/utils/math.cjs +112 -108
- package/dist/utils/math.cjs.map +1 -0
- package/dist/utils/math.d.cts +43 -0
- package/dist/utils/math.d.cts.map +1 -0
- package/dist/utils/math.d.ts +10 -7
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/math.js +103 -102
- package/dist/utils/math.js.map +1 -0
- package/dist/utils/ml-distance/distances.cjs +15 -14
- package/dist/utils/ml-distance/distances.cjs.map +1 -0
- package/dist/utils/ml-distance/distances.js +15 -12
- package/dist/utils/ml-distance/distances.js.map +1 -0
- package/dist/utils/ml-distance/similarities.cjs +20 -17
- package/dist/utils/ml-distance/similarities.cjs.map +1 -0
- package/dist/utils/ml-distance/similarities.d.cts +11 -0
- package/dist/utils/ml-distance/similarities.d.cts.map +1 -0
- package/dist/utils/ml-distance/similarities.d.ts +5 -1
- package/dist/utils/ml-distance/similarities.d.ts.map +1 -0
- package/dist/utils/ml-distance/similarities.js +20 -15
- package/dist/utils/ml-distance/similarities.js.map +1 -0
- package/dist/utils/ml-distance-euclidean/euclidean.cjs +10 -10
- package/dist/utils/ml-distance-euclidean/euclidean.cjs.map +1 -0
- package/dist/utils/ml-distance-euclidean/euclidean.js +11 -8
- package/dist/utils/ml-distance-euclidean/euclidean.js.map +1 -0
- package/dist/utils/sax-js/sax.cjs +1206 -1556
- package/dist/utils/sax-js/sax.cjs.map +1 -0
- package/dist/utils/sax-js/sax.js +1205 -1553
- package/dist/utils/sax-js/sax.js.map +1 -0
- package/dist/utils/signal.cjs +18 -27
- package/dist/utils/signal.cjs.map +1 -0
- package/dist/utils/signal.js +18 -25
- package/dist/utils/signal.js.map +1 -0
- package/dist/utils/stream.cjs +186 -268
- package/dist/utils/stream.cjs.map +1 -0
- package/dist/utils/stream.d.cts +54 -0
- package/dist/utils/stream.d.cts.map +1 -0
- package/dist/utils/stream.d.ts +49 -33
- package/dist/utils/stream.d.ts.map +1 -0
- package/dist/utils/stream.js +177 -261
- package/dist/utils/stream.js.map +1 -0
- package/dist/utils/testing/index.cjs +664 -888
- package/dist/utils/testing/index.cjs.map +1 -0
- package/dist/utils/testing/index.d.cts +383 -0
- package/dist/utils/testing/index.d.cts.map +1 -0
- package/dist/utils/testing/index.d.ts +280 -250
- package/dist/utils/testing/index.d.ts.map +1 -0
- package/dist/utils/testing/index.js +639 -865
- package/dist/utils/testing/index.js.map +1 -0
- package/dist/utils/tiktoken.cjs +28 -19
- package/dist/utils/tiktoken.cjs.map +1 -0
- package/dist/utils/tiktoken.d.cts +8 -0
- package/dist/utils/tiktoken.d.cts.map +1 -0
- package/dist/utils/tiktoken.d.ts +7 -2
- package/dist/utils/tiktoken.d.ts.map +1 -0
- package/dist/utils/tiktoken.js +22 -16
- package/dist/utils/tiktoken.js.map +1 -0
- package/dist/utils/types/index.cjs +60 -17
- package/dist/utils/types/index.cjs.map +1 -0
- package/dist/utils/types/index.d.cts +16 -0
- package/dist/utils/types/index.d.cts.map +1 -0
- package/dist/utils/types/index.d.ts +13 -5
- package/dist/utils/types/index.d.ts.map +1 -0
- package/dist/utils/types/index.js +33 -1
- package/dist/utils/types/index.js.map +1 -0
- package/dist/utils/types/zod.cjs +376 -554
- package/dist/utils/types/zod.cjs.map +1 -0
- package/dist/utils/types/zod.d.cts +213 -0
- package/dist/utils/types/zod.d.cts.map +1 -0
- package/dist/utils/types/zod.d.ts +49 -48
- package/dist/utils/types/zod.d.ts.map +1 -0
- package/dist/utils/types/zod.js +376 -552
- package/dist/utils/types/zod.js.map +1 -0
- package/dist/vectorstores.cjs +391 -424
- package/dist/vectorstores.cjs.map +1 -0
- package/dist/vectorstores.d.cts +661 -0
- package/dist/vectorstores.d.cts.map +1 -0
- package/dist/vectorstores.d.ts +488 -471
- package/dist/vectorstores.d.ts.map +1 -0
- package/dist/vectorstores.js +383 -418
- package/dist/vectorstores.js.map +1 -0
- package/package.json +525 -644
- package/agents.cjs +0 -1
- package/agents.d.cts +0 -1
- package/agents.d.ts +0 -1
- package/agents.js +0 -1
- package/caches.cjs +0 -1
- package/caches.d.cts +0 -1
- package/caches.d.ts +0 -1
- package/caches.js +0 -1
- package/callbacks/base.cjs +0 -1
- package/callbacks/base.d.cts +0 -1
- package/callbacks/base.d.ts +0 -1
- package/callbacks/base.js +0 -1
- package/callbacks/dispatch/web.cjs +0 -1
- package/callbacks/dispatch/web.d.cts +0 -1
- package/callbacks/dispatch/web.d.ts +0 -1
- package/callbacks/dispatch/web.js +0 -1
- package/callbacks/dispatch.cjs +0 -1
- package/callbacks/dispatch.d.cts +0 -1
- package/callbacks/dispatch.d.ts +0 -1
- package/callbacks/dispatch.js +0 -1
- package/callbacks/manager.cjs +0 -1
- package/callbacks/manager.d.cts +0 -1
- package/callbacks/manager.d.ts +0 -1
- package/callbacks/manager.js +0 -1
- package/callbacks/promises.cjs +0 -1
- package/callbacks/promises.d.cts +0 -1
- package/callbacks/promises.d.ts +0 -1
- package/callbacks/promises.js +0 -1
- package/chat_history.cjs +0 -1
- package/chat_history.d.cts +0 -1
- package/chat_history.d.ts +0 -1
- package/chat_history.js +0 -1
- package/context.cjs +0 -1
- package/context.d.cts +0 -1
- package/context.d.ts +0 -1
- package/context.js +0 -1
- package/dist/errors/index.d.ts +0 -2
- package/dist/load/import_constants.d.ts +0 -1
- package/dist/load/import_map.d.ts +0 -43
- package/dist/load/import_type.cjs +0 -3
- package/dist/load/import_type.js +0 -2
- package/dist/messages/content_blocks.cjs +0 -165
- package/dist/messages/content_blocks.d.ts +0 -151
- package/dist/messages/content_blocks.js +0 -154
- package/dist/prompts/serde.cjs +0 -2
- package/dist/prompts/serde.js +0 -1
- package/dist/runnables/graph_mermaid.d.ts +0 -18
- package/dist/runnables/iter.d.ts +0 -6
- package/dist/runnables/types.cjs +0 -2
- package/dist/runnables/types.js +0 -1
- package/dist/runnables/utils.d.ts +0 -27
- package/dist/runnables/wrappers.d.ts +0 -2
- package/dist/singletons/tracer.d.ts +0 -3
- package/dist/tracers/root_listener.d.ts +0 -25
- package/dist/types/_internal.cjs +0 -2
- package/dist/types/_internal.js +0 -1
- package/dist/types/type-utils.cjs +0 -2
- package/dist/types/type-utils.js +0 -1
- package/dist/utils/callbacks.d.ts +0 -1
- package/dist/utils/fast-json-patch/index.d.ts +0 -22
- package/dist/utils/fast-json-patch/src/helpers.d.ts +0 -36
- package/dist/utils/ml-distance/distances.d.ts +0 -8
- package/dist/utils/ml-distance-euclidean/euclidean.d.ts +0 -2
- package/dist/utils/sax-js/sax.d.ts +0 -2
- package/dist/utils/signal.d.ts +0 -1
- package/dist/utils/testing/helpers.cjs +0 -7
- package/dist/utils/testing/helpers.d.ts +0 -3
- package/dist/utils/testing/helpers.js +0 -3
- package/document_loaders/base.cjs +0 -1
- package/document_loaders/base.d.cts +0 -1
- package/document_loaders/base.d.ts +0 -1
- package/document_loaders/base.js +0 -1
- package/document_loaders/langsmith.cjs +0 -1
- package/document_loaders/langsmith.d.cts +0 -1
- package/document_loaders/langsmith.d.ts +0 -1
- package/document_loaders/langsmith.js +0 -1
- package/documents.cjs +0 -1
- package/documents.d.cts +0 -1
- package/documents.d.ts +0 -1
- package/documents.js +0 -1
- package/embeddings.cjs +0 -1
- package/embeddings.d.cts +0 -1
- package/embeddings.d.ts +0 -1
- package/embeddings.js +0 -1
- package/example_selectors.cjs +0 -1
- package/example_selectors.d.cts +0 -1
- package/example_selectors.d.ts +0 -1
- package/example_selectors.js +0 -1
- package/indexing.cjs +0 -1
- package/indexing.d.cts +0 -1
- package/indexing.d.ts +0 -1
- package/indexing.js +0 -1
- package/language_models/base.cjs +0 -1
- package/language_models/base.d.cts +0 -1
- package/language_models/base.d.ts +0 -1
- package/language_models/base.js +0 -1
- package/language_models/chat_models.cjs +0 -1
- package/language_models/chat_models.d.cts +0 -1
- package/language_models/chat_models.d.ts +0 -1
- package/language_models/chat_models.js +0 -1
- package/language_models/llms.cjs +0 -1
- package/language_models/llms.d.cts +0 -1
- package/language_models/llms.d.ts +0 -1
- package/language_models/llms.js +0 -1
- package/load/serializable.cjs +0 -1
- package/load/serializable.d.cts +0 -1
- package/load/serializable.d.ts +0 -1
- package/load/serializable.js +0 -1
- package/load.cjs +0 -1
- package/load.d.cts +0 -1
- package/load.d.ts +0 -1
- package/load.js +0 -1
- package/memory.cjs +0 -1
- package/memory.d.cts +0 -1
- package/memory.d.ts +0 -1
- package/memory.js +0 -1
- package/messages/tool.cjs +0 -1
- package/messages/tool.d.cts +0 -1
- package/messages/tool.d.ts +0 -1
- package/messages/tool.js +0 -1
- package/messages.cjs +0 -1
- package/messages.d.cts +0 -1
- package/messages.d.ts +0 -1
- package/messages.js +0 -1
- package/output_parsers/openai_functions.cjs +0 -1
- package/output_parsers/openai_functions.d.cts +0 -1
- package/output_parsers/openai_functions.d.ts +0 -1
- package/output_parsers/openai_functions.js +0 -1
- package/output_parsers/openai_tools.cjs +0 -1
- package/output_parsers/openai_tools.d.cts +0 -1
- package/output_parsers/openai_tools.d.ts +0 -1
- package/output_parsers/openai_tools.js +0 -1
- package/output_parsers.cjs +0 -1
- package/output_parsers.d.cts +0 -1
- package/output_parsers.d.ts +0 -1
- package/output_parsers.js +0 -1
- package/outputs.cjs +0 -1
- package/outputs.d.cts +0 -1
- package/outputs.d.ts +0 -1
- package/outputs.js +0 -1
- package/prompt_values.cjs +0 -1
- package/prompt_values.d.cts +0 -1
- package/prompt_values.d.ts +0 -1
- package/prompt_values.js +0 -1
- package/prompts.cjs +0 -1
- package/prompts.d.cts +0 -1
- package/prompts.d.ts +0 -1
- package/prompts.js +0 -1
- package/retrievers/document_compressors.cjs +0 -1
- package/retrievers/document_compressors.d.cts +0 -1
- package/retrievers/document_compressors.d.ts +0 -1
- package/retrievers/document_compressors.js +0 -1
- package/retrievers.cjs +0 -1
- package/retrievers.d.cts +0 -1
- package/retrievers.d.ts +0 -1
- package/retrievers.js +0 -1
- package/runnables/graph.cjs +0 -1
- package/runnables/graph.d.cts +0 -1
- package/runnables/graph.d.ts +0 -1
- package/runnables/graph.js +0 -1
- package/runnables/remote.cjs +0 -1
- package/runnables/remote.d.cts +0 -1
- package/runnables/remote.d.ts +0 -1
- package/runnables/remote.js +0 -1
- package/runnables.cjs +0 -1
- package/runnables.d.cts +0 -1
- package/runnables.d.ts +0 -1
- package/runnables.js +0 -1
- package/singletons.cjs +0 -1
- package/singletons.d.cts +0 -1
- package/singletons.d.ts +0 -1
- package/singletons.js +0 -1
- package/stores.cjs +0 -1
- package/stores.d.cts +0 -1
- package/stores.d.ts +0 -1
- package/stores.js +0 -1
- package/structured_query.cjs +0 -1
- package/structured_query.d.cts +0 -1
- package/structured_query.d.ts +0 -1
- package/structured_query.js +0 -1
- package/tools.cjs +0 -1
- package/tools.d.cts +0 -1
- package/tools.d.ts +0 -1
- package/tools.js +0 -1
- package/tracers/base.cjs +0 -1
- package/tracers/base.d.cts +0 -1
- package/tracers/base.d.ts +0 -1
- package/tracers/base.js +0 -1
- package/tracers/console.cjs +0 -1
- package/tracers/console.d.cts +0 -1
- package/tracers/console.d.ts +0 -1
- package/tracers/console.js +0 -1
- package/tracers/initialize.cjs +0 -1
- package/tracers/initialize.d.cts +0 -1
- package/tracers/initialize.d.ts +0 -1
- package/tracers/initialize.js +0 -1
- package/tracers/log_stream.cjs +0 -1
- package/tracers/log_stream.d.cts +0 -1
- package/tracers/log_stream.d.ts +0 -1
- package/tracers/log_stream.js +0 -1
- package/tracers/run_collector.cjs +0 -1
- package/tracers/run_collector.d.cts +0 -1
- package/tracers/run_collector.d.ts +0 -1
- package/tracers/run_collector.js +0 -1
- package/tracers/tracer_langchain.cjs +0 -1
- package/tracers/tracer_langchain.d.cts +0 -1
- package/tracers/tracer_langchain.d.ts +0 -1
- package/tracers/tracer_langchain.js +0 -1
- package/tracers/tracer_langchain_v1.cjs +0 -1
- package/tracers/tracer_langchain_v1.d.cts +0 -1
- package/tracers/tracer_langchain_v1.d.ts +0 -1
- package/tracers/tracer_langchain_v1.js +0 -1
- package/types/stream.cjs +0 -1
- package/types/stream.d.cts +0 -1
- package/types/stream.d.ts +0 -1
- package/types/stream.js +0 -1
- package/utils/async_caller.cjs +0 -1
- package/utils/async_caller.d.cts +0 -1
- package/utils/async_caller.d.ts +0 -1
- package/utils/async_caller.js +0 -1
- package/utils/chunk_array.cjs +0 -1
- package/utils/chunk_array.d.cts +0 -1
- package/utils/chunk_array.d.ts +0 -1
- package/utils/chunk_array.js +0 -1
- package/utils/env.cjs +0 -1
- package/utils/env.d.cts +0 -1
- package/utils/env.d.ts +0 -1
- package/utils/env.js +0 -1
- package/utils/event_source_parse.cjs +0 -1
- package/utils/event_source_parse.d.cts +0 -1
- package/utils/event_source_parse.d.ts +0 -1
- package/utils/event_source_parse.js +0 -1
- package/utils/function_calling.cjs +0 -1
- package/utils/function_calling.d.cts +0 -1
- package/utils/function_calling.d.ts +0 -1
- package/utils/function_calling.js +0 -1
- package/utils/hash/insecure.cjs +0 -1
- package/utils/hash/insecure.d.cts +0 -1
- package/utils/hash/insecure.d.ts +0 -1
- package/utils/hash/insecure.js +0 -1
- package/utils/hash/sha256.cjs +0 -1
- package/utils/hash/sha256.d.cts +0 -1
- package/utils/hash/sha256.d.ts +0 -1
- package/utils/hash/sha256.js +0 -1
- package/utils/hash.cjs +0 -1
- package/utils/hash.d.cts +0 -1
- package/utils/hash.d.ts +0 -1
- package/utils/hash.js +0 -1
- package/utils/json_patch.cjs +0 -1
- package/utils/json_patch.d.cts +0 -1
- package/utils/json_patch.d.ts +0 -1
- package/utils/json_patch.js +0 -1
- package/utils/json_schema.cjs +0 -1
- package/utils/json_schema.d.cts +0 -1
- package/utils/json_schema.d.ts +0 -1
- package/utils/json_schema.js +0 -1
- package/utils/math.cjs +0 -1
- package/utils/math.d.cts +0 -1
- package/utils/math.d.ts +0 -1
- package/utils/math.js +0 -1
- package/utils/stream.cjs +0 -1
- package/utils/stream.d.cts +0 -1
- package/utils/stream.d.ts +0 -1
- package/utils/stream.js +0 -1
- package/utils/testing.cjs +0 -1
- package/utils/testing.d.cts +0 -1
- package/utils/testing.d.ts +0 -1
- package/utils/testing.js +0 -1
- package/utils/tiktoken.cjs +0 -1
- package/utils/tiktoken.d.cts +0 -1
- package/utils/tiktoken.d.ts +0 -1
- package/utils/tiktoken.js +0 -1
- package/utils/types.cjs +0 -1
- package/utils/types.d.cts +0 -1
- package/utils/types.d.ts +0 -1
- package/utils/types.js +0 -1
- package/vectorstores.cjs +0 -1
- package/vectorstores.d.cts +0 -1
- package/vectorstores.d.ts +0 -1
- package/vectorstores.js +0 -1
package/dist/runnables/base.d.ts
CHANGED
|
@@ -1,326 +1,350 @@
|
|
|
1
|
-
import { type TraceableFunction } from "langsmith/singletons/traceable";
|
|
2
|
-
import type { RunnableInterface, RunnableBatchOptions, RunnableConfig } from "./types.js";
|
|
3
|
-
import { CallbackManagerForChainRun } from "../callbacks/manager.js";
|
|
4
|
-
import { LogStreamCallbackHandler, LogStreamCallbackHandlerInput, RunLogPatch } from "../tracers/log_stream.js";
|
|
5
|
-
import { EventStreamCallbackHandlerInput, StreamEvent } from "../tracers/event_stream.js";
|
|
6
1
|
import { Serializable } from "../load/serializable.js";
|
|
7
|
-
import {
|
|
2
|
+
import { InferInteropZodOutput, InteropZodType } from "../utils/types/zod.js";
|
|
3
|
+
import { ToolCall } from "../messages/tool.js";
|
|
8
4
|
import { Run } from "../tracers/base.js";
|
|
5
|
+
import { CallbackManagerForChainRun } from "../callbacks/manager.js";
|
|
6
|
+
import { RunnableBatchOptions, RunnableConfig, RunnableInterface } from "./types.js";
|
|
7
|
+
import { IterableReadableStream } from "../utils/stream.js";
|
|
8
|
+
import { EventStreamCallbackHandlerInput, StreamEvent } from "../tracers/event_stream.js";
|
|
9
|
+
import { LogStreamCallbackHandler, LogStreamCallbackHandlerInput, RunLogPatch } from "../tracers/log_stream.js";
|
|
9
10
|
import { Graph } from "./graph.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
import { TraceableFunction } from "langsmith/singletons/traceable";
|
|
12
|
+
|
|
13
|
+
//#region src/runnables/base.d.ts
|
|
14
|
+
type RunnableFunc<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig> = (input: RunInput, options: CallOptions
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
|
+
| Record<string, any>
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
| (Record<string, any> & CallOptions)) => RunOutput | Promise<RunOutput>;
|
|
19
|
+
type RunnableMapLike<RunInput, RunOutput> = { [K in keyof RunOutput]: RunnableLike<RunInput, RunOutput[K]> };
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
21
|
+
type RunnableLike<
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
RunInput = any,
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
RunOutput = any, CallOptions extends RunnableConfig = RunnableConfig> = RunnableInterface<RunInput, RunOutput, CallOptions> | RunnableFunc<RunInput, RunOutput, CallOptions> | RunnableMapLike<RunInput, RunOutput>;
|
|
26
|
+
type RunnableRetryFailedAttemptHandler = (
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
|
+
error: any,
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
input: any
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
) => any;
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
|
|
20
35
|
/**
|
|
21
36
|
* A Runnable is a generic unit of work that can be invoked, batched, streamed, and/or
|
|
22
37
|
* transformed.
|
|
23
38
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
declare abstract class Runnable<
|
|
40
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
|
+
RunInput = any,
|
|
42
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
|
+
RunOutput = any, CallOptions extends RunnableConfig = RunnableConfig> extends Serializable implements RunnableInterface<RunInput, RunOutput, CallOptions> {
|
|
44
|
+
protected lc_runnable: boolean;
|
|
45
|
+
name?: string;
|
|
46
|
+
getName(suffix?: string): string;
|
|
47
|
+
abstract invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
|
|
48
|
+
/**
|
|
49
|
+
* Bind arguments to a Runnable, returning a new Runnable.
|
|
50
|
+
* @param kwargs
|
|
51
|
+
* @returns A new RunnableBinding that, when invoked, will apply the bound args.
|
|
52
|
+
*
|
|
53
|
+
* @deprecated Use {@link withConfig} instead. This will be removed in the next breaking release.
|
|
54
|
+
*/
|
|
55
|
+
bind(kwargs: Partial<CallOptions>): Runnable<RunInput, RunOutput, CallOptions>;
|
|
56
|
+
/**
|
|
57
|
+
* Return a new Runnable that maps a list of inputs to a list of outputs,
|
|
58
|
+
* by calling invoke() with each input.
|
|
59
|
+
*
|
|
60
|
+
* @deprecated This will be removed in the next breaking release.
|
|
61
|
+
*/
|
|
62
|
+
map(): Runnable<RunInput[], RunOutput[], CallOptions>;
|
|
63
|
+
/**
|
|
64
|
+
* Add retry logic to an existing runnable.
|
|
65
|
+
* @param fields.stopAfterAttempt The number of attempts to retry.
|
|
66
|
+
* @param fields.onFailedAttempt A function that is called when a retry fails.
|
|
67
|
+
* @returns A new RunnableRetry that, when invoked, will retry according to the parameters.
|
|
68
|
+
*/
|
|
69
|
+
withRetry(fields?: {
|
|
70
|
+
stopAfterAttempt?: number;
|
|
71
|
+
onFailedAttempt?: RunnableRetryFailedAttemptHandler;
|
|
72
|
+
}): RunnableRetry<RunInput, RunOutput, CallOptions>;
|
|
73
|
+
/**
|
|
74
|
+
* Bind config to a Runnable, returning a new Runnable.
|
|
75
|
+
* @param config New configuration parameters to attach to the new runnable.
|
|
76
|
+
* @returns A new RunnableBinding with a config matching what's passed.
|
|
77
|
+
*/
|
|
78
|
+
withConfig(config: Partial<CallOptions>): Runnable<RunInput, RunOutput, CallOptions>;
|
|
79
|
+
/**
|
|
80
|
+
* Create a new runnable from the current one that will try invoking
|
|
81
|
+
* other passed fallback runnables if the initial invocation fails.
|
|
82
|
+
* @param fields.fallbacks Other runnables to call if the runnable errors.
|
|
83
|
+
* @returns A new RunnableWithFallbacks.
|
|
84
|
+
*/
|
|
85
|
+
withFallbacks(fields: {
|
|
86
|
+
fallbacks: Runnable<RunInput, RunOutput>[];
|
|
87
|
+
} | Runnable<RunInput, RunOutput>[]): RunnableWithFallbacks<RunInput, RunOutput>;
|
|
88
|
+
protected _getOptionsList<O extends CallOptions & {
|
|
89
|
+
runType?: string;
|
|
90
|
+
}>(options: Partial<O> | Partial<O>[], length?: number): Partial<O>[];
|
|
91
|
+
/**
|
|
92
|
+
* Default implementation of batch, which calls invoke N times.
|
|
93
|
+
* Subclasses should override this method if they can batch more efficiently.
|
|
94
|
+
* @param inputs Array of inputs to each batch call.
|
|
95
|
+
* @param options Either a single call options object to apply to each batch call or an array for each call.
|
|
96
|
+
* @param batchOptions.returnExceptions Whether to return errors rather than throwing on the first one
|
|
97
|
+
* @returns An array of RunOutputs, or mixed RunOutputs and errors if batchOptions.returnExceptions is set
|
|
98
|
+
*/
|
|
99
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
100
|
+
returnExceptions?: false;
|
|
101
|
+
}): Promise<RunOutput[]>;
|
|
102
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
103
|
+
returnExceptions: true;
|
|
104
|
+
}): Promise<(RunOutput | Error)[]>;
|
|
105
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Default streaming implementation.
|
|
108
|
+
* Subclasses should override this method if they support streaming output.
|
|
109
|
+
* @param input
|
|
110
|
+
* @param options
|
|
111
|
+
*/
|
|
112
|
+
_streamIterator(input: RunInput, options?: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
113
|
+
/**
|
|
114
|
+
* Stream output in chunks.
|
|
115
|
+
* @param input
|
|
116
|
+
* @param options
|
|
117
|
+
* @returns A readable stream that is also an iterable.
|
|
118
|
+
*/
|
|
119
|
+
stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<RunOutput>>;
|
|
120
|
+
protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, Omit<Partial<CallOptions>, keyof RunnableConfig>];
|
|
121
|
+
protected _callWithConfig<T extends RunInput>(func: ((input: T) => Promise<RunOutput>) | ((input: T, config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun) => Promise<RunOutput>), input: T, options?: Partial<CallOptions> & {
|
|
122
|
+
runType?: string;
|
|
123
|
+
}): Promise<RunOutput>;
|
|
124
|
+
/**
|
|
125
|
+
* Internal method that handles batching and configuration for a runnable
|
|
126
|
+
* It takes a function, input values, and optional configuration, and
|
|
127
|
+
* returns a promise that resolves to the output values.
|
|
128
|
+
* @param func The function to be executed for each input value.
|
|
129
|
+
* @param input The input values to be processed.
|
|
130
|
+
* @param config Optional configuration for the function execution.
|
|
131
|
+
* @returns A promise that resolves to the output values.
|
|
132
|
+
*/
|
|
133
|
+
_batchWithConfig<T extends RunInput>(func: (inputs: T[], options?: Partial<CallOptions>[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions) => Promise<(RunOutput | Error)[]>, inputs: T[], options?: Partial<CallOptions & {
|
|
134
|
+
runType?: string;
|
|
135
|
+
}> | Partial<CallOptions & {
|
|
136
|
+
runType?: string;
|
|
137
|
+
}>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
138
|
+
/**
|
|
139
|
+
* Helper method to transform an Iterator of Input values into an Iterator of
|
|
140
|
+
* Output values, with callbacks.
|
|
141
|
+
* Use this to implement `stream()` or `transform()` in Runnable subclasses.
|
|
142
|
+
*/
|
|
143
|
+
protected _transformStreamWithConfig<I extends RunInput, O extends RunOutput>(inputGenerator: AsyncGenerator<I>, transformer: (generator: AsyncGenerator<I>, runManager?: CallbackManagerForChainRun, options?: Partial<CallOptions>) => AsyncGenerator<O>, options?: Partial<CallOptions> & {
|
|
144
|
+
runType?: string;
|
|
145
|
+
}): AsyncGenerator<O>;
|
|
146
|
+
getGraph(_?: RunnableConfig): Graph;
|
|
147
|
+
/**
|
|
148
|
+
* Create a new runnable sequence that runs each individual runnable in series,
|
|
149
|
+
* piping the output of one runnable into another runnable or runnable-like.
|
|
150
|
+
* @param coerceable A runnable, function, or object whose values are functions or runnables.
|
|
151
|
+
* @returns A new runnable sequence.
|
|
152
|
+
*/
|
|
153
|
+
pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): Runnable<RunInput, Exclude<NewRunOutput, Error>>;
|
|
154
|
+
/**
|
|
155
|
+
* Pick keys from the dict output of this runnable. Returns a new runnable.
|
|
156
|
+
*/
|
|
157
|
+
pick(keys: string | string[]): Runnable;
|
|
158
|
+
/**
|
|
159
|
+
* Assigns new fields to the dict output of this runnable. Returns a new runnable.
|
|
160
|
+
*/
|
|
161
|
+
assign(mapping: RunnableMapLike<Record<string, unknown>, Record<string, unknown>>): Runnable;
|
|
162
|
+
/**
|
|
163
|
+
* Default implementation of transform, which buffers input and then calls stream.
|
|
164
|
+
* Subclasses should override this method if they can start producing output while
|
|
165
|
+
* input is still being generated.
|
|
166
|
+
* @param generator
|
|
167
|
+
* @param options
|
|
168
|
+
*/
|
|
169
|
+
transform(generator: AsyncGenerator<RunInput>, options: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
170
|
+
/**
|
|
171
|
+
* Stream all output from a runnable, as reported to the callback system.
|
|
172
|
+
* This includes all inner runs of LLMs, Retrievers, Tools, etc.
|
|
173
|
+
* Output is streamed as Log objects, which include a list of
|
|
174
|
+
* jsonpatch ops that describe how the state of the run has changed in each
|
|
175
|
+
* step, and the final state of the run.
|
|
176
|
+
* The jsonpatch ops can be applied in order to construct state.
|
|
177
|
+
* @param input
|
|
178
|
+
* @param options
|
|
179
|
+
* @param streamOptions
|
|
180
|
+
*/
|
|
181
|
+
streamLog(input: RunInput, options?: Partial<CallOptions>, streamOptions?: Omit<LogStreamCallbackHandlerInput, "autoClose">): AsyncGenerator<RunLogPatch>;
|
|
182
|
+
protected _streamLog(input: RunInput, logStreamCallbackHandler: LogStreamCallbackHandler, config: Partial<CallOptions>): AsyncGenerator<RunLogPatch>;
|
|
183
|
+
/**
|
|
184
|
+
* Generate a stream of events emitted by the internal steps of the runnable.
|
|
185
|
+
*
|
|
186
|
+
* Use to create an iterator over StreamEvents that provide real-time information
|
|
187
|
+
* about the progress of the runnable, including StreamEvents from intermediate
|
|
188
|
+
* results.
|
|
189
|
+
*
|
|
190
|
+
* A StreamEvent is a dictionary with the following schema:
|
|
191
|
+
*
|
|
192
|
+
* - `event`: string - Event names are of the format: on_[runnable_type]_(start|stream|end).
|
|
193
|
+
* - `name`: string - The name of the runnable that generated the event.
|
|
194
|
+
* - `run_id`: string - Randomly generated ID associated with the given execution of
|
|
195
|
+
* the runnable that emitted the event. A child runnable that gets invoked as part of the execution of a
|
|
196
|
+
* parent runnable is assigned its own unique ID.
|
|
197
|
+
* - `tags`: string[] - The tags of the runnable that generated the event.
|
|
198
|
+
* - `metadata`: Record<string, any> - The metadata of the runnable that generated the event.
|
|
199
|
+
* - `data`: Record<string, any>
|
|
200
|
+
*
|
|
201
|
+
* Below is a table that illustrates some events that might be emitted by various
|
|
202
|
+
* chains. Metadata fields have been omitted from the table for brevity.
|
|
203
|
+
* Chain definitions have been included after the table.
|
|
204
|
+
*
|
|
205
|
+
* **ATTENTION** This reference table is for the V2 version of the schema.
|
|
206
|
+
*
|
|
207
|
+
* ```md
|
|
208
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
209
|
+
* | event | input | output/chunk |
|
|
210
|
+
* +======================+=============================+==========================================+
|
|
211
|
+
* | on_chat_model_start | {"messages": BaseMessage[]} | |
|
|
212
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
213
|
+
* | on_chat_model_stream | | AIMessageChunk("hello") |
|
|
214
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
215
|
+
* | on_chat_model_end | {"messages": BaseMessage[]} | AIMessageChunk("hello world") |
|
|
216
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
217
|
+
* | on_llm_start | {'input': 'hello'} | |
|
|
218
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
219
|
+
* | on_llm_stream | | 'Hello' |
|
|
220
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
221
|
+
* | on_llm_end | 'Hello human!' | |
|
|
222
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
223
|
+
* | on_chain_start | | |
|
|
224
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
225
|
+
* | on_chain_stream | | "hello world!" |
|
|
226
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
227
|
+
* | on_chain_end | [Document(...)] | "hello world!, goodbye world!" |
|
|
228
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
229
|
+
* | on_tool_start | {"x": 1, "y": "2"} | |
|
|
230
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
231
|
+
* | on_tool_end | | {"x": 1, "y": "2"} |
|
|
232
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
233
|
+
* | on_retriever_start | {"query": "hello"} | |
|
|
234
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
235
|
+
* | on_retriever_end | {"query": "hello"} | [Document(...), ..] |
|
|
236
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
237
|
+
* | on_prompt_start | {"question": "hello"} | |
|
|
238
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
239
|
+
* | on_prompt_end | {"question": "hello"} | ChatPromptValue(messages: BaseMessage[]) |
|
|
240
|
+
* +----------------------+-----------------------------+------------------------------------------+
|
|
241
|
+
* ```
|
|
242
|
+
*
|
|
243
|
+
* The "on_chain_*" events are the default for Runnables that don't fit one of the above categories.
|
|
244
|
+
*
|
|
245
|
+
* In addition to the standard events above, users can also dispatch custom events.
|
|
246
|
+
*
|
|
247
|
+
* Custom events will be only be surfaced with in the `v2` version of the API!
|
|
248
|
+
*
|
|
249
|
+
* A custom event has following format:
|
|
250
|
+
*
|
|
251
|
+
* ```md
|
|
252
|
+
* +-----------+------+------------------------------------------------------------+
|
|
253
|
+
* | Attribute | Type | Description |
|
|
254
|
+
* +===========+======+============================================================+
|
|
255
|
+
* | name | str | A user defined name for the event. |
|
|
256
|
+
* +-----------+------+------------------------------------------------------------+
|
|
257
|
+
* | data | Any | The data associated with the event. This can be anything. |
|
|
258
|
+
* +-----------+------+------------------------------------------------------------+
|
|
259
|
+
* ```
|
|
260
|
+
*
|
|
261
|
+
* Here's an example:
|
|
262
|
+
*
|
|
263
|
+
* ```ts
|
|
264
|
+
* import { RunnableLambda } from "@langchain/core/runnables";
|
|
265
|
+
* import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
|
|
266
|
+
* // Use this import for web environments that don't support "async_hooks"
|
|
267
|
+
* // and manually pass config to child runs.
|
|
268
|
+
* // import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch/web";
|
|
269
|
+
*
|
|
270
|
+
* const slowThing = RunnableLambda.from(async (someInput: string) => {
|
|
271
|
+
* // Placeholder for some slow operation
|
|
272
|
+
* await new Promise((resolve) => setTimeout(resolve, 100));
|
|
273
|
+
* await dispatchCustomEvent("progress_event", {
|
|
274
|
+
* message: "Finished step 1 of 2",
|
|
275
|
+
* });
|
|
276
|
+
* await new Promise((resolve) => setTimeout(resolve, 100));
|
|
277
|
+
* return "Done";
|
|
278
|
+
* });
|
|
279
|
+
*
|
|
280
|
+
* const eventStream = await slowThing.streamEvents("hello world", {
|
|
281
|
+
* version: "v2",
|
|
282
|
+
* });
|
|
283
|
+
*
|
|
284
|
+
* for await (const event of eventStream) {
|
|
285
|
+
* if (event.event === "on_custom_event") {
|
|
286
|
+
* console.log(event);
|
|
287
|
+
* }
|
|
288
|
+
* }
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
292
|
+
version: "v1" | "v2";
|
|
293
|
+
}, streamOptions?: Omit<EventStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<StreamEvent>;
|
|
294
|
+
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
295
|
+
version: "v1" | "v2";
|
|
296
|
+
encoding: "text/event-stream";
|
|
297
|
+
}, streamOptions?: Omit<EventStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<Uint8Array>;
|
|
298
|
+
private _streamEventsV2;
|
|
299
|
+
private _streamEventsV1;
|
|
300
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
301
|
+
static isRunnable(thing: any): thing is Runnable;
|
|
302
|
+
/**
|
|
303
|
+
* Bind lifecycle listeners to a Runnable, returning a new Runnable.
|
|
304
|
+
* The Run object contains information about the run, including its id,
|
|
305
|
+
* type, input, output, error, startTime, endTime, and any tags or metadata
|
|
306
|
+
* added to the run.
|
|
307
|
+
*
|
|
308
|
+
* @param {Object} params - The object containing the callback functions.
|
|
309
|
+
* @param {(run: Run) => void} params.onStart - Called before the runnable starts running, with the Run object.
|
|
310
|
+
* @param {(run: Run) => void} params.onEnd - Called after the runnable finishes running, with the Run object.
|
|
311
|
+
* @param {(run: Run) => void} params.onError - Called if the runnable throws an error, with the Run object.
|
|
312
|
+
*/
|
|
313
|
+
withListeners({
|
|
314
|
+
onStart,
|
|
315
|
+
onEnd,
|
|
316
|
+
onError
|
|
317
|
+
}: {
|
|
318
|
+
onStart?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
319
|
+
onEnd?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
320
|
+
onError?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
321
|
+
}): Runnable<RunInput, RunOutput, CallOptions>;
|
|
322
|
+
/**
|
|
323
|
+
* Convert a runnable to a tool. Return a new instance of `RunnableToolLike`
|
|
324
|
+
* which contains the runnable, name, description and schema.
|
|
325
|
+
*
|
|
326
|
+
* @template {T extends RunInput = RunInput} RunInput - The input type of the runnable. Should be the same as the `RunInput` type of the runnable.
|
|
327
|
+
*
|
|
328
|
+
* @param fields
|
|
329
|
+
* @param {string | undefined} [fields.name] The name of the tool. If not provided, it will default to the name of the runnable.
|
|
330
|
+
* @param {string | undefined} [fields.description] The description of the tool. Falls back to the description on the Zod schema if not provided, or undefined if neither are provided.
|
|
331
|
+
* @param {z.ZodType<T>} [fields.schema] The Zod schema for the input of the tool. Infers the Zod type from the input type of the runnable.
|
|
332
|
+
* @returns {RunnableToolLike<z.ZodType<T>, RunOutput>} An instance of `RunnableToolLike` which is a runnable that can be used as a tool.
|
|
333
|
+
*/
|
|
334
|
+
asTool<T extends RunInput = RunInput>(fields: {
|
|
26
335
|
name?: string;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
* Bind arguments to a Runnable, returning a new Runnable.
|
|
31
|
-
* @param kwargs
|
|
32
|
-
* @returns A new RunnableBinding that, when invoked, will apply the bound args.
|
|
33
|
-
*
|
|
34
|
-
* @deprecated Use {@link withConfig} instead. This will be removed in the next breaking release.
|
|
35
|
-
*/
|
|
36
|
-
bind(kwargs: Partial<CallOptions>): Runnable<RunInput, RunOutput, CallOptions>;
|
|
37
|
-
/**
|
|
38
|
-
* Return a new Runnable that maps a list of inputs to a list of outputs,
|
|
39
|
-
* by calling invoke() with each input.
|
|
40
|
-
*
|
|
41
|
-
* @deprecated This will be removed in the next breaking release.
|
|
42
|
-
*/
|
|
43
|
-
map(): Runnable<RunInput[], RunOutput[], CallOptions>;
|
|
44
|
-
/**
|
|
45
|
-
* Add retry logic to an existing runnable.
|
|
46
|
-
* @param fields.stopAfterAttempt The number of attempts to retry.
|
|
47
|
-
* @param fields.onFailedAttempt A function that is called when a retry fails.
|
|
48
|
-
* @returns A new RunnableRetry that, when invoked, will retry according to the parameters.
|
|
49
|
-
*/
|
|
50
|
-
withRetry(fields?: {
|
|
51
|
-
stopAfterAttempt?: number;
|
|
52
|
-
onFailedAttempt?: RunnableRetryFailedAttemptHandler;
|
|
53
|
-
}): RunnableRetry<RunInput, RunOutput, CallOptions>;
|
|
54
|
-
/**
|
|
55
|
-
* Bind config to a Runnable, returning a new Runnable.
|
|
56
|
-
* @param config New configuration parameters to attach to the new runnable.
|
|
57
|
-
* @returns A new RunnableBinding with a config matching what's passed.
|
|
58
|
-
*/
|
|
59
|
-
withConfig(config: Partial<CallOptions>): Runnable<RunInput, RunOutput, CallOptions>;
|
|
60
|
-
/**
|
|
61
|
-
* Create a new runnable from the current one that will try invoking
|
|
62
|
-
* other passed fallback runnables if the initial invocation fails.
|
|
63
|
-
* @param fields.fallbacks Other runnables to call if the runnable errors.
|
|
64
|
-
* @returns A new RunnableWithFallbacks.
|
|
65
|
-
*/
|
|
66
|
-
withFallbacks(fields: {
|
|
67
|
-
fallbacks: Runnable<RunInput, RunOutput>[];
|
|
68
|
-
} | Runnable<RunInput, RunOutput>[]): RunnableWithFallbacks<RunInput, RunOutput>;
|
|
69
|
-
protected _getOptionsList<O extends CallOptions & {
|
|
70
|
-
runType?: string;
|
|
71
|
-
}>(options: Partial<O> | Partial<O>[], length?: number): Partial<O>[];
|
|
72
|
-
/**
|
|
73
|
-
* Default implementation of batch, which calls invoke N times.
|
|
74
|
-
* Subclasses should override this method if they can batch more efficiently.
|
|
75
|
-
* @param inputs Array of inputs to each batch call.
|
|
76
|
-
* @param options Either a single call options object to apply to each batch call or an array for each call.
|
|
77
|
-
* @param batchOptions.returnExceptions Whether to return errors rather than throwing on the first one
|
|
78
|
-
* @returns An array of RunOutputs, or mixed RunOutputs and errors if batchOptions.returnExceptions is set
|
|
79
|
-
*/
|
|
80
|
-
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
81
|
-
returnExceptions?: false;
|
|
82
|
-
}): Promise<RunOutput[]>;
|
|
83
|
-
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
84
|
-
returnExceptions: true;
|
|
85
|
-
}): Promise<(RunOutput | Error)[]>;
|
|
86
|
-
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
87
|
-
/**
|
|
88
|
-
* Default streaming implementation.
|
|
89
|
-
* Subclasses should override this method if they support streaming output.
|
|
90
|
-
* @param input
|
|
91
|
-
* @param options
|
|
92
|
-
*/
|
|
93
|
-
_streamIterator(input: RunInput, options?: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
94
|
-
/**
|
|
95
|
-
* Stream output in chunks.
|
|
96
|
-
* @param input
|
|
97
|
-
* @param options
|
|
98
|
-
* @returns A readable stream that is also an iterable.
|
|
99
|
-
*/
|
|
100
|
-
stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<RunOutput>>;
|
|
101
|
-
protected _separateRunnableConfigFromCallOptions(options?: Partial<CallOptions>): [RunnableConfig, Omit<Partial<CallOptions>, keyof RunnableConfig>];
|
|
102
|
-
protected _callWithConfig<T extends RunInput>(func: ((input: T) => Promise<RunOutput>) | ((input: T, config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun) => Promise<RunOutput>), input: T, options?: Partial<CallOptions> & {
|
|
103
|
-
runType?: string;
|
|
104
|
-
}): Promise<RunOutput>;
|
|
105
|
-
/**
|
|
106
|
-
* Internal method that handles batching and configuration for a runnable
|
|
107
|
-
* It takes a function, input values, and optional configuration, and
|
|
108
|
-
* returns a promise that resolves to the output values.
|
|
109
|
-
* @param func The function to be executed for each input value.
|
|
110
|
-
* @param input The input values to be processed.
|
|
111
|
-
* @param config Optional configuration for the function execution.
|
|
112
|
-
* @returns A promise that resolves to the output values.
|
|
113
|
-
*/
|
|
114
|
-
_batchWithConfig<T extends RunInput>(func: (inputs: T[], options?: Partial<CallOptions>[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions) => Promise<(RunOutput | Error)[]>, inputs: T[], options?: Partial<CallOptions & {
|
|
115
|
-
runType?: string;
|
|
116
|
-
}> | Partial<CallOptions & {
|
|
117
|
-
runType?: string;
|
|
118
|
-
}>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
119
|
-
/**
|
|
120
|
-
* Helper method to transform an Iterator of Input values into an Iterator of
|
|
121
|
-
* Output values, with callbacks.
|
|
122
|
-
* Use this to implement `stream()` or `transform()` in Runnable subclasses.
|
|
123
|
-
*/
|
|
124
|
-
protected _transformStreamWithConfig<I extends RunInput, O extends RunOutput>(inputGenerator: AsyncGenerator<I>, transformer: (generator: AsyncGenerator<I>, runManager?: CallbackManagerForChainRun, options?: Partial<CallOptions>) => AsyncGenerator<O>, options?: Partial<CallOptions> & {
|
|
125
|
-
runType?: string;
|
|
126
|
-
}): AsyncGenerator<O>;
|
|
127
|
-
getGraph(_?: RunnableConfig): Graph;
|
|
128
|
-
/**
|
|
129
|
-
* Create a new runnable sequence that runs each individual runnable in series,
|
|
130
|
-
* piping the output of one runnable into another runnable or runnable-like.
|
|
131
|
-
* @param coerceable A runnable, function, or object whose values are functions or runnables.
|
|
132
|
-
* @returns A new runnable sequence.
|
|
133
|
-
*/
|
|
134
|
-
pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): Runnable<RunInput, Exclude<NewRunOutput, Error>>;
|
|
135
|
-
/**
|
|
136
|
-
* Pick keys from the dict output of this runnable. Returns a new runnable.
|
|
137
|
-
*/
|
|
138
|
-
pick(keys: string | string[]): Runnable;
|
|
139
|
-
/**
|
|
140
|
-
* Assigns new fields to the dict output of this runnable. Returns a new runnable.
|
|
141
|
-
*/
|
|
142
|
-
assign(mapping: RunnableMapLike<Record<string, unknown>, Record<string, unknown>>): Runnable;
|
|
143
|
-
/**
|
|
144
|
-
* Default implementation of transform, which buffers input and then calls stream.
|
|
145
|
-
* Subclasses should override this method if they can start producing output while
|
|
146
|
-
* input is still being generated.
|
|
147
|
-
* @param generator
|
|
148
|
-
* @param options
|
|
149
|
-
*/
|
|
150
|
-
transform(generator: AsyncGenerator<RunInput>, options: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
151
|
-
/**
|
|
152
|
-
* Stream all output from a runnable, as reported to the callback system.
|
|
153
|
-
* This includes all inner runs of LLMs, Retrievers, Tools, etc.
|
|
154
|
-
* Output is streamed as Log objects, which include a list of
|
|
155
|
-
* jsonpatch ops that describe how the state of the run has changed in each
|
|
156
|
-
* step, and the final state of the run.
|
|
157
|
-
* The jsonpatch ops can be applied in order to construct state.
|
|
158
|
-
* @param input
|
|
159
|
-
* @param options
|
|
160
|
-
* @param streamOptions
|
|
161
|
-
*/
|
|
162
|
-
streamLog(input: RunInput, options?: Partial<CallOptions>, streamOptions?: Omit<LogStreamCallbackHandlerInput, "autoClose">): AsyncGenerator<RunLogPatch>;
|
|
163
|
-
protected _streamLog(input: RunInput, logStreamCallbackHandler: LogStreamCallbackHandler, config: Partial<CallOptions>): AsyncGenerator<RunLogPatch>;
|
|
164
|
-
/**
|
|
165
|
-
* Generate a stream of events emitted by the internal steps of the runnable.
|
|
166
|
-
*
|
|
167
|
-
* Use to create an iterator over StreamEvents that provide real-time information
|
|
168
|
-
* about the progress of the runnable, including StreamEvents from intermediate
|
|
169
|
-
* results.
|
|
170
|
-
*
|
|
171
|
-
* A StreamEvent is a dictionary with the following schema:
|
|
172
|
-
*
|
|
173
|
-
* - `event`: string - Event names are of the format: on_[runnable_type]_(start|stream|end).
|
|
174
|
-
* - `name`: string - The name of the runnable that generated the event.
|
|
175
|
-
* - `run_id`: string - Randomly generated ID associated with the given execution of
|
|
176
|
-
* the runnable that emitted the event. A child runnable that gets invoked as part of the execution of a
|
|
177
|
-
* parent runnable is assigned its own unique ID.
|
|
178
|
-
* - `tags`: string[] - The tags of the runnable that generated the event.
|
|
179
|
-
* - `metadata`: Record<string, any> - The metadata of the runnable that generated the event.
|
|
180
|
-
* - `data`: Record<string, any>
|
|
181
|
-
*
|
|
182
|
-
* Below is a table that illustrates some events that might be emitted by various
|
|
183
|
-
* chains. Metadata fields have been omitted from the table for brevity.
|
|
184
|
-
* Chain definitions have been included after the table.
|
|
185
|
-
*
|
|
186
|
-
* **ATTENTION** This reference table is for the V2 version of the schema.
|
|
187
|
-
*
|
|
188
|
-
* ```md
|
|
189
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
190
|
-
* | event | input | output/chunk |
|
|
191
|
-
* +======================+=============================+==========================================+
|
|
192
|
-
* | on_chat_model_start | {"messages": BaseMessage[]} | |
|
|
193
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
194
|
-
* | on_chat_model_stream | | AIMessageChunk("hello") |
|
|
195
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
196
|
-
* | on_chat_model_end | {"messages": BaseMessage[]} | AIMessageChunk("hello world") |
|
|
197
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
198
|
-
* | on_llm_start | {'input': 'hello'} | |
|
|
199
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
200
|
-
* | on_llm_stream | | 'Hello' |
|
|
201
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
202
|
-
* | on_llm_end | 'Hello human!' | |
|
|
203
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
204
|
-
* | on_chain_start | | |
|
|
205
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
206
|
-
* | on_chain_stream | | "hello world!" |
|
|
207
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
208
|
-
* | on_chain_end | [Document(...)] | "hello world!, goodbye world!" |
|
|
209
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
210
|
-
* | on_tool_start | {"x": 1, "y": "2"} | |
|
|
211
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
212
|
-
* | on_tool_end | | {"x": 1, "y": "2"} |
|
|
213
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
214
|
-
* | on_retriever_start | {"query": "hello"} | |
|
|
215
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
216
|
-
* | on_retriever_end | {"query": "hello"} | [Document(...), ..] |
|
|
217
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
218
|
-
* | on_prompt_start | {"question": "hello"} | |
|
|
219
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
220
|
-
* | on_prompt_end | {"question": "hello"} | ChatPromptValue(messages: BaseMessage[]) |
|
|
221
|
-
* +----------------------+-----------------------------+------------------------------------------+
|
|
222
|
-
* ```
|
|
223
|
-
*
|
|
224
|
-
* The "on_chain_*" events are the default for Runnables that don't fit one of the above categories.
|
|
225
|
-
*
|
|
226
|
-
* In addition to the standard events above, users can also dispatch custom events.
|
|
227
|
-
*
|
|
228
|
-
* Custom events will be only be surfaced with in the `v2` version of the API!
|
|
229
|
-
*
|
|
230
|
-
* A custom event has following format:
|
|
231
|
-
*
|
|
232
|
-
* ```md
|
|
233
|
-
* +-----------+------+------------------------------------------------------------+
|
|
234
|
-
* | Attribute | Type | Description |
|
|
235
|
-
* +===========+======+============================================================+
|
|
236
|
-
* | name | str | A user defined name for the event. |
|
|
237
|
-
* +-----------+------+------------------------------------------------------------+
|
|
238
|
-
* | data | Any | The data associated with the event. This can be anything. |
|
|
239
|
-
* +-----------+------+------------------------------------------------------------+
|
|
240
|
-
* ```
|
|
241
|
-
*
|
|
242
|
-
* Here's an example:
|
|
243
|
-
*
|
|
244
|
-
* ```ts
|
|
245
|
-
* import { RunnableLambda } from "@langchain/core/runnables";
|
|
246
|
-
* import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch";
|
|
247
|
-
* // Use this import for web environments that don't support "async_hooks"
|
|
248
|
-
* // and manually pass config to child runs.
|
|
249
|
-
* // import { dispatchCustomEvent } from "@langchain/core/callbacks/dispatch/web";
|
|
250
|
-
*
|
|
251
|
-
* const slowThing = RunnableLambda.from(async (someInput: string) => {
|
|
252
|
-
* // Placeholder for some slow operation
|
|
253
|
-
* await new Promise((resolve) => setTimeout(resolve, 100));
|
|
254
|
-
* await dispatchCustomEvent("progress_event", {
|
|
255
|
-
* message: "Finished step 1 of 2",
|
|
256
|
-
* });
|
|
257
|
-
* await new Promise((resolve) => setTimeout(resolve, 100));
|
|
258
|
-
* return "Done";
|
|
259
|
-
* });
|
|
260
|
-
*
|
|
261
|
-
* const eventStream = await slowThing.streamEvents("hello world", {
|
|
262
|
-
* version: "v2",
|
|
263
|
-
* });
|
|
264
|
-
*
|
|
265
|
-
* for await (const event of eventStream) {
|
|
266
|
-
* if (event.event === "on_custom_event") {
|
|
267
|
-
* console.log(event);
|
|
268
|
-
* }
|
|
269
|
-
* }
|
|
270
|
-
* ```
|
|
271
|
-
*/
|
|
272
|
-
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
273
|
-
version: "v1" | "v2";
|
|
274
|
-
}, streamOptions?: Omit<EventStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<StreamEvent>;
|
|
275
|
-
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
276
|
-
version: "v1" | "v2";
|
|
277
|
-
encoding: "text/event-stream";
|
|
278
|
-
}, streamOptions?: Omit<EventStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<Uint8Array>;
|
|
279
|
-
private _streamEventsV2;
|
|
280
|
-
private _streamEventsV1;
|
|
281
|
-
static isRunnable(thing: any): thing is Runnable;
|
|
282
|
-
/**
|
|
283
|
-
* Bind lifecycle listeners to a Runnable, returning a new Runnable.
|
|
284
|
-
* The Run object contains information about the run, including its id,
|
|
285
|
-
* type, input, output, error, startTime, endTime, and any tags or metadata
|
|
286
|
-
* added to the run.
|
|
287
|
-
*
|
|
288
|
-
* @param {Object} params - The object containing the callback functions.
|
|
289
|
-
* @param {(run: Run) => void} params.onStart - Called before the runnable starts running, with the Run object.
|
|
290
|
-
* @param {(run: Run) => void} params.onEnd - Called after the runnable finishes running, with the Run object.
|
|
291
|
-
* @param {(run: Run) => void} params.onError - Called if the runnable throws an error, with the Run object.
|
|
292
|
-
*/
|
|
293
|
-
withListeners({ onStart, onEnd, onError, }: {
|
|
294
|
-
onStart?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
295
|
-
onEnd?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
296
|
-
onError?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
297
|
-
}): Runnable<RunInput, RunOutput, CallOptions>;
|
|
298
|
-
/**
|
|
299
|
-
* Convert a runnable to a tool. Return a new instance of `RunnableToolLike`
|
|
300
|
-
* which contains the runnable, name, description and schema.
|
|
301
|
-
*
|
|
302
|
-
* @template {T extends RunInput = RunInput} RunInput - The input type of the runnable. Should be the same as the `RunInput` type of the runnable.
|
|
303
|
-
*
|
|
304
|
-
* @param fields
|
|
305
|
-
* @param {string | undefined} [fields.name] The name of the tool. If not provided, it will default to the name of the runnable.
|
|
306
|
-
* @param {string | undefined} [fields.description] The description of the tool. Falls back to the description on the Zod schema if not provided, or undefined if neither are provided.
|
|
307
|
-
* @param {z.ZodType<T>} [fields.schema] The Zod schema for the input of the tool. Infers the Zod type from the input type of the runnable.
|
|
308
|
-
* @returns {RunnableToolLike<z.ZodType<T>, RunOutput>} An instance of `RunnableToolLike` which is a runnable that can be used as a tool.
|
|
309
|
-
*/
|
|
310
|
-
asTool<T extends RunInput = RunInput>(fields: {
|
|
311
|
-
name?: string;
|
|
312
|
-
description?: string;
|
|
313
|
-
schema: InteropZodType<T>;
|
|
314
|
-
}): RunnableToolLike<InteropZodType<T | ToolCall>, RunOutput>;
|
|
336
|
+
description?: string;
|
|
337
|
+
schema: InteropZodType<T>;
|
|
338
|
+
}): RunnableToolLike<InteropZodType<T | ToolCall>, RunOutput>;
|
|
315
339
|
}
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
340
|
+
type RunnableBindingArgs<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig> = {
|
|
341
|
+
bound: Runnable<RunInput, RunOutput, CallOptions>;
|
|
342
|
+
/**
|
|
343
|
+
* @deprecated use {@link config} instead
|
|
344
|
+
*/
|
|
345
|
+
kwargs?: Partial<CallOptions>;
|
|
346
|
+
config: RunnableConfig;
|
|
347
|
+
configFactories?: Array<(config: RunnableConfig) => RunnableConfig | Promise<RunnableConfig>>;
|
|
324
348
|
};
|
|
325
349
|
/**
|
|
326
350
|
* Wraps a runnable and applies partial config upon invocation.
|
|
@@ -363,65 +387,73 @@ export type RunnableBindingArgs<RunInput, RunOutput, CallOptions extends Runnabl
|
|
|
363
387
|
* // { name: "Bob", email: "bob@example.com", role: "User" }
|
|
364
388
|
* ```
|
|
365
389
|
*/
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
390
|
+
declare class RunnableBinding<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
|
|
391
|
+
static lc_name(): string;
|
|
392
|
+
lc_namespace: string[];
|
|
393
|
+
lc_serializable: boolean;
|
|
394
|
+
bound: Runnable<RunInput, RunOutput, CallOptions>;
|
|
395
|
+
config: RunnableConfig;
|
|
396
|
+
kwargs?: Partial<CallOptions>;
|
|
397
|
+
configFactories?: Array<(config: RunnableConfig) => RunnableConfig | Promise<RunnableConfig>>;
|
|
398
|
+
constructor(fields: RunnableBindingArgs<RunInput, RunOutput, CallOptions>);
|
|
399
|
+
getName(suffix?: string | undefined): string;
|
|
400
|
+
_mergeConfig(...options: (Partial<CallOptions> | RunnableConfig | undefined)[]): Promise<Partial<CallOptions>>;
|
|
401
|
+
/**
|
|
402
|
+
* Binds the runnable with the specified arguments.
|
|
403
|
+
* @param kwargs The arguments to bind the runnable with.
|
|
404
|
+
* @returns A new instance of the `RunnableBinding` class that is bound with the specified arguments.
|
|
405
|
+
*
|
|
406
|
+
* @deprecated Use {@link withConfig} instead. This will be removed in the next breaking release.
|
|
407
|
+
*/
|
|
408
|
+
bind(kwargs: Partial<CallOptions>): RunnableBinding<RunInput, RunOutput, CallOptions>;
|
|
409
|
+
withConfig(config: Partial<CallOptions>): Runnable<RunInput, RunOutput, CallOptions>;
|
|
410
|
+
withRetry(fields?: {
|
|
411
|
+
stopAfterAttempt?: number;
|
|
412
|
+
onFailedAttempt?: RunnableRetryFailedAttemptHandler;
|
|
413
|
+
}): RunnableRetry<RunInput, RunOutput, CallOptions>;
|
|
414
|
+
invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
|
|
415
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
416
|
+
returnExceptions?: false;
|
|
417
|
+
}): Promise<RunOutput[]>;
|
|
418
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
419
|
+
returnExceptions: true;
|
|
420
|
+
}): Promise<(RunOutput | Error)[]>;
|
|
421
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
422
|
+
_streamIterator(input: RunInput, options?: Partial<CallOptions> | undefined): AsyncGenerator<Awaited<RunOutput>, void, any>;
|
|
423
|
+
stream(input: RunInput, options?: Partial<CallOptions> | undefined): Promise<IterableReadableStream<RunOutput>>;
|
|
424
|
+
transform(generator: AsyncGenerator<RunInput>, options?: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
425
|
+
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
426
|
+
version: "v1" | "v2";
|
|
427
|
+
}, streamOptions?: Omit<LogStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<StreamEvent>;
|
|
428
|
+
streamEvents(input: RunInput, options: Partial<CallOptions> & {
|
|
429
|
+
version: "v1" | "v2";
|
|
430
|
+
encoding: "text/event-stream";
|
|
431
|
+
}, streamOptions?: Omit<LogStreamCallbackHandlerInput, "autoClose">): IterableReadableStream<Uint8Array>;
|
|
432
|
+
static isRunnableBinding(
|
|
433
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
434
|
+
thing: any
|
|
435
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
436
|
+
): thing is RunnableBinding<any, any, any>;
|
|
437
|
+
/**
|
|
438
|
+
* Bind lifecycle listeners to a Runnable, returning a new Runnable.
|
|
439
|
+
* The Run object contains information about the run, including its id,
|
|
440
|
+
* type, input, output, error, startTime, endTime, and any tags or metadata
|
|
441
|
+
* added to the run.
|
|
442
|
+
*
|
|
443
|
+
* @param {Object} params - The object containing the callback functions.
|
|
444
|
+
* @param {(run: Run) => void} params.onStart - Called before the runnable starts running, with the Run object.
|
|
445
|
+
* @param {(run: Run) => void} params.onEnd - Called after the runnable finishes running, with the Run object.
|
|
446
|
+
* @param {(run: Run) => void} params.onError - Called if the runnable throws an error, with the Run object.
|
|
447
|
+
*/
|
|
448
|
+
withListeners({
|
|
449
|
+
onStart,
|
|
450
|
+
onEnd,
|
|
451
|
+
onError
|
|
452
|
+
}: {
|
|
453
|
+
onStart?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
454
|
+
onEnd?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
455
|
+
onError?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
456
|
+
}): Runnable<RunInput, RunOutput, CallOptions>;
|
|
425
457
|
}
|
|
426
458
|
/**
|
|
427
459
|
* A runnable that delegates calls to another runnable
|
|
@@ -447,52 +479,56 @@ export declare class RunnableBinding<RunInput, RunOutput, CallOptions extends Ru
|
|
|
447
479
|
*
|
|
448
480
|
* @deprecated This will be removed in the next breaking release.
|
|
449
481
|
*/
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
482
|
+
declare class RunnableEach<RunInputItem, RunOutputItem, CallOptions extends RunnableConfig> extends Runnable<RunInputItem[], RunOutputItem[], CallOptions> {
|
|
483
|
+
static lc_name(): string;
|
|
484
|
+
lc_serializable: boolean;
|
|
485
|
+
lc_namespace: string[];
|
|
486
|
+
bound: Runnable<RunInputItem, RunOutputItem, CallOptions>;
|
|
487
|
+
constructor(fields: {
|
|
454
488
|
bound: Runnable<RunInputItem, RunOutputItem, CallOptions>;
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
489
|
+
});
|
|
490
|
+
/**
|
|
491
|
+
* Binds the runnable with the specified arguments.
|
|
492
|
+
* @param kwargs The arguments to bind the runnable with.
|
|
493
|
+
* @returns A new instance of the `RunnableEach` class that is bound with the specified arguments.
|
|
494
|
+
*
|
|
495
|
+
* @deprecated Use {@link withConfig} instead. This will be removed in the next breaking release.
|
|
496
|
+
*/
|
|
497
|
+
bind(kwargs: Partial<CallOptions>): RunnableEach<RunInputItem, RunOutputItem, CallOptions>;
|
|
498
|
+
/**
|
|
499
|
+
* Invokes the runnable with the specified input and configuration.
|
|
500
|
+
* @param input The input to invoke the runnable with.
|
|
501
|
+
* @param config The configuration to invoke the runnable with.
|
|
502
|
+
* @returns A promise that resolves to the output of the runnable.
|
|
503
|
+
*/
|
|
504
|
+
invoke(inputs: RunInputItem[], config?: Partial<CallOptions>): Promise<RunOutputItem[]>;
|
|
505
|
+
/**
|
|
506
|
+
* A helper method that is used to invoke the runnable with the specified input and configuration.
|
|
507
|
+
* @param input The input to invoke the runnable with.
|
|
508
|
+
* @param config The configuration to invoke the runnable with.
|
|
509
|
+
* @returns A promise that resolves to the output of the runnable.
|
|
510
|
+
*/
|
|
511
|
+
protected _invoke(inputs: RunInputItem[], config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun): Promise<RunOutputItem[]>;
|
|
512
|
+
/**
|
|
513
|
+
* Bind lifecycle listeners to a Runnable, returning a new Runnable.
|
|
514
|
+
* The Run object contains information about the run, including its id,
|
|
515
|
+
* type, input, output, error, startTime, endTime, and any tags or metadata
|
|
516
|
+
* added to the run.
|
|
517
|
+
*
|
|
518
|
+
* @param {Object} params - The object containing the callback functions.
|
|
519
|
+
* @param {(run: Run) => void} params.onStart - Called before the runnable starts running, with the Run object.
|
|
520
|
+
* @param {(run: Run) => void} params.onEnd - Called after the runnable finishes running, with the Run object.
|
|
521
|
+
* @param {(run: Run) => void} params.onError - Called if the runnable throws an error, with the Run object.
|
|
522
|
+
*/
|
|
523
|
+
withListeners({
|
|
524
|
+
onStart,
|
|
525
|
+
onEnd,
|
|
526
|
+
onError
|
|
527
|
+
}: {
|
|
528
|
+
onStart?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
529
|
+
onEnd?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
530
|
+
onError?: (run: Run, config?: RunnableConfig) => void | Promise<void>;
|
|
531
|
+
}): Runnable<any, any, CallOptions>;
|
|
496
532
|
}
|
|
497
533
|
/**
|
|
498
534
|
* Base class for runnables that can be retried a
|
|
@@ -537,43 +573,50 @@ export declare class RunnableEach<RunInputItem, RunOutputItem, CallOptions exten
|
|
|
537
573
|
* });
|
|
538
574
|
* ```
|
|
539
575
|
*/
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
576
|
+
declare class RunnableRetry<
|
|
577
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
578
|
+
RunInput = any,
|
|
579
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
580
|
+
RunOutput = any, CallOptions extends RunnableConfig = RunnableConfig> extends RunnableBinding<RunInput, RunOutput, CallOptions> {
|
|
581
|
+
static lc_name(): string;
|
|
582
|
+
lc_namespace: string[];
|
|
583
|
+
protected maxAttemptNumber: number;
|
|
584
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
585
|
+
onFailedAttempt: RunnableRetryFailedAttemptHandler;
|
|
586
|
+
constructor(fields: RunnableBindingArgs<RunInput, RunOutput, CallOptions> & {
|
|
587
|
+
maxAttemptNumber?: number;
|
|
588
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
589
|
+
onFailedAttempt?: RunnableRetryFailedAttemptHandler;
|
|
590
|
+
});
|
|
591
|
+
_patchConfigForRetry(attempt: number, config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun): Partial<CallOptions>;
|
|
592
|
+
protected _invoke(input: RunInput, config?: CallOptions, runManager?: CallbackManagerForChainRun): Promise<RunOutput>;
|
|
593
|
+
/**
|
|
594
|
+
* Method that invokes the runnable with the specified input, run manager,
|
|
595
|
+
* and config. It handles the retry logic by catching any errors and
|
|
596
|
+
* recursively invoking itself with the updated config for the next retry
|
|
597
|
+
* attempt.
|
|
598
|
+
* @param input The input for the runnable.
|
|
599
|
+
* @param runManager The run manager for the runnable.
|
|
600
|
+
* @param config The config for the runnable.
|
|
601
|
+
* @returns A promise that resolves to the output of the runnable.
|
|
602
|
+
*/
|
|
603
|
+
invoke(input: RunInput, config?: CallOptions): Promise<RunOutput>;
|
|
604
|
+
_batch<ReturnExceptions extends boolean = false>(inputs: RunInput[], configs?: RunnableConfig[], runManagers?: (CallbackManagerForChainRun | undefined)[], batchOptions?: RunnableBatchOptions): Promise<ReturnExceptions extends false ? RunOutput[] : (RunOutput | Error)[]>;
|
|
605
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
606
|
+
returnExceptions?: false;
|
|
607
|
+
}): Promise<RunOutput[]>;
|
|
608
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions & {
|
|
609
|
+
returnExceptions: true;
|
|
610
|
+
}): Promise<(RunOutput | Error)[]>;
|
|
611
|
+
batch(inputs: RunInput[], options?: Partial<CallOptions> | Partial<CallOptions>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
570
612
|
}
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
613
|
+
type RunnableSequenceFields<RunInput, RunOutput> = {
|
|
614
|
+
first: Runnable<RunInput>;
|
|
615
|
+
middle?: Runnable[];
|
|
616
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
617
|
+
last: Runnable<any, RunOutput>;
|
|
618
|
+
name?: string;
|
|
619
|
+
omitSequenceTags?: boolean;
|
|
577
620
|
};
|
|
578
621
|
/**
|
|
579
622
|
* A sequence of runnables, where the output of each is the input of the next.
|
|
@@ -586,33 +629,38 @@ export type RunnableSequenceFields<RunInput, RunOutput> = {
|
|
|
586
629
|
* const result = await chain.invoke({ topic: "bears" });
|
|
587
630
|
* ```
|
|
588
631
|
*/
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
632
|
+
declare class RunnableSequence<
|
|
633
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
634
|
+
RunInput = any,
|
|
635
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
636
|
+
RunOutput = any> extends Runnable<RunInput, RunOutput> {
|
|
637
|
+
static lc_name(): string;
|
|
638
|
+
protected first: Runnable<RunInput>;
|
|
639
|
+
protected middle: Runnable[];
|
|
640
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
641
|
+
protected last: Runnable<any, RunOutput>;
|
|
642
|
+
omitSequenceTags: boolean;
|
|
643
|
+
lc_serializable: boolean;
|
|
644
|
+
lc_namespace: string[];
|
|
645
|
+
constructor(fields: RunnableSequenceFields<RunInput, RunOutput>);
|
|
646
|
+
get steps(): Runnable<any, any, RunnableConfig<Record<string, any>>>[];
|
|
647
|
+
invoke(input: RunInput, options?: RunnableConfig): Promise<RunOutput>;
|
|
648
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
|
|
649
|
+
returnExceptions?: false;
|
|
650
|
+
}): Promise<RunOutput[]>;
|
|
651
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
|
|
652
|
+
returnExceptions: true;
|
|
653
|
+
}): Promise<(RunOutput | Error)[]>;
|
|
654
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
655
|
+
_streamIterator(input: RunInput, options?: RunnableConfig): AsyncGenerator<RunOutput>;
|
|
656
|
+
getGraph(config?: RunnableConfig): Graph;
|
|
657
|
+
pipe<NewRunOutput>(coerceable: RunnableLike<RunOutput, NewRunOutput>): RunnableSequence<RunInput, Exclude<NewRunOutput, Error>>;
|
|
658
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
659
|
+
static isRunnableSequence(thing: any): thing is RunnableSequence;
|
|
660
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
661
|
+
static from<RunInput = any, RunOutput = any>([first, ...runnables]: [RunnableLike<RunInput>, ...RunnableLike[],
|
|
662
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
663
|
+
RunnableLike<any, RunOutput>], nameOrFields?: string | Omit<RunnableSequenceFields<RunInput, RunOutput>, "first" | "middle" | "last">): RunnableSequence<RunInput, Exclude<RunOutput, Error>>;
|
|
616
664
|
}
|
|
617
665
|
/**
|
|
618
666
|
* A runnable that runs a mapping of runnables in parallel,
|
|
@@ -630,36 +678,29 @@ export declare class RunnableSequence<RunInput = any, RunOutput = any> extends R
|
|
|
630
678
|
* const result = await mapChain.invoke({ topic: "bear" });
|
|
631
679
|
* ```
|
|
632
680
|
*/
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
lc_serializable: boolean;
|
|
654
|
-
lc_namespace: string[];
|
|
655
|
-
protected func: AnyTraceableFunction;
|
|
656
|
-
constructor(fields: {
|
|
657
|
-
func: AnyTraceableFunction;
|
|
658
|
-
});
|
|
659
|
-
invoke(input: RunInput, options?: Partial<RunnableConfig>): Promise<RunOutput>;
|
|
660
|
-
_streamIterator(input: RunInput, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
661
|
-
static from(func: AnyTraceableFunction): RunnableTraceable<unknown, unknown>;
|
|
681
|
+
declare class RunnableMap<
|
|
682
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
683
|
+
RunInput = any,
|
|
684
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
685
|
+
RunOutput extends Record<string, any> = Record<string, any>> extends Runnable<RunInput, RunOutput> {
|
|
686
|
+
static lc_name(): string;
|
|
687
|
+
lc_namespace: string[];
|
|
688
|
+
lc_serializable: boolean;
|
|
689
|
+
protected steps: Record<string, Runnable<RunInput>>;
|
|
690
|
+
getStepsKeys(): string[];
|
|
691
|
+
constructor(fields: {
|
|
692
|
+
steps: RunnableMapLike<RunInput, RunOutput>;
|
|
693
|
+
});
|
|
694
|
+
static from<RunInput,
|
|
695
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
696
|
+
RunOutput extends Record<string, any> = Record<string, any>>(steps: RunnableMapLike<RunInput, RunOutput>): RunnableMap<RunInput, RunOutput>;
|
|
697
|
+
invoke(input: RunInput, options?: Partial<RunnableConfig>): Promise<RunOutput>;
|
|
698
|
+
_transform(generator: AsyncGenerator<RunInput>, runManager?: CallbackManagerForChainRun, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
699
|
+
transform(generator: AsyncGenerator<RunInput>, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
700
|
+
stream(input: RunInput, options?: Partial<RunnableConfig>): Promise<IterableReadableStream<RunOutput>>;
|
|
662
701
|
}
|
|
702
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
703
|
+
|
|
663
704
|
/**
|
|
664
705
|
* A runnable that wraps an arbitrary function that takes a single argument.
|
|
665
706
|
* @example
|
|
@@ -686,20 +727,20 @@ export declare class RunnableTraceable<RunInput, RunOutput> extends Runnable<Run
|
|
|
686
727
|
* // Will log "10" (since (2 + 3) * 2 = 10)
|
|
687
728
|
* ```
|
|
688
729
|
*/
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
730
|
+
declare class RunnableLambda<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> {
|
|
731
|
+
static lc_name(): string;
|
|
732
|
+
lc_namespace: string[];
|
|
733
|
+
protected func: RunnableFunc<RunInput, RunOutput | Runnable<RunInput, RunOutput, CallOptions>, CallOptions>;
|
|
734
|
+
constructor(fields: {
|
|
735
|
+
func: RunnableFunc<RunInput, RunOutput | Runnable<RunInput, RunOutput, CallOptions>, CallOptions> | TraceableFunction<RunnableFunc<RunInput, RunOutput | Runnable<RunInput, RunOutput, CallOptions>, CallOptions>>;
|
|
736
|
+
});
|
|
737
|
+
static from<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig>(func: RunnableFunc<RunInput, RunOutput | Runnable<RunInput, RunOutput, CallOptions>, CallOptions>): RunnableLambda<RunInput, RunOutput, CallOptions>;
|
|
738
|
+
static from<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig>(func: TraceableFunction<RunnableFunc<RunInput, RunOutput | Runnable<RunInput, RunOutput, CallOptions>, CallOptions>>): RunnableLambda<RunInput, RunOutput, CallOptions>;
|
|
739
|
+
_invoke(input: RunInput, config?: Partial<CallOptions>, runManager?: CallbackManagerForChainRun): Promise<RunOutput>;
|
|
740
|
+
invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
|
|
741
|
+
_transform(generator: AsyncGenerator<RunInput>, runManager?: CallbackManagerForChainRun, config?: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
742
|
+
transform(generator: AsyncGenerator<RunInput>, options?: Partial<CallOptions>): AsyncGenerator<RunOutput>;
|
|
743
|
+
stream(input: RunInput, options?: Partial<CallOptions>): Promise<IterableReadableStream<RunOutput>>;
|
|
703
744
|
}
|
|
704
745
|
/**
|
|
705
746
|
* A runnable that runs a mapping of runnables in parallel,
|
|
@@ -734,8 +775,7 @@ export declare class RunnableLambda<RunInput, RunOutput, CallOptions extends Run
|
|
|
734
775
|
* // { years_to_fifty: 20, years_to_hundred: 70 }
|
|
735
776
|
* ```
|
|
736
777
|
*/
|
|
737
|
-
|
|
738
|
-
}
|
|
778
|
+
declare class RunnableParallel<RunInput> extends RunnableMap<RunInput> {}
|
|
739
779
|
/**
|
|
740
780
|
* A Runnable that can fallback to other Runnables if it fails.
|
|
741
781
|
* External APIs (e.g., APIs for a language model) may at times experience
|
|
@@ -804,30 +844,31 @@ export declare class RunnableParallel<RunInput> extends RunnableMap<RunInput> {
|
|
|
804
844
|
* // "Processed: safe"
|
|
805
845
|
* ```
|
|
806
846
|
*/
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
847
|
+
declare class RunnableWithFallbacks<RunInput, RunOutput> extends Runnable<RunInput, RunOutput> {
|
|
848
|
+
static lc_name(): string;
|
|
849
|
+
lc_namespace: string[];
|
|
850
|
+
lc_serializable: boolean;
|
|
851
|
+
runnable: Runnable<RunInput, RunOutput>;
|
|
852
|
+
fallbacks: Runnable<RunInput, RunOutput>[];
|
|
853
|
+
constructor(fields: {
|
|
811
854
|
runnable: Runnable<RunInput, RunOutput>;
|
|
812
855
|
fallbacks: Runnable<RunInput, RunOutput>[];
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
returnExceptions: true;
|
|
825
|
-
}): Promise<(RunOutput | Error)[]>;
|
|
826
|
-
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
856
|
+
});
|
|
857
|
+
runnables(): Generator<Runnable<RunInput, RunOutput, RunnableConfig<Record<string, any>>>, void, unknown>;
|
|
858
|
+
invoke(input: RunInput, options?: Partial<RunnableConfig>): Promise<RunOutput>;
|
|
859
|
+
_streamIterator(input: RunInput, options?: Partial<RunnableConfig> | undefined): AsyncGenerator<RunOutput>;
|
|
860
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
|
|
861
|
+
returnExceptions?: false;
|
|
862
|
+
}): Promise<RunOutput[]>;
|
|
863
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions & {
|
|
864
|
+
returnExceptions: true;
|
|
865
|
+
}): Promise<(RunOutput | Error)[]>;
|
|
866
|
+
batch(inputs: RunInput[], options?: Partial<RunnableConfig> | Partial<RunnableConfig>[], batchOptions?: RunnableBatchOptions): Promise<(RunOutput | Error)[]>;
|
|
827
867
|
}
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
868
|
+
// TODO: Figure out why the compiler needs help eliminating Error as a RunOutput type
|
|
869
|
+
declare function _coerceToRunnable<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig>(coerceable: RunnableLike<RunInput, RunOutput, CallOptions>): Runnable<RunInput, Exclude<RunOutput, Error>, CallOptions>;
|
|
870
|
+
interface RunnableAssignFields<RunInput> {
|
|
871
|
+
mapper: RunnableMap<RunInput>;
|
|
831
872
|
}
|
|
832
873
|
/**
|
|
833
874
|
* A runnable that assigns key-value pairs to inputs of type `Record<string, unknown>`.
|
|
@@ -860,19 +901,23 @@ export interface RunnableAssignFields<RunInput> {
|
|
|
860
901
|
* // { name: "Alice", birthYear: 1990, age_step: { age: 34 }, greeting_step: { greeting: "Hello, Alice!" } }
|
|
861
902
|
* ```
|
|
862
903
|
*/
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
904
|
+
declare class RunnableAssign<
|
|
905
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
906
|
+
RunInput extends Record<string, any> = Record<string, any>,
|
|
907
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
908
|
+
RunOutput extends Record<string, any> = Record<string, any>, CallOptions extends RunnableConfig = RunnableConfig> extends Runnable<RunInput, RunOutput> implements RunnableAssignFields<RunInput> {
|
|
909
|
+
static lc_name(): string;
|
|
910
|
+
lc_namespace: string[];
|
|
911
|
+
lc_serializable: boolean;
|
|
912
|
+
mapper: RunnableMap<RunInput>;
|
|
913
|
+
constructor(fields: RunnableMap<RunInput> | RunnableAssignFields<RunInput>);
|
|
914
|
+
invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
|
|
915
|
+
_transform(generator: AsyncGenerator<RunInput>, runManager?: CallbackManagerForChainRun, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
916
|
+
transform(generator: AsyncGenerator<RunInput>, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
917
|
+
stream(input: RunInput, options?: Partial<RunnableConfig>): Promise<IterableReadableStream<RunOutput>>;
|
|
873
918
|
}
|
|
874
|
-
|
|
875
|
-
|
|
919
|
+
interface RunnablePickFields {
|
|
920
|
+
keys: string | string[];
|
|
876
921
|
}
|
|
877
922
|
/**
|
|
878
923
|
* A runnable that assigns key-value pairs to inputs of type `Record<string, unknown>`.
|
|
@@ -898,30 +943,34 @@ export interface RunnablePickFields {
|
|
|
898
943
|
* // { name: 'John', city: 'New York' }
|
|
899
944
|
* ```
|
|
900
945
|
*/
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
946
|
+
declare class RunnablePick<
|
|
947
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
948
|
+
RunInput extends Record<string, any> = Record<string, any>,
|
|
949
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
950
|
+
RunOutput extends Record<string, any> | any = Record<string, any> | any, CallOptions extends RunnableConfig = RunnableConfig> extends Runnable<RunInput, RunOutput> implements RunnablePickFields {
|
|
951
|
+
static lc_name(): string;
|
|
952
|
+
lc_namespace: string[];
|
|
953
|
+
lc_serializable: boolean;
|
|
954
|
+
keys: string | string[];
|
|
955
|
+
constructor(fields: string | string[] | RunnablePickFields);
|
|
956
|
+
_pick(input: RunInput): Promise<RunOutput>;
|
|
957
|
+
invoke(input: RunInput, options?: Partial<CallOptions>): Promise<RunOutput>;
|
|
958
|
+
_transform(generator: AsyncGenerator<RunInput>): AsyncGenerator<RunOutput>;
|
|
959
|
+
transform(generator: AsyncGenerator<RunInput>, options?: Partial<RunnableConfig>): AsyncGenerator<RunOutput>;
|
|
960
|
+
stream(input: RunInput, options?: Partial<RunnableConfig>): Promise<IterableReadableStream<RunOutput>>;
|
|
912
961
|
}
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
962
|
+
interface RunnableToolLikeArgs<RunInput extends InteropZodType = InteropZodType, RunOutput = unknown> extends Omit<RunnableBindingArgs<InferInteropZodOutput<RunInput>, RunOutput>, "config"> {
|
|
963
|
+
name: string;
|
|
964
|
+
description?: string;
|
|
965
|
+
schema: RunInput;
|
|
966
|
+
config?: RunnableConfig;
|
|
918
967
|
}
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
968
|
+
declare class RunnableToolLike<RunInput extends InteropZodType = InteropZodType, RunOutput = unknown> extends RunnableBinding<InferInteropZodOutput<RunInput>, RunOutput> {
|
|
969
|
+
name: string;
|
|
970
|
+
description?: string;
|
|
971
|
+
schema: RunInput;
|
|
972
|
+
constructor(fields: RunnableToolLikeArgs<RunInput, RunOutput>);
|
|
973
|
+
static lc_name(): string;
|
|
925
974
|
}
|
|
926
975
|
/**
|
|
927
976
|
* Given a runnable and a Zod schema, convert the runnable to a tool.
|
|
@@ -936,8 +985,6 @@ export declare class RunnableToolLike<RunInput extends InteropZodType = InteropZ
|
|
|
936
985
|
* @param {InteropZodType<RunInput>} [fields.schema] The Zod schema for the input of the tool. Infers the Zod type from the input type of the runnable.
|
|
937
986
|
* @returns {RunnableToolLike<InteropZodType<RunInput>, RunOutput>} An instance of `RunnableToolLike` which is a runnable that can be used as a tool.
|
|
938
987
|
*/
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
schema: InteropZodType<RunInput>;
|
|
943
|
-
}): RunnableToolLike<InteropZodType<RunInput | ToolCall>, RunOutput>;
|
|
988
|
+
//#endregion
|
|
989
|
+
export { Runnable, RunnableAssign, RunnableBinding, RunnableBindingArgs, RunnableEach, RunnableFunc, RunnableLambda, RunnableLike, RunnableMap, RunnableMapLike, RunnableParallel, RunnablePick, RunnableRetry, RunnableRetryFailedAttemptHandler, RunnableSequence, RunnableToolLike, RunnableToolLikeArgs, RunnableWithFallbacks, _coerceToRunnable };
|
|
990
|
+
//# sourceMappingURL=base.d.ts.map
|