@langchain/core 1.1.4 → 1.1.5-dev-1765432861398
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 +1 -1
- package/dist/agents.d.cts +0 -2
- package/dist/agents.d.cts.map +1 -0
- package/dist/agents.d.ts +0 -2
- package/dist/agents.d.ts.map +1 -0
- package/dist/caches/index.d.cts.map +1 -0
- package/dist/caches/index.d.ts.map +1 -0
- package/dist/callbacks/base.cjs +1 -1
- package/dist/callbacks/base.cjs.map +1 -1
- package/dist/callbacks/base.d.cts +22 -60
- package/dist/callbacks/base.d.cts.map +1 -0
- package/dist/callbacks/base.d.ts +22 -60
- package/dist/callbacks/base.d.ts.map +1 -0
- package/dist/callbacks/base.js +1 -1
- package/dist/callbacks/base.js.map +1 -1
- package/dist/callbacks/dispatch/index.d.cts +1 -3
- package/dist/callbacks/dispatch/index.d.cts.map +1 -0
- package/dist/callbacks/dispatch/index.d.ts +1 -3
- package/dist/callbacks/dispatch/index.d.ts.map +1 -0
- package/dist/callbacks/dispatch/web.d.cts +1 -3
- package/dist/callbacks/dispatch/web.d.cts.map +1 -0
- package/dist/callbacks/dispatch/web.d.ts +1 -3
- package/dist/callbacks/dispatch/web.d.ts.map +1 -0
- package/dist/callbacks/manager.cjs +6 -6
- package/dist/callbacks/manager.cjs.map +1 -1
- package/dist/callbacks/manager.d.cts +2 -12
- package/dist/callbacks/manager.d.cts.map +1 -0
- package/dist/callbacks/manager.d.ts +2 -12
- package/dist/callbacks/manager.d.ts.map +1 -0
- package/dist/callbacks/manager.js +7 -7
- package/dist/callbacks/manager.js.map +1 -1
- package/dist/chat_history.d.cts +0 -1
- package/dist/chat_history.d.cts.map +1 -0
- package/dist/chat_history.d.ts +0 -1
- package/dist/chat_history.d.ts.map +1 -0
- package/dist/context.d.cts.map +1 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/document_loaders/base.d.cts.map +1 -0
- package/dist/document_loaders/base.d.ts.map +1 -0
- package/dist/document_loaders/langsmith.d.cts +0 -3
- package/dist/document_loaders/langsmith.d.cts.map +1 -0
- package/dist/document_loaders/langsmith.d.ts +0 -3
- package/dist/document_loaders/langsmith.d.ts.map +1 -0
- package/dist/documents/document.d.cts +3 -12
- package/dist/documents/document.d.cts.map +1 -0
- package/dist/documents/document.d.ts +3 -12
- package/dist/documents/document.d.ts.map +1 -0
- package/dist/documents/transformers.d.cts.map +1 -0
- package/dist/documents/transformers.d.ts.map +1 -0
- package/dist/embeddings.d.cts.map +1 -0
- package/dist/embeddings.d.ts.map +1 -0
- package/dist/example_selectors/base.d.cts.map +1 -0
- package/dist/example_selectors/base.d.ts.map +1 -0
- package/dist/example_selectors/conditional.d.cts.map +1 -0
- package/dist/example_selectors/conditional.d.ts.map +1 -0
- package/dist/example_selectors/length_based.d.cts +1 -1
- package/dist/example_selectors/length_based.d.cts.map +1 -0
- package/dist/example_selectors/length_based.d.ts +1 -1
- package/dist/example_selectors/length_based.d.ts.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.cts.map +1 -0
- package/dist/example_selectors/semantic_similarity.d.ts.map +1 -0
- package/dist/indexing/base.d.cts +0 -1
- package/dist/indexing/base.d.cts.map +1 -0
- package/dist/indexing/base.d.ts +0 -1
- package/dist/indexing/base.d.ts.map +1 -0
- package/dist/indexing/record_manager.d.cts +0 -1
- package/dist/indexing/record_manager.d.cts.map +1 -0
- package/dist/indexing/record_manager.d.ts +0 -1
- package/dist/indexing/record_manager.d.ts.map +1 -0
- package/dist/language_models/base.d.cts +8 -38
- package/dist/language_models/base.d.cts.map +1 -0
- package/dist/language_models/base.d.ts +8 -38
- package/dist/language_models/base.d.ts.map +1 -0
- package/dist/language_models/chat_models.d.cts +6 -33
- package/dist/language_models/chat_models.d.cts.map +1 -0
- package/dist/language_models/chat_models.d.ts +6 -33
- package/dist/language_models/chat_models.d.ts.map +1 -0
- package/dist/language_models/llms.d.cts +0 -6
- package/dist/language_models/llms.d.cts.map +1 -0
- package/dist/language_models/llms.d.ts +0 -6
- package/dist/language_models/llms.d.ts.map +1 -0
- package/dist/language_models/profile.d.cts.map +1 -0
- package/dist/language_models/profile.d.ts.map +1 -0
- package/dist/load/import_type.d.cts +0 -1
- package/dist/load/import_type.d.cts.map +1 -0
- package/dist/load/import_type.d.ts +0 -1
- package/dist/load/import_type.d.ts.map +1 -0
- package/dist/load/index.d.cts.map +1 -0
- package/dist/load/index.d.ts.map +1 -0
- package/dist/load/map_keys.d.cts +0 -1
- package/dist/load/map_keys.d.cts.map +1 -0
- package/dist/load/map_keys.d.ts +0 -1
- package/dist/load/map_keys.d.ts.map +1 -0
- package/dist/load/serializable.d.cts +0 -1
- package/dist/load/serializable.d.cts.map +1 -0
- package/dist/load/serializable.d.ts +0 -1
- package/dist/load/serializable.d.ts.map +1 -0
- package/dist/memory.d.cts +0 -3
- package/dist/memory.d.cts.map +1 -0
- package/dist/memory.d.ts +0 -3
- package/dist/memory.d.ts.map +1 -0
- package/dist/messages/ai.d.cts.map +1 -0
- package/dist/messages/ai.d.ts.map +1 -0
- package/dist/messages/base.d.cts +1 -13
- package/dist/messages/base.d.cts.map +1 -0
- package/dist/messages/base.d.ts +1 -13
- package/dist/messages/base.d.ts.map +1 -0
- package/dist/messages/chat.d.cts.map +1 -0
- package/dist/messages/chat.d.ts.map +1 -0
- package/dist/messages/content/base.d.cts.map +1 -0
- package/dist/messages/content/base.d.ts.map +1 -0
- package/dist/messages/content/data.d.cts +2 -7
- package/dist/messages/content/data.d.cts.map +1 -0
- package/dist/messages/content/data.d.ts +2 -7
- package/dist/messages/content/data.d.ts.map +1 -0
- package/dist/messages/content/index.d.cts +1 -4
- package/dist/messages/content/index.d.cts.map +1 -0
- package/dist/messages/content/index.d.ts +1 -4
- package/dist/messages/content/index.d.ts.map +1 -0
- package/dist/messages/content/multimodal.d.cts +0 -1
- package/dist/messages/content/multimodal.d.cts.map +1 -0
- package/dist/messages/content/multimodal.d.ts +0 -1
- package/dist/messages/content/multimodal.d.ts.map +1 -0
- package/dist/messages/content/tools.d.cts +0 -1
- package/dist/messages/content/tools.d.cts.map +1 -0
- package/dist/messages/content/tools.d.ts +0 -1
- package/dist/messages/content/tools.d.ts.map +1 -0
- package/dist/messages/format.d.cts.map +1 -0
- package/dist/messages/format.d.ts.map +1 -0
- package/dist/messages/function.d.cts.map +1 -0
- package/dist/messages/function.d.ts.map +1 -0
- package/dist/messages/human.d.cts.map +1 -0
- package/dist/messages/human.d.ts.map +1 -0
- package/dist/messages/message.d.cts.map +1 -0
- package/dist/messages/message.d.ts.map +1 -0
- package/dist/messages/metadata.d.cts.map +1 -0
- package/dist/messages/metadata.d.ts.map +1 -0
- package/dist/messages/modifier.d.cts.map +1 -0
- package/dist/messages/modifier.d.ts.map +1 -0
- package/dist/messages/system.d.cts.map +1 -0
- package/dist/messages/system.d.ts.map +1 -0
- package/dist/messages/tool.d.cts +2 -9
- package/dist/messages/tool.d.cts.map +1 -0
- package/dist/messages/tool.d.ts +2 -9
- package/dist/messages/tool.d.ts.map +1 -0
- package/dist/messages/transformers.d.cts +0 -3
- package/dist/messages/transformers.d.cts.map +1 -0
- package/dist/messages/transformers.d.ts +0 -3
- package/dist/messages/transformers.d.ts.map +1 -0
- package/dist/messages/utils.d.cts +2 -5
- package/dist/messages/utils.d.cts.map +1 -0
- package/dist/messages/utils.d.ts +2 -5
- package/dist/messages/utils.d.ts.map +1 -0
- package/dist/output_parsers/base.d.cts.map +1 -0
- package/dist/output_parsers/base.d.ts.map +1 -0
- package/dist/output_parsers/bytes.d.cts.map +1 -0
- package/dist/output_parsers/bytes.d.ts.map +1 -0
- package/dist/output_parsers/json.d.cts +1 -5
- package/dist/output_parsers/json.d.cts.map +1 -0
- package/dist/output_parsers/json.d.ts +1 -5
- package/dist/output_parsers/json.d.ts.map +1 -0
- package/dist/output_parsers/list.d.cts.map +1 -0
- package/dist/output_parsers/list.d.ts.map +1 -0
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +2 -6
- 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 +2 -6
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -0
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +10 -34
- 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 +10 -34
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -0
- package/dist/output_parsers/string.d.cts.map +1 -0
- package/dist/output_parsers/string.d.ts.map +1 -0
- package/dist/output_parsers/structured.d.cts.map +1 -0
- package/dist/output_parsers/structured.d.ts.map +1 -0
- package/dist/output_parsers/transform.d.cts +0 -1
- package/dist/output_parsers/transform.d.cts.map +1 -0
- package/dist/output_parsers/transform.d.ts +0 -1
- package/dist/output_parsers/transform.d.ts.map +1 -0
- package/dist/output_parsers/xml.d.cts.map +1 -0
- package/dist/output_parsers/xml.d.ts.map +1 -0
- package/dist/outputs.d.cts +0 -6
- package/dist/outputs.d.cts.map +1 -0
- package/dist/outputs.d.ts +0 -6
- package/dist/outputs.d.ts.map +1 -0
- package/dist/prompt_values.d.cts.map +1 -0
- package/dist/prompt_values.d.ts.map +1 -0
- package/dist/prompts/base.d.cts +2 -10
- package/dist/prompts/base.d.cts.map +1 -0
- package/dist/prompts/base.d.ts +2 -10
- package/dist/prompts/base.d.ts.map +1 -0
- package/dist/prompts/chat.d.cts +13 -51
- package/dist/prompts/chat.d.cts.map +1 -0
- package/dist/prompts/chat.d.ts +13 -51
- package/dist/prompts/chat.d.ts.map +1 -0
- package/dist/prompts/dict.d.cts.map +1 -0
- package/dist/prompts/dict.d.ts.map +1 -0
- package/dist/prompts/few_shot.d.cts +1 -5
- package/dist/prompts/few_shot.d.cts.map +1 -0
- package/dist/prompts/few_shot.d.ts +1 -5
- package/dist/prompts/few_shot.d.ts.map +1 -0
- package/dist/prompts/image.d.cts +2 -10
- package/dist/prompts/image.d.cts.map +1 -0
- package/dist/prompts/image.d.ts +2 -10
- package/dist/prompts/image.d.ts.map +1 -0
- package/dist/prompts/pipeline.d.cts.map +1 -0
- package/dist/prompts/pipeline.d.ts.map +1 -0
- package/dist/prompts/prompt.d.cts +4 -15
- package/dist/prompts/prompt.d.cts.map +1 -0
- package/dist/prompts/prompt.d.ts +4 -16
- package/dist/prompts/prompt.d.ts.map +1 -0
- package/dist/prompts/serde.d.cts +0 -1
- package/dist/prompts/serde.d.cts.map +1 -0
- package/dist/prompts/serde.d.ts +0 -1
- package/dist/prompts/serde.d.ts.map +1 -0
- package/dist/prompts/string.d.cts +1 -5
- package/dist/prompts/string.d.cts.map +1 -0
- package/dist/prompts/string.d.ts +1 -5
- package/dist/prompts/string.d.ts.map +1 -0
- package/dist/prompts/structured.d.cts +3 -16
- package/dist/prompts/structured.d.cts.map +1 -0
- package/dist/prompts/structured.d.ts +3 -16
- package/dist/prompts/structured.d.ts.map +1 -0
- package/dist/prompts/template.d.cts.map +1 -0
- package/dist/prompts/template.d.ts.map +1 -0
- package/dist/retrievers/document_compressors/index.d.cts +0 -1
- package/dist/retrievers/document_compressors/index.d.cts.map +1 -0
- package/dist/retrievers/document_compressors/index.d.ts +0 -1
- package/dist/retrievers/document_compressors/index.d.ts.map +1 -0
- package/dist/retrievers/index.d.cts +2 -6
- package/dist/retrievers/index.d.cts.map +1 -0
- package/dist/retrievers/index.d.ts +2 -6
- package/dist/retrievers/index.d.ts.map +1 -0
- package/dist/runnables/base.d.cts +12 -64
- package/dist/runnables/base.d.cts.map +1 -0
- package/dist/runnables/base.d.ts +12 -64
- package/dist/runnables/base.d.ts.map +1 -0
- package/dist/runnables/branch.d.cts +0 -2
- package/dist/runnables/branch.d.cts.map +1 -0
- package/dist/runnables/branch.d.ts +0 -2
- package/dist/runnables/branch.d.ts.map +1 -0
- package/dist/runnables/config.cjs +15 -1
- package/dist/runnables/config.cjs.map +1 -1
- package/dist/runnables/config.d.cts +0 -1
- package/dist/runnables/config.d.cts.map +1 -0
- package/dist/runnables/config.d.ts +0 -1
- package/dist/runnables/config.d.ts.map +1 -0
- package/dist/runnables/config.js +15 -1
- package/dist/runnables/config.js.map +1 -1
- package/dist/runnables/graph.d.cts +1 -5
- package/dist/runnables/graph.d.cts.map +1 -0
- package/dist/runnables/graph.d.ts +1 -5
- package/dist/runnables/graph.d.ts.map +1 -0
- package/dist/runnables/history.d.cts +4 -12
- package/dist/runnables/history.d.cts.map +1 -0
- package/dist/runnables/history.d.ts +4 -12
- package/dist/runnables/history.d.ts.map +1 -0
- package/dist/runnables/passthrough.d.cts +0 -2
- package/dist/runnables/passthrough.d.cts.map +1 -0
- package/dist/runnables/passthrough.d.ts +0 -2
- package/dist/runnables/passthrough.d.ts.map +1 -0
- package/dist/runnables/router.d.cts +0 -1
- package/dist/runnables/router.d.cts.map +1 -0
- package/dist/runnables/router.d.ts +0 -1
- package/dist/runnables/router.d.ts.map +1 -0
- package/dist/runnables/types.d.cts +2 -9
- package/dist/runnables/types.d.cts.map +1 -0
- package/dist/runnables/types.d.ts +2 -9
- package/dist/runnables/types.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/context.d.cts +0 -2
- package/dist/singletons/async_local_storage/context.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/context.d.ts +0 -2
- package/dist/singletons/async_local_storage/context.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.cts +0 -1
- package/dist/singletons/async_local_storage/globals.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/globals.d.ts +0 -1
- package/dist/singletons/async_local_storage/globals.d.ts.map +1 -0
- package/dist/singletons/async_local_storage/index.d.cts.map +1 -0
- package/dist/singletons/async_local_storage/index.d.ts.map +1 -0
- package/dist/singletons/callbacks.d.cts.map +1 -0
- package/dist/singletons/callbacks.d.ts.map +1 -0
- package/dist/stores.d.cts +0 -1
- package/dist/stores.d.cts.map +1 -0
- package/dist/stores.d.ts +0 -1
- package/dist/stores.d.ts.map +1 -0
- package/dist/structured_query/base.d.cts.map +1 -0
- package/dist/structured_query/base.d.ts.map +1 -0
- package/dist/structured_query/functional.d.cts.map +1 -0
- package/dist/structured_query/functional.d.ts.map +1 -0
- package/dist/structured_query/ir.d.cts.map +1 -0
- package/dist/structured_query/ir.d.ts.map +1 -0
- package/dist/structured_query/utils.d.cts +1 -4
- package/dist/structured_query/utils.d.cts.map +1 -0
- package/dist/structured_query/utils.d.ts +1 -4
- package/dist/structured_query/utils.d.ts.map +1 -0
- package/dist/tools/index.d.cts +1 -6
- package/dist/tools/index.d.cts.map +1 -0
- package/dist/tools/index.d.ts +1 -6
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/types.d.cts +3 -13
- package/dist/tools/types.d.cts.map +1 -0
- package/dist/tools/types.d.ts +3 -13
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/utils.d.cts.map +1 -0
- package/dist/tools/utils.d.ts.map +1 -0
- package/dist/tracers/base.d.cts +1 -20
- package/dist/tracers/base.d.cts.map +1 -0
- package/dist/tracers/base.d.ts +1 -20
- package/dist/tracers/base.d.ts.map +1 -0
- package/dist/tracers/console.d.cts +0 -2
- package/dist/tracers/console.d.cts.map +1 -0
- package/dist/tracers/console.d.ts +0 -2
- package/dist/tracers/console.d.ts.map +1 -0
- package/dist/tracers/event_stream.d.cts +0 -4
- package/dist/tracers/event_stream.d.cts.map +1 -0
- package/dist/tracers/event_stream.d.ts +0 -4
- package/dist/tracers/event_stream.d.ts.map +1 -0
- package/dist/tracers/log_stream.d.cts +0 -6
- package/dist/tracers/log_stream.d.cts.map +1 -0
- package/dist/tracers/log_stream.d.ts +0 -6
- package/dist/tracers/log_stream.d.ts.map +1 -0
- package/dist/tracers/run_collector.d.cts.map +1 -0
- package/dist/tracers/run_collector.d.ts.map +1 -0
- package/dist/tracers/tracer_langchain.d.cts.map +1 -0
- package/dist/tracers/tracer_langchain.d.ts.map +1 -0
- package/dist/types/_internal.d.cts +0 -3
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.ts +0 -3
- package/dist/types/_internal.d.ts.map +1 -0
- package/dist/types/type-utils.d.cts +0 -2
- package/dist/types/type-utils.d.cts.map +1 -0
- package/dist/types/type-utils.d.ts +0 -2
- package/dist/types/type-utils.d.ts.map +1 -0
- package/dist/utils/async_caller.d.cts +0 -3
- package/dist/utils/async_caller.d.cts.map +1 -0
- package/dist/utils/async_caller.d.ts +0 -3
- package/dist/utils/async_caller.d.ts.map +1 -0
- package/dist/utils/chunk_array.d.cts.map +1 -0
- package/dist/utils/chunk_array.d.ts.map +1 -0
- package/dist/utils/env.d.cts +0 -4
- package/dist/utils/env.d.cts.map +1 -0
- package/dist/utils/env.d.ts +0 -4
- package/dist/utils/env.d.ts.map +1 -0
- package/dist/utils/event_source_parse.d.cts +1 -4
- package/dist/utils/event_source_parse.d.cts.map +1 -0
- package/dist/utils/event_source_parse.d.ts +1 -4
- package/dist/utils/event_source_parse.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -0
- package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -0
- package/dist/utils/format.d.cts.map +1 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/function_calling.d.cts +1 -3
- package/dist/utils/function_calling.d.cts.map +1 -0
- package/dist/utils/function_calling.d.ts +1 -3
- package/dist/utils/function_calling.d.ts.map +1 -0
- package/dist/utils/hash.d.cts.map +1 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/js-sha256/hash.d.cts.map +1 -0
- package/dist/utils/js-sha256/hash.d.ts.map +1 -0
- package/dist/utils/json.d.cts +0 -1
- package/dist/utils/json.d.cts.map +1 -0
- package/dist/utils/json.d.ts +0 -1
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json_schema.d.cts.map +1 -0
- package/dist/utils/json_schema.d.ts.map +1 -0
- package/dist/utils/math.d.cts.map +1 -0
- package/dist/utils/math.d.ts.map +1 -0
- package/dist/utils/ml-distance/similarities.d.cts.map +1 -0
- package/dist/utils/ml-distance/similarities.d.ts.map +1 -0
- package/dist/utils/signal.d.cts.map +1 -0
- package/dist/utils/signal.d.ts.map +1 -0
- package/dist/utils/stream.d.cts +1 -13
- package/dist/utils/stream.d.cts.map +1 -0
- package/dist/utils/stream.d.ts +1 -13
- package/dist/utils/stream.d.ts.map +1 -0
- package/dist/utils/testing/chat_models.cjs +11 -5
- package/dist/utils/testing/chat_models.cjs.map +1 -1
- package/dist/utils/testing/chat_models.d.cts +11 -12
- package/dist/utils/testing/chat_models.d.cts.map +1 -0
- package/dist/utils/testing/chat_models.d.ts +11 -12
- package/dist/utils/testing/chat_models.d.ts.map +1 -0
- package/dist/utils/testing/chat_models.js +11 -5
- package/dist/utils/testing/chat_models.js.map +1 -1
- package/dist/utils/testing/embeddings.d.cts.map +1 -0
- package/dist/utils/testing/embeddings.d.ts.map +1 -0
- package/dist/utils/testing/llms.d.cts.map +1 -0
- package/dist/utils/testing/llms.d.ts.map +1 -0
- package/dist/utils/testing/message_history.d.cts.map +1 -0
- package/dist/utils/testing/message_history.d.ts.map +1 -0
- package/dist/utils/testing/output_parsers.d.cts.map +1 -0
- package/dist/utils/testing/output_parsers.d.ts.map +1 -0
- package/dist/utils/testing/retrievers.d.cts +1 -3
- package/dist/utils/testing/retrievers.d.cts.map +1 -0
- package/dist/utils/testing/retrievers.d.ts +1 -3
- package/dist/utils/testing/retrievers.d.ts.map +1 -0
- package/dist/utils/testing/runnables.d.cts.map +1 -0
- package/dist/utils/testing/runnables.d.ts.map +1 -0
- package/dist/utils/testing/tools.d.cts.map +1 -0
- package/dist/utils/testing/tools.d.ts.map +1 -0
- package/dist/utils/testing/tracers.d.cts.map +1 -0
- package/dist/utils/testing/tracers.d.ts.map +1 -0
- package/dist/utils/testing/vectorstores.d.cts +0 -1
- package/dist/utils/testing/vectorstores.d.cts.map +1 -0
- package/dist/utils/testing/vectorstores.d.ts +0 -1
- package/dist/utils/testing/vectorstores.d.ts.map +1 -0
- package/dist/utils/tiktoken.d.cts.map +1 -0
- package/dist/utils/tiktoken.d.ts.map +1 -0
- package/dist/utils/types/index.d.cts +0 -2
- package/dist/utils/types/index.d.cts.map +1 -0
- package/dist/utils/types/index.d.ts +0 -2
- package/dist/utils/types/index.d.ts.map +1 -0
- package/dist/utils/types/zod.d.cts +0 -3
- package/dist/utils/types/zod.d.cts.map +1 -0
- package/dist/utils/types/zod.d.ts +0 -3
- package/dist/utils/types/zod.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -0
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -0
- package/dist/vectorstores.d.cts +5 -17
- package/dist/vectorstores.d.cts.map +1 -0
- package/dist/vectorstores.d.ts +5 -17
- package/dist/vectorstores.d.ts.map +1 -0
- package/package.json +6 -5
- 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/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/language_models/profile.cjs +0 -1
- package/language_models/profile.d.cts +0 -1
- package/language_models/profile.d.ts +0 -1
- package/language_models/profile.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.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/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/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/format.cjs +0 -1
- package/utils/format.d.cts +0 -1
- package/utils/format.d.ts +0 -1
- package/utils/format.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.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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.cts","names":["BaseCallbackHandler","setContextVariable","T","PropertyKey","getContextVariable","_getConfigureHooks","ConfigureHook","registerConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.d.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"../../callbacks/base.js\";\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\nexport declare function setContextVariable<T>(name: PropertyKey, value: T): void;\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\nexport declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;\nexport declare const _getConfigureHooks: () => ConfigureHook[];\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport declare const registerConfigureHook: (config: ConfigureHook) => void;\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n//# sourceMappingURL=context.d.ts.map"],"mappings":";;;;;;AAmDA;AAkDA;AA+CA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAlGwBC,4BAA4BE,oBAAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkDhDE,kCAAkCD,cAAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CnDK,gCAAgCD;KACzCA,aAAAA;;;yCAG+BN"}
|
|
@@ -102,7 +102,6 @@ declare function setContextVariable<T>(name: PropertyKey, value: T): void;
|
|
|
102
102
|
*
|
|
103
103
|
* @param name The name of the context variable.
|
|
104
104
|
*/
|
|
105
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
106
105
|
declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;
|
|
107
106
|
/**
|
|
108
107
|
* Register a callback configure hook to automatically add callback handlers to all runs.
|
|
@@ -153,7 +152,6 @@ declare const registerConfigureHook: (config: ConfigureHook) => void;
|
|
|
153
152
|
type ConfigureHook = {
|
|
154
153
|
contextVar?: string;
|
|
155
154
|
inheritable?: boolean;
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
157
155
|
handlerClass?: new (...args: any[]) => BaseCallbackHandler;
|
|
158
156
|
envVar?: string;
|
|
159
157
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","names":["BaseCallbackHandler","setContextVariable","T","PropertyKey","getContextVariable","_getConfigureHooks","ConfigureHook","registerConfigureHook"],"sources":["../../../src/singletons/async_local_storage/context.d.ts"],"sourcesContent":["import { BaseCallbackHandler } from \"../../callbacks/base.js\";\n/**\n * Set a context variable. Context variables are scoped to any\n * child runnables called by the current runnable, or globally if set outside\n * of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n * @param value The value to set.\n */\nexport declare function setContextVariable<T>(name: PropertyKey, value: T): void;\n/**\n * Get the value of a previously set context variable. Context variables\n * are scoped to any child runnables called by the current runnable,\n * or globally if set outside of any runnable.\n *\n * @remarks\n * This function is only supported in environments that support AsyncLocalStorage,\n * including Node.js, Deno, and Cloudflare Workers.\n *\n * @example\n * ```ts\n * import { RunnableLambda } from \"@langchain/core/runnables\";\n * import {\n * getContextVariable,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const nested = RunnableLambda.from(() => {\n * // \"bar\" because it was set by a parent\n * console.log(getContextVariable(\"foo\"));\n *\n * // Override to \"baz\", but only for child runnables\n * setContextVariable(\"foo\", \"baz\");\n *\n * // Now \"baz\", but only for child runnables\n * return getContextVariable(\"foo\");\n * });\n *\n * const runnable = RunnableLambda.from(async () => {\n * // Set a context variable named \"foo\"\n * setContextVariable(\"foo\", \"bar\");\n *\n * const res = await nested.invoke({});\n *\n * // Still \"bar\" since child changes do not affect parents\n * console.log(getContextVariable(\"foo\"));\n *\n * return res;\n * });\n *\n * // undefined, because context variable has not been set yet\n * console.log(getContextVariable(\"foo\"));\n *\n * // Final return value is \"baz\"\n * const result = await runnable.invoke({});\n * ```\n *\n * @param name The name of the context variable.\n */\nexport declare function getContextVariable<T = any>(name: PropertyKey): T | undefined;\nexport declare const _getConfigureHooks: () => ConfigureHook[];\n/**\n * Register a callback configure hook to automatically add callback handlers to all runs.\n *\n * There are two ways to use this:\n *\n * 1. Using a context variable:\n * - Set `contextVar` to specify the variable name\n * - Use `setContextVariable()` to store your handler instance\n *\n * 2. Using an environment variable:\n * - Set both `envVar` and `handlerClass`\n * - The handler will be instantiated when the env var is set to \"true\".\n *\n * @example\n * ```typescript\n * // Method 1: Using context variable\n * import {\n * registerConfigureHook,\n * setContextVariable\n * } from \"@langchain/core/context\";\n *\n * const tracer = new MyCallbackHandler();\n * registerConfigureHook({\n * contextVar: \"my_tracer\",\n * });\n * setContextVariable(\"my_tracer\", tracer);\n *\n * // ...run code here\n *\n * // Method 2: Using environment variable\n * registerConfigureHook({\n * handlerClass: MyCallbackHandler,\n * envVar: \"MY_TRACER_ENABLED\",\n * });\n * process.env.MY_TRACER_ENABLED = \"true\";\n *\n * // ...run code here\n * ```\n *\n * @param config Configuration object for the hook\n * @param config.contextVar Name of the context variable containing the handler instance\n * @param config.inheritable Whether child runs should inherit this handler\n * @param config.handlerClass Optional callback handler class (required if using envVar)\n * @param config.envVar Optional environment variable name to control handler activation\n */\nexport declare const registerConfigureHook: (config: ConfigureHook) => void;\nexport type ConfigureHook = {\n contextVar?: string;\n inheritable?: boolean;\n handlerClass?: new (...args: any[]) => BaseCallbackHandler;\n envVar?: string;\n};\n//# sourceMappingURL=context.d.ts.map"],"mappings":";;;;;;AAmDA;AAkDA;AA+CA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAlGwBC,4BAA4BE,oBAAoBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkDhDE,kCAAkCD,cAAcD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA+CnDK,gCAAgCD;KACzCA,aAAAA;;;yCAG+BN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.cts","names":["AsyncLocalStorageInterface","T","TRACING_ALS_KEY","_CONTEXT_VARIABLES_KEY","setGlobalAsyncLocalStorageInstance","getGlobalAsyncLocalStorageInstance"],"sources":["../../../src/singletons/async_local_storage/globals.d.ts"],"sourcesContent":["export interface AsyncLocalStorageInterface {\n getStore: () => any | undefined;\n run: <T>(store: any, callback: () => T) => T;\n enterWith: (store: any) => void;\n}\nexport declare const TRACING_ALS_KEY: unique symbol;\nexport declare const _CONTEXT_VARIABLES_KEY: unique symbol;\nexport declare const setGlobalAsyncLocalStorageInstance: (instance: AsyncLocalStorageInterface) => void;\nexport declare const getGlobalAsyncLocalStorageInstance: () => AsyncLocalStorageInterface | undefined;\n//# sourceMappingURL=globals.d.ts.map"],"mappings":";UAAiBA,0BAAAA;EAAAA,QAAAA,EAAAA,GAAAA,GAAAA,GAAAA,GAAAA,SAA0B;EAMtBG,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,EAAAA,GAAAA,EAAAA,QAAqC,EAAA,GAAA,GAJjBF,CAIiB,EAAA,GAJXA,CAIW;;;cAArCE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"globals.d.ts","names":["AsyncLocalStorageInterface","T","TRACING_ALS_KEY","_CONTEXT_VARIABLES_KEY","setGlobalAsyncLocalStorageInstance","getGlobalAsyncLocalStorageInstance"],"sources":["../../../src/singletons/async_local_storage/globals.d.ts"],"sourcesContent":["export interface AsyncLocalStorageInterface {\n getStore: () => any | undefined;\n run: <T>(store: any, callback: () => T) => T;\n enterWith: (store: any) => void;\n}\nexport declare const TRACING_ALS_KEY: unique symbol;\nexport declare const _CONTEXT_VARIABLES_KEY: unique symbol;\nexport declare const setGlobalAsyncLocalStorageInstance: (instance: AsyncLocalStorageInterface) => void;\nexport declare const getGlobalAsyncLocalStorageInstance: () => AsyncLocalStorageInterface | undefined;\n//# sourceMappingURL=globals.d.ts.map"],"mappings":";UAAiBA,0BAAAA;EAAAA,QAAAA,EAAAA,GAAAA,GAAAA,GAAAA,GAAAA,SAA0B;EAMtBG,GAAAA,EAAAA,CAAAA,CAAAA,CAAAA,CAAAA,KAAAA,EAAAA,GAAAA,EAAAA,QAAqC,EAAA,GAAA,GAJjBF,CAIiB,EAAA,GAJXA,CAIW;;;cAArCE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["AsyncLocalStorageInterface","MockAsyncLocalStorage","T","AsyncLocalStorageProvider","AsyncLocalStorageProviderSingleton"],"sources":["../../../src/singletons/async_local_storage/index.d.ts"],"sourcesContent":["import { AsyncLocalStorageInterface } from \"./globals.js\";\nexport declare class MockAsyncLocalStorage implements AsyncLocalStorageInterface {\n getStore(): any;\n run<T>(_store: any, callback: () => T): T;\n enterWith(_store: any): undefined;\n}\ndeclare class AsyncLocalStorageProvider {\n getInstance(): AsyncLocalStorageInterface;\n getRunnableConfig(): any;\n runWithConfig<T>(config: any, callback: () => T, avoidCreatingRootRunTree?: boolean): T;\n initializeGlobalInstance(instance: AsyncLocalStorageInterface): void;\n}\ndeclare const AsyncLocalStorageProviderSingleton: AsyncLocalStorageProvider;\nexport { AsyncLocalStorageProviderSingleton, type AsyncLocalStorageInterface };\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;cACqBC,qBAAAA,YAAiCD;;EAAjCC,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,GAAAA,EAAAA,QAAqB,EAAAC,GAAAA,GAEFA,CAFE,CAAA,EAEEA,CAFF;EAEFA,SAAAA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,SAAAA;;cAG1BC,yBAAAA,CALwCH;EAA0B,WAAA,CAAA,CAAA,EAM7DA,0BAN6D;EAKlEG,iBAAAA,CAAAA,CAAAA,EAAAA,GAAAA;EACKH,aAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,GAAAA,EAAAA,QAAAA,EAAAA,GAAAA,GAE+BE,CAF/BF,EAAAA,wBAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAEuEE,CAFvEF;EAE+BE,wBAAAA,CAAAA,QAAAA,EACXF,0BADWE,CAAAA,EAAAA,IAAAA;;cAGpCE,kCAFyBJ,EAEWG,yBAFXH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["AsyncLocalStorageInterface","MockAsyncLocalStorage","T","AsyncLocalStorageProvider","AsyncLocalStorageProviderSingleton"],"sources":["../../../src/singletons/async_local_storage/index.d.ts"],"sourcesContent":["import { AsyncLocalStorageInterface } from \"./globals.js\";\nexport declare class MockAsyncLocalStorage implements AsyncLocalStorageInterface {\n getStore(): any;\n run<T>(_store: any, callback: () => T): T;\n enterWith(_store: any): undefined;\n}\ndeclare class AsyncLocalStorageProvider {\n getInstance(): AsyncLocalStorageInterface;\n getRunnableConfig(): any;\n runWithConfig<T>(config: any, callback: () => T, avoidCreatingRootRunTree?: boolean): T;\n initializeGlobalInstance(instance: AsyncLocalStorageInterface): void;\n}\ndeclare const AsyncLocalStorageProviderSingleton: AsyncLocalStorageProvider;\nexport { AsyncLocalStorageProviderSingleton, type AsyncLocalStorageInterface };\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;cACqBC,qBAAAA,YAAiCD;;EAAjCC,GAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,GAAAA,EAAAA,QAAqB,EAAAC,GAAAA,GAEFA,CAFE,CAAA,EAEEA,CAFF;EAEFA,SAAAA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA,EAAAA,SAAAA;;cAG1BC,yBAAAA,CALwCH;EAA0B,WAAA,CAAA,CAAA,EAM7DA,0BAN6D;EAKlEG,iBAAAA,CAAAA,CAAAA,EAAAA,GAAAA;EACKH,aAAAA,CAAAA,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA,GAAAA,EAAAA,QAAAA,EAAAA,GAAAA,GAE+BE,CAF/BF,EAAAA,wBAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAEuEE,CAFvEF;EAE+BE,wBAAAA,CAAAA,QAAAA,EACXF,0BADWE,CAAAA,EAAAA,IAAAA;;cAGpCE,kCAFyBJ,EAEWG,yBAFXH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.cts","names":["PQueueMod","getQueue","consumeCallback","T","Promise","awaitAllCallbacks"],"sources":["../../src/singletons/callbacks.d.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\nexport declare function getQueue(): PQueueMod<any, any>;\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport declare function consumeCallback<T>(promiseFn: () => Promise<T> | T | void, wait: boolean): Promise<void>;\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport declare function awaitAllCallbacks(): Promise<void>;\n//# sourceMappingURL=callbacks.d.ts.map"],"mappings":";;;;;;AAO0G;AAKlFK,iBALAH,eAKqBE,CAAAA,CAAAA,CAAAA,CAAAA,SAAO,EAAA,GAAA,GALQA,OAKR,CALgBD,CAKhB,CAAA,GALqBA,CAKrB,GAAA,IAAA,EAAA,IAAA,EAAA,OAAA,CAAA,EAL+CC,OAK/C,CAAA,IAAA,CAAA;;;;;iBAA5BC,iBAAAA,CAAAA,GAAqBD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callbacks.d.ts","names":["PQueueMod","getQueue","consumeCallback","T","Promise","awaitAllCallbacks"],"sources":["../../src/singletons/callbacks.d.ts"],"sourcesContent":["import PQueueMod from \"p-queue\";\nexport declare function getQueue(): PQueueMod<any, any>;\n/**\n * Consume a promise, either adding it to the queue or waiting for it to resolve\n * @param promiseFn Promise to consume\n * @param wait Whether to wait for the promise to resolve or resolve immediately\n */\nexport declare function consumeCallback<T>(promiseFn: () => Promise<T> | T | void, wait: boolean): Promise<void>;\n/**\n * Waits for all promises in the queue to resolve. If the queue is\n * undefined, it immediately resolves a promise.\n */\nexport declare function awaitAllCallbacks(): Promise<void>;\n//# sourceMappingURL=callbacks.d.ts.map"],"mappings":";;;;;AAOA;;;;AAAmGI,iBAA3EF,eAA2EE,CAAAA,CAAAA,CAAAA,CAAAA,SAAAA,EAAAA,GAAAA,GAAvCA,OAAuCA,CAA/BD,CAA+BC,CAAAA,GAA1BD,CAA0BC,GAAAA,IAAAA,EAAAA,IAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,CAAAA,IAAAA,CAAAA;AAAO;AAK1G;;;iBAAwBC,iBAAAA,CAAAA,GAAqBD"}
|
package/dist/stores.d.cts
CHANGED
|
@@ -50,7 +50,6 @@ declare abstract class BaseStore<K, V> extends Serializable {
|
|
|
50
50
|
* await store.mdelete(await store.yieldKeys("message:id:").toArray());
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
53
|
declare class InMemoryStore<T = any> extends BaseStore<string, T> {
|
|
55
54
|
lc_namespace: string[];
|
|
56
55
|
protected store: Record<string, T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stores.d.cts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAaC,EAAA,CAjCAL,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
|
package/dist/stores.d.ts
CHANGED
|
@@ -50,7 +50,6 @@ declare abstract class BaseStore<K, V> extends Serializable {
|
|
|
50
50
|
* await store.mdelete(await store.yieldKeys("message:id:").toArray());
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
53
|
declare class InMemoryStore<T = any> extends BaseStore<string, T> {
|
|
55
54
|
lc_namespace: string[];
|
|
56
55
|
protected store: Record<string, T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stores.d.ts","names":["Serializable","BaseStore","K","V","Promise","AsyncGenerator","InMemoryStore","T","Record"],"sources":["../src/stores.d.ts"],"sourcesContent":["import { Serializable } from \"./load/serializable.js\";\n/**\n * Abstract interface for a key-value store.\n */\nexport declare abstract class BaseStore<K, V> extends Serializable {\n /**\n * Abstract method to get multiple values for a set of keys.\n * @param {K[]} keys - An array of keys.\n * @returns {Promise<(V | undefined)[]>} - A Promise that resolves with array of values or undefined if key not found.\n */\n abstract mget(keys: K[]): Promise<(V | undefined)[]>;\n /**\n * Abstract method to set a value for multiple keys.\n * @param {[K, V][]} keyValuePairs - An array of key-value pairs.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mset(keyValuePairs: [K, V][]): Promise<void>;\n /**\n * Abstract method to delete multiple keys.\n * @param {K[]} keys - An array of keys to delete.\n * @returns {Promise<void>} - A Promise that resolves when the operation is complete.\n */\n abstract mdelete(keys: K[]): Promise<void>;\n /**\n * Abstract method to yield keys optionally based on a prefix.\n * @param {string} prefix - Optional prefix to filter keys.\n * @returns {AsyncGenerator<K | string>} - An asynchronous generator that yields keys on iteration.\n */\n abstract yieldKeys(prefix?: string): AsyncGenerator<K | string>;\n}\n/**\n * In-memory implementation of the BaseStore using a dictionary. Used for\n * storing key-value pairs in memory.\n * @example\n * ```typescript\n * const store = new InMemoryStore<BaseMessage>();\n * await store.mset(\n * Array.from({ length: 5 }).map((_, index) => [\n * `message:id:${index}`,\n * index % 2 === 0\n * ? new AIMessage(\"ai stuff...\")\n * : new HumanMessage(\"human stuff...\"),\n * ]),\n * );\n *\n * const retrievedMessages = await store.mget([\"message:id:0\", \"message:id:1\"]);\n * await store.mdelete(await store.yieldKeys(\"message:id:\").toArray());\n * ```\n */\nexport declare class InMemoryStore<T = any> extends BaseStore<string, T> {\n lc_namespace: string[];\n protected store: Record<string, T>;\n /**\n * Retrieves the values associated with the given keys from the store.\n * @param keys Keys to retrieve values for.\n * @returns Array of values associated with the given keys.\n */\n mget(keys: string[]): Promise<T[]>;\n /**\n * Sets the values for the given keys in the store.\n * @param keyValuePairs Array of key-value pairs to set in the store.\n * @returns Promise that resolves when all key-value pairs have been set.\n */\n mset(keyValuePairs: [string, T][]): Promise<void>;\n /**\n * Deletes the given keys and their associated values from the store.\n * @param keys Keys to delete from the store.\n * @returns Promise that resolves when all keys have been deleted.\n */\n mdelete(keys: string[]): Promise<void>;\n /**\n * Asynchronous generator that yields keys from the store. If a prefix is\n * provided, it only yields keys that start with the prefix.\n * @param prefix Optional prefix to filter keys.\n * @returns AsyncGenerator that yields keys from the store.\n */\n yieldKeys(prefix?: string | undefined): AsyncGenerator<string>;\n}\n//# sourceMappingURL=stores.d.ts.map"],"mappings":";;;;;;AAIA;AAMwBE,uBANMD,SAMNC,CAAAA,CAAAA,EAAAA,CAAAA,CAAAA,SAN8BF,YAAAA,CAM9BE;EAAeC;;;;;EAYZD,SAAAA,IAAAA,CAAAA,IAAAA,EAZHA,CAYGA,EAAAA,CAAAA,EAZGE,OAYHF,CAAAA,CAZYC,CAYZD,GAAAA,SAAAA,CAAAA,EAAAA,CAAAA;EAAME;;;;AAlBiC;EA6C7CE,SAAAA,IAAAA,CAAAA,aAAaC,EAAA,CAjCAL,CAiCA,EAjCGC,CAiCH,CAAA,EAAA,CAAA,EAjCUC,OAiCV,CAAA,IAAA,CAAA;EAAoCG;;;;;EAcrCA,SAAAA,OAAAA,CAAAA,IAAAA,EAzCNL,CAyCMK,EAAAA,CAAAA,EAzCAH,OAyCAG,CAAAA,IAAAA,CAAAA;EAAOH;;;;AAdqB;uCArBpBC,eAAeH;;;;;;;;;;;;;;;;;;;;;cAqBnCI,+BAA+BL,kBAAkBM;;mBAEjDC,eAAeD;;;;;;wBAMVH,QAAQG;;;;;;+BAMDA,OAAOH;;;;;;2BAMXA;;;;;;;0CAOeC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["VectorStore","Comparator","Comparison","Operation","Operator","StructuredQuery","Visitor","VisitorComparisonResult","VisitorOperationResult","VisitorStructuredQueryResult","TranslatorOpts","BaseTranslator","T","BasicTranslator"],"sources":["../../src/structured_query/base.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\nimport { Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, VisitorComparisonResult, VisitorOperationResult, VisitorStructuredQueryResult } from \"./ir.js\";\n/**\n * Options object for the BasicTranslator class. Specifies the allowed\n * operators and comparators.\n */\nexport type TranslatorOpts = {\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n};\n/**\n * Abstract class that provides a blueprint for creating specific\n * translator classes. Defines two abstract methods: formatFunction and\n * mergeFilters.\n */\nexport declare abstract class BaseTranslator<T extends VectorStore = VectorStore> extends Visitor<T> {\n /**\n * Formats a given function (either an operator or a comparator) into a\n * string.\n * @param func The function to format.\n * @returns Formatted string representation of the function.\n */\n abstract formatFunction(func: Operator | Comparator): string;\n /**\n * Merges two filters into one, using a specified merge type.\n * @param defaultFilter The default filter.\n * @param generatedFilter The generated filter.\n * @param mergeType The type of merge to perform. Can be 'and', 'or', or 'replace'.\n * @param forceDefaultFilter If true, the default filter will be used even if the generated filter is not empty.\n * @returns The merged filter, or undefined if both filters are empty.\n */\n abstract mergeFilters(defaultFilter: this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined, generatedFilter: this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined, mergeType?: \"and\" | \"or\" | \"replace\", forceDefaultFilter?: boolean): this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined;\n}\n/**\n * Class that extends the BaseTranslator class and provides concrete\n * implementations for the abstract methods. Also declares three types:\n * VisitOperationOutput, VisitComparisonOutput, and\n * VisitStructuredQueryOutput, which are used as the return types for the\n * visitOperation, visitComparison, and visitStructuredQuery methods\n * respectively.\n */\nexport declare class BasicTranslator<T extends VectorStore = VectorStore> extends BaseTranslator<T> {\n VisitOperationOutput: VisitorOperationResult;\n VisitComparisonOutput: VisitorComparisonResult;\n VisitStructuredQueryOutput: VisitorStructuredQueryResult;\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n constructor(opts?: TranslatorOpts);\n formatFunction(func: Operator | Comparator): string;\n /**\n * Visits an operation and returns a result.\n * @param operation The operation to visit.\n * @returns The result of visiting the operation.\n */\n visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n /**\n * Visits a comparison and returns a result.\n * @param comparison The comparison to visit.\n * @returns The result of visiting the comparison.\n */\n visitComparison(comparison: Comparison): this[\"VisitComparisonOutput\"];\n /**\n * Visits a structured query and returns a result.\n * @param query The structured query to visit.\n * @returns The result of visiting the structured query.\n */\n visitStructuredQuery(query: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n mergeFilters(defaultFilter: VisitorStructuredQueryResult[\"filter\"] | undefined, generatedFilter: VisitorStructuredQueryResult[\"filter\"] | undefined, mergeType?: string, forceDefaultFilter?: boolean): VisitorStructuredQueryResult[\"filter\"] | undefined;\n}\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;AAMA;AASA;AAAuDA,KAT3CU,cAAAA,GAS2CV;EAAcA,gBAAAA,EAR/CI,QAQ+CJ,EAAAA;EAA6BY,kBAAAA,EAP1EX,UAO0EW,EAAAA;CAOhER;;;AAP+D;AA0BjG;;AAA6DJ,uBA1B/BW,cA0B+BX,CAAAA,UA1BNA,WA0BMA,GA1BQA,WA0BRA,CAAAA,SA1B6BM,OA0B7BN,CA1BqCY,CA0BrCZ,CAAAA,CAAAA;EAAoCY;;;;;;EAM1EF,SAAAA,cAAAA,CAAAA,IAAAA,EAzBWN,QAyBXM,GAzBsBT,UAyBtBS,CAAAA,EAAAA,MAAAA;EACEN;;;;;;;;EAPyDO,SAAAA,YAAAA,CAAAA,aAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA,EAAAA,eAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA,EAAAA,SAAAA,CAAAA,EAAAA,KAAAA,GAAAA,IAAAA,GAAAA,SAAAA,EAAAA,kBAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA;AAAc;;;;;;;;;cAA3EE,0BAA0Bb,cAAcA,qBAAqBW,eAAeC;wBACvEJ;yBACCD;8BACKE;oBACVL;sBACEH;qBACDS;uBACEN,WAAWH;;;;;;4BAMNE;;;;;;8BAMED;;;;;;8BAMAG;8BACAI,qEAAqEA,uGAAuGA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":["VectorStore","Comparator","Comparison","Operation","Operator","StructuredQuery","Visitor","VisitorComparisonResult","VisitorOperationResult","VisitorStructuredQueryResult","TranslatorOpts","BaseTranslator","T","BasicTranslator"],"sources":["../../src/structured_query/base.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\nimport { Comparator, Comparison, Operation, Operator, StructuredQuery, Visitor, VisitorComparisonResult, VisitorOperationResult, VisitorStructuredQueryResult } from \"./ir.js\";\n/**\n * Options object for the BasicTranslator class. Specifies the allowed\n * operators and comparators.\n */\nexport type TranslatorOpts = {\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n};\n/**\n * Abstract class that provides a blueprint for creating specific\n * translator classes. Defines two abstract methods: formatFunction and\n * mergeFilters.\n */\nexport declare abstract class BaseTranslator<T extends VectorStore = VectorStore> extends Visitor<T> {\n /**\n * Formats a given function (either an operator or a comparator) into a\n * string.\n * @param func The function to format.\n * @returns Formatted string representation of the function.\n */\n abstract formatFunction(func: Operator | Comparator): string;\n /**\n * Merges two filters into one, using a specified merge type.\n * @param defaultFilter The default filter.\n * @param generatedFilter The generated filter.\n * @param mergeType The type of merge to perform. Can be 'and', 'or', or 'replace'.\n * @param forceDefaultFilter If true, the default filter will be used even if the generated filter is not empty.\n * @returns The merged filter, or undefined if both filters are empty.\n */\n abstract mergeFilters(defaultFilter: this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined, generatedFilter: this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined, mergeType?: \"and\" | \"or\" | \"replace\", forceDefaultFilter?: boolean): this[\"VisitStructuredQueryOutput\"][\"filter\"] | undefined;\n}\n/**\n * Class that extends the BaseTranslator class and provides concrete\n * implementations for the abstract methods. Also declares three types:\n * VisitOperationOutput, VisitComparisonOutput, and\n * VisitStructuredQueryOutput, which are used as the return types for the\n * visitOperation, visitComparison, and visitStructuredQuery methods\n * respectively.\n */\nexport declare class BasicTranslator<T extends VectorStore = VectorStore> extends BaseTranslator<T> {\n VisitOperationOutput: VisitorOperationResult;\n VisitComparisonOutput: VisitorComparisonResult;\n VisitStructuredQueryOutput: VisitorStructuredQueryResult;\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n constructor(opts?: TranslatorOpts);\n formatFunction(func: Operator | Comparator): string;\n /**\n * Visits an operation and returns a result.\n * @param operation The operation to visit.\n * @returns The result of visiting the operation.\n */\n visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n /**\n * Visits a comparison and returns a result.\n * @param comparison The comparison to visit.\n * @returns The result of visiting the comparison.\n */\n visitComparison(comparison: Comparison): this[\"VisitComparisonOutput\"];\n /**\n * Visits a structured query and returns a result.\n * @param query The structured query to visit.\n * @returns The result of visiting the structured query.\n */\n visitStructuredQuery(query: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n mergeFilters(defaultFilter: VisitorStructuredQueryResult[\"filter\"] | undefined, generatedFilter: VisitorStructuredQueryResult[\"filter\"] | undefined, mergeType?: string, forceDefaultFilter?: boolean): VisitorStructuredQueryResult[\"filter\"] | undefined;\n}\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;AAMA;AASA;AAAuDA,KAT3CU,cAAAA,GAS2CV;EAAcA,gBAAAA,EAR/CI,QAQ+CJ,EAAAA;EAA6BY,kBAAAA,EAP1EX,UAO0EW,EAAAA;CAOhER;;;AAP+D;AA0BjG;;AAA6DJ,uBA1B/BW,cA0B+BX,CAAAA,UA1BNA,WA0BMA,GA1BQA,WA0BRA,CAAAA,SA1B6BM,OA0B7BN,CA1BqCY,CA0BrCZ,CAAAA,CAAAA;EAAoCY;;;;;;EAM1EF,SAAAA,cAAAA,CAAAA,IAAAA,EAzBWN,QAyBXM,GAzBsBT,UAyBtBS,CAAAA,EAAAA,MAAAA;EACEN;;;;;;;;EAPyDO,SAAAA,YAAAA,CAAAA,aAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA,EAAAA,eAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA,EAAAA,SAAAA,CAAAA,EAAAA,KAAAA,GAAAA,IAAAA,GAAAA,SAAAA,EAAAA,kBAAAA,CAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,CAAAA,4BAAAA,CAAAA,CAAAA,QAAAA,CAAAA,GAAAA,SAAAA;AAAc;;;;;;;;;cAA3EE,0BAA0Bb,cAAcA,qBAAqBW,eAAeC;wBACvEJ;yBACCD;8BACKE;oBACVL;sBACEH;qBACDS;uBACEN,WAAWH;;;;;;4BAMNE;;;;;;8BAMED;;;;;;8BAMAG;8BACAI,qEAAqEA,uGAAuGA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.d.cts","names":["Document","Comparator","Comparison","Operation","Operator","StructuredQuery","BaseTranslator","ValueType","FunctionFilter","FunctionalTranslator","C"],"sources":["../../src/structured_query/functional.d.ts"],"sourcesContent":["import { Document } from \"../documents/document.js\";\nimport { Comparator, Comparison, Operation, Operator, StructuredQuery } from \"./ir.js\";\nimport { BaseTranslator } from \"./base.js\";\n/**\n * A type alias for an object that maps comparison operators to string or\n * number values. This is used in the comparison functions to determine\n * the result of a comparison operation.\n */\ntype ValueType = {\n eq: string | number | boolean;\n ne: string | number | boolean;\n lt: string | number;\n lte: string | number;\n gt: string | number;\n gte: string | number;\n};\n/**\n * A type alias for a function that takes a `Document` as an argument and\n * returns a boolean. This function is used as a filter for documents.\n */\nexport type FunctionFilter = (document: Document) => boolean;\n/**\n * A class that extends `BaseTranslator` to translate structured queries\n * into functional filters.\n * @example\n * ```typescript\n * const functionalTranslator = new FunctionalTranslator();\n * const relevantDocuments = await functionalTranslator.getRelevantDocuments(\n * \"Which movies are rated higher than 8.5?\",\n * );\n * ```\n */\nexport declare class FunctionalTranslator extends BaseTranslator {\n VisitOperationOutput: FunctionFilter;\n VisitComparisonOutput: FunctionFilter;\n VisitStructuredQueryOutput: {\n filter: FunctionFilter;\n } | {\n [k: string]: never;\n };\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n formatFunction(): string;\n /**\n * Returns the allowed comparators for a given data type.\n * @param input The input value to get the allowed comparators for.\n * @returns An array of allowed comparators for the input data type.\n */\n getAllowedComparatorsForType(inputType: string): Comparator[];\n /**\n * Returns a function that performs a comparison based on the provided\n * comparator.\n * @param comparator The comparator to base the comparison function on.\n * @returns A function that takes two arguments and returns a boolean based on the comparison.\n */\n getComparatorFunction<C extends Comparator>(comparator: Comparator): (a: string | number, b: ValueType[C]) => boolean;\n /**\n * Returns a function that performs an operation based on the provided\n * operator.\n * @param operator The operator to base the operation function on.\n * @returns A function that takes two boolean arguments and returns a boolean based on the operation.\n */\n getOperatorFunction(operator: Operator): (a: boolean, b: boolean) => boolean;\n /**\n * Visits the operation part of a structured query and translates it into\n * a functional filter.\n * @param operation The operation part of a structured query.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the operation.\n */\n visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n /**\n * Visits the comparison part of a structured query and translates it into\n * a functional filter.\n * @param comparison The comparison part of a structured query.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the comparison.\n */\n visitComparison(comparison: Comparison<string | number | boolean>): this[\"VisitComparisonOutput\"];\n /**\n * Visits a structured query and translates it into a functional filter.\n * @param query The structured query to translate.\n * @returns An object containing a `filter` property, which is a function that takes a `Document` as an argument and returns a boolean based on the structured query.\n */\n visitStructuredQuery(query: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n /**\n * Merges two filters into one, based on the specified merge type.\n * @param defaultFilter The default filter function.\n * @param generatedFilter The generated filter function.\n * @param mergeType The type of merge to perform. Can be 'and', 'or', or 'replace'. Default is 'and'.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the merged filters, or `undefined` if both filters are empty.\n */\n mergeFilters(defaultFilter: FunctionFilter, generatedFilter: FunctionFilter, mergeType?: string): FunctionFilter | undefined;\n}\nexport {};\n//# sourceMappingURL=functional.d.ts.map"],"mappings":";;;;;;;;AAE2C;AAkB3C;AAYA;KAxBKO,SAAAA,GAyBqBC;EACCA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA;EAEXA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA;EAIMJ,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EACEH,GAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EAO6BA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EAOjBA,GAAAA,EAAAA,MAAAA,GAAAA,MAAAA;CAAwBA;;;;;AAqB5BC,KAxDpBM,cAAAA,GAwDoBN,CAAAA,QAAAA,EAxDQF,QAwDRE,EAAAA,GAAAA,OAAAA;;;;;;AA5CgC;;;;;;cAA3CO,oBAAAA,SAA6BH,cAAAA;wBACxBE;yBACCA;;YAEXA;;;;oBAIMJ;sBACEH;;;;;;;mDAO6BA;;;;;;;kCAOjBA,wBAAwBA,qCAAqCM,UAAUG;;;;;;;gCAOzEN;;;;;;;4BAOJD;;;;;;;8BAOED;;;;;;8BAMAG;;;;;;;;8BAQAG,iCAAiCA,qCAAqCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functional.d.ts","names":["Document","Comparator","Comparison","Operation","Operator","StructuredQuery","BaseTranslator","ValueType","FunctionFilter","FunctionalTranslator","C"],"sources":["../../src/structured_query/functional.d.ts"],"sourcesContent":["import { Document } from \"../documents/document.js\";\nimport { Comparator, Comparison, Operation, Operator, StructuredQuery } from \"./ir.js\";\nimport { BaseTranslator } from \"./base.js\";\n/**\n * A type alias for an object that maps comparison operators to string or\n * number values. This is used in the comparison functions to determine\n * the result of a comparison operation.\n */\ntype ValueType = {\n eq: string | number | boolean;\n ne: string | number | boolean;\n lt: string | number;\n lte: string | number;\n gt: string | number;\n gte: string | number;\n};\n/**\n * A type alias for a function that takes a `Document` as an argument and\n * returns a boolean. This function is used as a filter for documents.\n */\nexport type FunctionFilter = (document: Document) => boolean;\n/**\n * A class that extends `BaseTranslator` to translate structured queries\n * into functional filters.\n * @example\n * ```typescript\n * const functionalTranslator = new FunctionalTranslator();\n * const relevantDocuments = await functionalTranslator.getRelevantDocuments(\n * \"Which movies are rated higher than 8.5?\",\n * );\n * ```\n */\nexport declare class FunctionalTranslator extends BaseTranslator {\n VisitOperationOutput: FunctionFilter;\n VisitComparisonOutput: FunctionFilter;\n VisitStructuredQueryOutput: {\n filter: FunctionFilter;\n } | {\n [k: string]: never;\n };\n allowedOperators: Operator[];\n allowedComparators: Comparator[];\n formatFunction(): string;\n /**\n * Returns the allowed comparators for a given data type.\n * @param input The input value to get the allowed comparators for.\n * @returns An array of allowed comparators for the input data type.\n */\n getAllowedComparatorsForType(inputType: string): Comparator[];\n /**\n * Returns a function that performs a comparison based on the provided\n * comparator.\n * @param comparator The comparator to base the comparison function on.\n * @returns A function that takes two arguments and returns a boolean based on the comparison.\n */\n getComparatorFunction<C extends Comparator>(comparator: Comparator): (a: string | number, b: ValueType[C]) => boolean;\n /**\n * Returns a function that performs an operation based on the provided\n * operator.\n * @param operator The operator to base the operation function on.\n * @returns A function that takes two boolean arguments and returns a boolean based on the operation.\n */\n getOperatorFunction(operator: Operator): (a: boolean, b: boolean) => boolean;\n /**\n * Visits the operation part of a structured query and translates it into\n * a functional filter.\n * @param operation The operation part of a structured query.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the operation.\n */\n visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n /**\n * Visits the comparison part of a structured query and translates it into\n * a functional filter.\n * @param comparison The comparison part of a structured query.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the comparison.\n */\n visitComparison(comparison: Comparison<string | number | boolean>): this[\"VisitComparisonOutput\"];\n /**\n * Visits a structured query and translates it into a functional filter.\n * @param query The structured query to translate.\n * @returns An object containing a `filter` property, which is a function that takes a `Document` as an argument and returns a boolean based on the structured query.\n */\n visitStructuredQuery(query: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n /**\n * Merges two filters into one, based on the specified merge type.\n * @param defaultFilter The default filter function.\n * @param generatedFilter The generated filter function.\n * @param mergeType The type of merge to perform. Can be 'and', 'or', or 'replace'. Default is 'and'.\n * @returns A function that takes a `Document` as an argument and returns a boolean based on the merged filters, or `undefined` if both filters are empty.\n */\n mergeFilters(defaultFilter: FunctionFilter, generatedFilter: FunctionFilter, mergeType?: string): FunctionFilter | undefined;\n}\nexport {};\n//# sourceMappingURL=functional.d.ts.map"],"mappings":";;;;;;;;AAE2C;AAkB3C;AAYA;KAxBKO,SAAAA,GAyBqBC;EACCA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA;EAEXA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA,GAAAA,OAAAA;EAIMJ,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EACEH,GAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EAO6BA,EAAAA,EAAAA,MAAAA,GAAAA,MAAAA;EAOjBA,GAAAA,EAAAA,MAAAA,GAAAA,MAAAA;CAAwBA;;;;;AAqB5BC,KAxDpBM,cAAAA,GAwDoBN,CAAAA,QAAAA,EAxDQF,QAwDRE,EAAAA,GAAAA,OAAAA;;;;;;AA5CgC;;;;;;cAA3CO,oBAAAA,SAA6BH,cAAAA;wBACxBE;yBACCA;;YAEXA;;;;oBAIMJ;sBACEH;;;;;;;mDAO6BA;;;;;;;kCAOjBA,wBAAwBA,qCAAqCM,UAAUG;;;;;;;gCAOzEN;;;;;;;4BAOJD;;;;;;;8BAOED;;;;;;8BAMAG;;;;;;;;8BAQAG,iCAAiCA,qCAAqCA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.cts","names":["VectorStore","AND","OR","NOT","Operator","EQ","NE","LT","GT","LTE","GTE","Comparator","Operators","Comparators","VisitorResult","VisitorOperationResult","VisitorComparisonResult","VisitorStructuredQueryResult","Visitor","T","Operation","Comparison","StructuredQuery","Expression","FilterDirective","ValueTypes"],"sources":["../../src/structured_query/ir.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\n/**\n * Represents logical AND operator.\n */\nexport type AND = \"and\";\n/**\n * Represents logical OR operator.\n */\nexport type OR = \"or\";\n/**\n * Represents logical NOT operator.\n */\nexport type NOT = \"not\";\n/**\n * Represents a logical operator which can be AND, OR, or NOT.\n */\nexport type Operator = AND | OR | NOT;\n/**\n * Represents equality comparison operator.\n */\nexport type EQ = \"eq\";\n/**\n * Represents inequality comparison operator.\n */\nexport type NE = \"ne\";\n/**\n * Represents less than comparison operator.\n */\nexport type LT = \"lt\";\n/**\n * Represents greater than comparison operator.\n */\nexport type GT = \"gt\";\n/**\n * Represents less than or equal to comparison operator.\n */\nexport type LTE = \"lte\";\n/**\n * Represents greater than or equal to comparison operator.\n */\nexport type GTE = \"gte\";\n/**\n * Represents a comparison operator which can be EQ, NE, LT, GT, LTE, or\n * GTE.\n */\nexport type Comparator = EQ | NE | LT | GT | LTE | GTE;\nexport declare const Operators: {\n [key: string]: Operator;\n};\nexport declare const Comparators: {\n [key: string]: Comparator;\n};\n/**\n * Represents the result of visiting an operation or comparison\n * expression.\n */\nexport type VisitorResult = VisitorOperationResult | VisitorComparisonResult;\n/**\n * Represents the result of visiting an operation expression.\n */\nexport type VisitorOperationResult = {\n [operator: string]: VisitorResult[];\n};\n/**\n * Represents the result of visiting a comparison expression.\n */\nexport type VisitorComparisonResult = {\n [attr: string]: {\n [comparator: string]: string | number | boolean;\n };\n};\n/**\n * Represents the result of visiting a structured query expression.\n */\nexport type VisitorStructuredQueryResult = {\n filter?: VisitorComparisonResult | VisitorOperationResult;\n};\n/**\n * Abstract class for visiting expressions. Subclasses must implement\n * visitOperation, visitComparison, and visitStructuredQuery methods.\n */\nexport declare abstract class Visitor<T extends VectorStore = VectorStore> {\n VisitOperationOutput: object;\n VisitComparisonOutput: object;\n VisitStructuredQueryOutput: {\n filter?: T[\"FilterType\"];\n };\n abstract allowedOperators: Operator[];\n abstract allowedComparators: Comparator[];\n abstract visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n abstract visitComparison(comparison: Comparison): this[\"VisitComparisonOutput\"];\n abstract visitStructuredQuery(structuredQuery: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n}\n/**\n * Abstract class representing an expression. Subclasses must implement\n * the exprName property and the accept method.\n */\nexport declare abstract class Expression {\n abstract exprName: \"Operation\" | \"Comparison\" | \"StructuredQuery\";\n accept(visitor: Visitor): object;\n}\n/**\n * Abstract class representing a filter directive. It extends the\n * Expression class.\n */\nexport declare abstract class FilterDirective extends Expression {\n}\n/**\n * Class representing a comparison filter directive. It extends the\n * FilterDirective class.\n */\nexport declare class Comparison<ValueTypes = string | number> extends FilterDirective {\n comparator: Comparator;\n attribute: string;\n value: ValueTypes;\n exprName: \"Comparison\";\n constructor(comparator: Comparator, attribute: string, value: ValueTypes);\n}\n/**\n * Class representing an operation filter directive. It extends the\n * FilterDirective class.\n */\nexport declare class Operation extends FilterDirective {\n operator: Operator;\n args?: FilterDirective[] | undefined;\n exprName: \"Operation\";\n constructor(operator: Operator, args?: FilterDirective[] | undefined);\n}\n/**\n * Class representing a structured query expression. It extends the\n * Expression class.\n */\nexport declare class StructuredQuery extends Expression {\n query: string;\n filter?: FilterDirective | undefined;\n exprName: \"StructuredQuery\";\n constructor(query: string, filter?: FilterDirective | undefined);\n}\n//# sourceMappingURL=ir.d.ts.map"],"mappings":";;;;;;AAIA;AAIYE,KAJAD,GAAAA,GAIE,KAAA;AAId;AAIA;;AAA6BC,KARjBA,EAAAA,GAQiBA,IAAAA;;AAAQ;AAIrC;AAIYI,KAZAH,GAAAA,GAYE,KAAA;AAId;AAIA;AAIA;AAIYO,KAxBAN,QAAAA,GAAWH,GAwBR,GAxBcC,EAwBd,GAxBmBC,GAwBnB;AAKf;;;AAAmCI,KAzBvBF,EAAAA,GAyBuBE,IAAAA;;;;AAAmB,KArB1CD,EAAAA,GAqB0C,IAAA;AACtD;AAGA;AAOA;AAIYS,KAhCAR,EAAAA,GAgCAQ,IAAAA;AAMZ;AAQA;AAOA;AAAgDf,KAjDpCQ,EAAAA,GAiDoCR,IAAAA;;;;AAOfW,KApDrBF,GAAAA,GAoDqBE,KAAAA;;;;AAGiC,KAnDtDD,GAAAA,GAmDsD,KAAA;AAMlE;AAQA;AAMA;;AAGWe,KArECd,UAAAA,GAAaN,EAqEdoB,GArEmBnB,EAqEnBmB,GArEwBlB,EAqExBkB,GArE6BjB,EAqE7BiB,GArEkChB,GAqElCgB,GArEwCf,GAqExCe;AAEiBd,cAtEPC,SAsEOD,EAAAA;EAAsCc,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EArE/CrB,QAqE+CqB;CALID;AAAe,cA9DhEX,WA8DgE,EAAA;EAWhEO,CAAAA,GAAAA,EAAAA,MAAS,CAAA,EAxEXT,UAwEW;CAChBP;;;;;AADwC,KAlE1CU,aAAAA,GAAgBC,sBAkE0B,GAlEDC,uBAkEC;AAUtD;;;AAA6CO,KAxEjCR,sBAAAA,GAwEiCQ;EAAU,CAAA,QAAA,EAAA,MAAA,CAAA,EAvE/BT,aAuE+B,EAAA;;;;;KAlE3CE,uBAAAA;;;;;;;;KAQAC,4BAAAA;WACCD,0BAA0BD;;;;;;uBAMTG,kBAAkBlB,cAAcA;;;;aAI7CmB;;6BAEcf;+BACEO;qCACMS;uCACEC;iDACUC;;;;;;uBAMrBC,UAAAA;;kBAEVL;;;;;;uBAMUM,eAAAA,SAAwBD,UAAU;;;;;cAM3CF,iDAAiDG,eAAAA;cACtDb;;SAELc;;0BAEiBd,sCAAsCc;;;;;;cAM7CL,SAAAA,SAAkBI,eAAAA;YACzBpB;SACHoB;;wBAEepB,iBAAiBoB;;;;;;cAMtBF,eAAAA,SAAwBC,UAAAA;;WAEhCC;;sCAE2BA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ir.d.ts","names":["VectorStore","AND","OR","NOT","Operator","EQ","NE","LT","GT","LTE","GTE","Comparator","Operators","Comparators","VisitorResult","VisitorOperationResult","VisitorComparisonResult","VisitorStructuredQueryResult","Visitor","T","Operation","Comparison","StructuredQuery","Expression","FilterDirective","ValueTypes"],"sources":["../../src/structured_query/ir.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\n/**\n * Represents logical AND operator.\n */\nexport type AND = \"and\";\n/**\n * Represents logical OR operator.\n */\nexport type OR = \"or\";\n/**\n * Represents logical NOT operator.\n */\nexport type NOT = \"not\";\n/**\n * Represents a logical operator which can be AND, OR, or NOT.\n */\nexport type Operator = AND | OR | NOT;\n/**\n * Represents equality comparison operator.\n */\nexport type EQ = \"eq\";\n/**\n * Represents inequality comparison operator.\n */\nexport type NE = \"ne\";\n/**\n * Represents less than comparison operator.\n */\nexport type LT = \"lt\";\n/**\n * Represents greater than comparison operator.\n */\nexport type GT = \"gt\";\n/**\n * Represents less than or equal to comparison operator.\n */\nexport type LTE = \"lte\";\n/**\n * Represents greater than or equal to comparison operator.\n */\nexport type GTE = \"gte\";\n/**\n * Represents a comparison operator which can be EQ, NE, LT, GT, LTE, or\n * GTE.\n */\nexport type Comparator = EQ | NE | LT | GT | LTE | GTE;\nexport declare const Operators: {\n [key: string]: Operator;\n};\nexport declare const Comparators: {\n [key: string]: Comparator;\n};\n/**\n * Represents the result of visiting an operation or comparison\n * expression.\n */\nexport type VisitorResult = VisitorOperationResult | VisitorComparisonResult;\n/**\n * Represents the result of visiting an operation expression.\n */\nexport type VisitorOperationResult = {\n [operator: string]: VisitorResult[];\n};\n/**\n * Represents the result of visiting a comparison expression.\n */\nexport type VisitorComparisonResult = {\n [attr: string]: {\n [comparator: string]: string | number | boolean;\n };\n};\n/**\n * Represents the result of visiting a structured query expression.\n */\nexport type VisitorStructuredQueryResult = {\n filter?: VisitorComparisonResult | VisitorOperationResult;\n};\n/**\n * Abstract class for visiting expressions. Subclasses must implement\n * visitOperation, visitComparison, and visitStructuredQuery methods.\n */\nexport declare abstract class Visitor<T extends VectorStore = VectorStore> {\n VisitOperationOutput: object;\n VisitComparisonOutput: object;\n VisitStructuredQueryOutput: {\n filter?: T[\"FilterType\"];\n };\n abstract allowedOperators: Operator[];\n abstract allowedComparators: Comparator[];\n abstract visitOperation(operation: Operation): this[\"VisitOperationOutput\"];\n abstract visitComparison(comparison: Comparison): this[\"VisitComparisonOutput\"];\n abstract visitStructuredQuery(structuredQuery: StructuredQuery): this[\"VisitStructuredQueryOutput\"];\n}\n/**\n * Abstract class representing an expression. Subclasses must implement\n * the exprName property and the accept method.\n */\nexport declare abstract class Expression {\n abstract exprName: \"Operation\" | \"Comparison\" | \"StructuredQuery\";\n accept(visitor: Visitor): object;\n}\n/**\n * Abstract class representing a filter directive. It extends the\n * Expression class.\n */\nexport declare abstract class FilterDirective extends Expression {\n}\n/**\n * Class representing a comparison filter directive. It extends the\n * FilterDirective class.\n */\nexport declare class Comparison<ValueTypes = string | number> extends FilterDirective {\n comparator: Comparator;\n attribute: string;\n value: ValueTypes;\n exprName: \"Comparison\";\n constructor(comparator: Comparator, attribute: string, value: ValueTypes);\n}\n/**\n * Class representing an operation filter directive. It extends the\n * FilterDirective class.\n */\nexport declare class Operation extends FilterDirective {\n operator: Operator;\n args?: FilterDirective[] | undefined;\n exprName: \"Operation\";\n constructor(operator: Operator, args?: FilterDirective[] | undefined);\n}\n/**\n * Class representing a structured query expression. It extends the\n * Expression class.\n */\nexport declare class StructuredQuery extends Expression {\n query: string;\n filter?: FilterDirective | undefined;\n exprName: \"StructuredQuery\";\n constructor(query: string, filter?: FilterDirective | undefined);\n}\n//# sourceMappingURL=ir.d.ts.map"],"mappings":";;;;;;AAIA;AAIYE,KAJAD,GAAAA,GAIE,KAAA;AAId;AAIA;;AAA6BC,KARjBA,EAAAA,GAQiBA,IAAAA;;AAAQ;AAIrC;AAIYI,KAZAH,GAAAA,GAYE,KAAA;AAId;AAIA;AAIA;AAIYO,KAxBAN,QAAAA,GAAWH,GAwBR,GAxBcC,EAwBd,GAxBmBC,GAwBnB;AAKf;;;AAAmCI,KAzBvBF,EAAAA,GAyBuBE,IAAAA;;;;AAAmB,KArB1CD,EAAAA,GAqB0C,IAAA;AACtD;AAGA;AAOA;AAIYS,KAhCAR,EAAAA,GAgCAQ,IAAAA;AAMZ;AAQA;AAOA;AAAgDf,KAjDpCQ,EAAAA,GAiDoCR,IAAAA;;;;AAOfW,KApDrBF,GAAAA,GAoDqBE,KAAAA;;;;AAGiC,KAnDtDD,GAAAA,GAmDsD,KAAA;AAMlE;AAQA;AAMA;;AAGWe,KArECd,UAAAA,GAAaN,EAqEdoB,GArEmBnB,EAqEnBmB,GArEwBlB,EAqExBkB,GArE6BjB,EAqE7BiB,GArEkChB,GAqElCgB,GArEwCf,GAqExCe;AAEiBd,cAtEPC,SAsEOD,EAAAA;EAAsCc,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EArE/CrB,QAqE+CqB;CALID;AAAe,cA9DhEX,WA8DgE,EAAA;EAWhEO,CAAAA,GAAAA,EAAAA,MAAS,CAAA,EAxEXT,UAwEW;CAChBP;;;;;AADwC,KAlE1CU,aAAAA,GAAgBC,sBAkE0B,GAlEDC,uBAkEC;AAUtD;;;AAA6CO,KAxEjCR,sBAAAA,GAwEiCQ;EAAU,CAAA,QAAA,EAAA,MAAA,CAAA,EAvE/BT,aAuE+B,EAAA;;;;;KAlE3CE,uBAAAA;;;;;;;;KAQAC,4BAAAA;WACCD,0BAA0BD;;;;;;uBAMTG,kBAAkBlB,cAAcA;;;;aAI7CmB;;6BAEcf;+BACEO;qCACMS;uCACEC;iDACUC;;;;;;uBAMrBC,UAAAA;;kBAEVL;;;;;;uBAMUM,eAAAA,SAAwBD,UAAU;;;;;cAM3CF,iDAAiDG,eAAAA;cACtDb;;SAELc;;0BAEiBd,sCAAsCc;;;;;;cAM7CL,SAAAA,SAAkBI,eAAAA;YACzBpB;SACHoB;;wBAEepB,iBAAiBoB;;;;;;cAMtBF,eAAAA,SAAwBC,UAAAA;;WAEhCC;;sCAE2BA"}
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the provided argument is an object and not an array.
|
|
4
4
|
*/
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
5
|
declare function isObject(obj: any): obj is object;
|
|
7
6
|
/**
|
|
8
7
|
* Checks if a provided filter is empty. The filter can be a function, an
|
|
9
8
|
* object, a string, or undefined.
|
|
10
9
|
*/
|
|
11
|
-
declare function isFilterEmpty(
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
filter: ((q: any) => any) | object | string | undefined): filter is undefined;
|
|
10
|
+
declare function isFilterEmpty(filter: ((q: any) => any) | object | string | undefined): filter is undefined;
|
|
14
11
|
/**
|
|
15
12
|
* Checks if the provided value is an integer.
|
|
16
13
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.cts","names":["isObject","isFilterEmpty","isInt","isFloat","isString","isBoolean","castValue"],"sources":["../../src/structured_query/utils.d.ts"],"sourcesContent":["/**\n * Checks if the provided argument is an object and not an array.\n */\nexport declare function isObject(obj: any): obj is object;\n/**\n * Checks if a provided filter is empty. The filter can be a function, an\n * object, a string, or undefined.\n */\nexport declare function isFilterEmpty(filter: ((q: any) => any) | object | string | undefined): filter is undefined;\n/**\n * Checks if the provided value is an integer.\n */\nexport declare function isInt(value: unknown): boolean;\n/**\n * Checks if the provided value is a floating-point number.\n */\nexport declare function isFloat(value: unknown): boolean;\n/**\n * Checks if the provided value is a string that cannot be parsed into a\n * number.\n */\nexport declare function isString(value: unknown): boolean;\n/**\n * Checks if the provided value is a boolean.\n */\nexport declare function isBoolean(value: unknown): boolean;\n/**\n * Casts a value that might be string or number to actual string or number.\n * Since LLM might return back an integer/float as a string, we need to cast\n * it back to a number, as many vector databases can't handle number as string\n * values as a comparator.\n */\nexport declare function castValue(input: unknown): string | number | boolean;\n//# sourceMappingURL=utils.d.ts.map"],"mappings":";;AAGA;AAKA;AAIwBE,iBATAF,QAAAA,CASK,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,MAAA;AAI7B;AAKA;AAIA;AAOA;iBAxBwBC,aAAAA;;;;iBAIAC,KAAAA;;;;iBAIAC,OAAAA;;;;;iBAKAC,QAAAA;;;;iBAIAC,SAAAA;;;;;;;iBAOAC,SAAAA"}
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the provided argument is an object and not an array.
|
|
4
4
|
*/
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
5
|
declare function isObject(obj: any): obj is object;
|
|
7
6
|
/**
|
|
8
7
|
* Checks if a provided filter is empty. The filter can be a function, an
|
|
9
8
|
* object, a string, or undefined.
|
|
10
9
|
*/
|
|
11
|
-
declare function isFilterEmpty(
|
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
13
|
-
filter: ((q: any) => any) | object | string | undefined): filter is undefined;
|
|
10
|
+
declare function isFilterEmpty(filter: ((q: any) => any) | object | string | undefined): filter is undefined;
|
|
14
11
|
/**
|
|
15
12
|
* Checks if the provided value is an integer.
|
|
16
13
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","names":["isObject","isFilterEmpty","isInt","isFloat","isString","isBoolean","castValue"],"sources":["../../src/structured_query/utils.d.ts"],"sourcesContent":["/**\n * Checks if the provided argument is an object and not an array.\n */\nexport declare function isObject(obj: any): obj is object;\n/**\n * Checks if a provided filter is empty. The filter can be a function, an\n * object, a string, or undefined.\n */\nexport declare function isFilterEmpty(filter: ((q: any) => any) | object | string | undefined): filter is undefined;\n/**\n * Checks if the provided value is an integer.\n */\nexport declare function isInt(value: unknown): boolean;\n/**\n * Checks if the provided value is a floating-point number.\n */\nexport declare function isFloat(value: unknown): boolean;\n/**\n * Checks if the provided value is a string that cannot be parsed into a\n * number.\n */\nexport declare function isString(value: unknown): boolean;\n/**\n * Checks if the provided value is a boolean.\n */\nexport declare function isBoolean(value: unknown): boolean;\n/**\n * Casts a value that might be string or number to actual string or number.\n * Since LLM might return back an integer/float as a string, we need to cast\n * it back to a number, as many vector databases can't handle number as string\n * values as a comparator.\n */\nexport declare function castValue(input: unknown): string | number | boolean;\n//# sourceMappingURL=utils.d.ts.map"],"mappings":";;AAGA;AAKA;AAIwBE,iBATAF,QAAAA,CASK,GAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAA,MAAA;AAI7B;AAKA;AAIA;AAOA;iBAxBwBC,aAAAA;;;;iBAIAC,KAAAA;;;;iBAIAC,OAAAA;;;;;iBAKAC,QAAAA;;;;iBAIAC,SAAAA;;;;;;;iBAOAC,SAAAA"}
|
package/dist/tools/index.d.cts
CHANGED
|
@@ -94,7 +94,6 @@ declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool
|
|
|
94
94
|
* @param callbacks Optional callbacks for the tool.
|
|
95
95
|
* @returns A Promise that resolves with a string.
|
|
96
96
|
*/
|
|
97
|
-
// Match the base class signature including the generics and conditional return type
|
|
98
97
|
call<TArg extends string | undefined | z.input<this["schema"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
99
98
|
}
|
|
100
99
|
/**
|
|
@@ -111,9 +110,7 @@ declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT
|
|
|
111
110
|
*/
|
|
112
111
|
call<TArg extends string | undefined | z.input<this["schema"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
113
112
|
/** @ignore */
|
|
114
|
-
_call(input: string,
|
|
115
|
-
// DynamicTool's _call specifically expects a string after schema transformation
|
|
116
|
-
runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;
|
|
113
|
+
_call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;
|
|
117
114
|
}
|
|
118
115
|
/**
|
|
119
116
|
* A tool that can be created dynamically from a function, name, and
|
|
@@ -134,7 +131,6 @@ declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT
|
|
|
134
131
|
/**
|
|
135
132
|
* @deprecated Use .invoke() instead. Will be removed in 0.3.0.
|
|
136
133
|
*/
|
|
137
|
-
// Match the base class signature
|
|
138
134
|
call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, /** @deprecated */
|
|
139
135
|
tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
140
136
|
protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>["func"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;
|
|
@@ -212,7 +208,6 @@ declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZ
|
|
|
212
208
|
declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
213
209
|
declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
214
210
|
declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;
|
|
215
|
-
// Overloads with ToolRuntime as CallOptions
|
|
216
211
|
declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
217
212
|
declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
218
213
|
declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport type ServerTool = Record<string, unknown>;\nexport type ClientTool = StructuredToolInterface | DynamicTool | RunnableToolLike;\n//# sourceMappingURL=index.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;AAiB+IqB,uBAAjHoB,cAAiHpB,C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PzMzD,EAOiN0D,QAPjN1D,CAAAA,EAAAA,GAO+NuC,WAP/NvC,GAO6OyC,OAP7OzC,CAOqPuC,WAPrPvC,CAAAA,EAAAA,MAAAA,EAO2QsD,iBAP3QtD,CAO6RoC,OAP7RpC,CAAAA,CAAAA,EAOwSmD,qBAPxSnD,CAO8ToC,OAP9TpC,EAOuUqC,aAPvUrC,EAOsVsC,YAPtVtC,EAOoWuC,WAPpWvC,CAAAA;AAA6CqB,KAQ1JsC,UAAAA,GAAanB,MAR6InB,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AAAmCgB,KAS7LuB,UAAAA,GAAa5C,uBATgLqB,GAStJa,WATsJb,GASxIvC,gBATwIuC"}
|
package/dist/tools/index.d.ts
CHANGED
|
@@ -96,7 +96,6 @@ declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool
|
|
|
96
96
|
* @param callbacks Optional callbacks for the tool.
|
|
97
97
|
* @returns A Promise that resolves with a string.
|
|
98
98
|
*/
|
|
99
|
-
// Match the base class signature including the generics and conditional return type
|
|
100
99
|
call<TArg extends string | undefined | z.input<this["schema"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
101
100
|
}
|
|
102
101
|
/**
|
|
@@ -113,9 +112,7 @@ declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT
|
|
|
113
112
|
*/
|
|
114
113
|
call<TArg extends string | undefined | z.input<this["schema"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
115
114
|
/** @ignore */
|
|
116
|
-
_call(input: string,
|
|
117
|
-
// DynamicTool's _call specifically expects a string after schema transformation
|
|
118
|
-
runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;
|
|
115
|
+
_call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;
|
|
119
116
|
}
|
|
120
117
|
/**
|
|
121
118
|
* A tool that can be created dynamically from a function, name, and
|
|
@@ -136,7 +133,6 @@ declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT
|
|
|
136
133
|
/**
|
|
137
134
|
* @deprecated Use .invoke() instead. Will be removed in 0.3.0.
|
|
138
135
|
*/
|
|
139
|
-
// Match the base class signature
|
|
140
136
|
call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, /** @deprecated */
|
|
141
137
|
tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
142
138
|
protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>["func"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;
|
|
@@ -214,7 +210,6 @@ declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZ
|
|
|
214
210
|
declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
215
211
|
declare function tool<SchemaT extends JsonSchema7Type, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>["func"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
216
212
|
declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JsonSchema7Type = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;
|
|
217
|
-
// Overloads with ToolRuntime as CallOptions
|
|
218
213
|
declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
219
214
|
declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;
|
|
220
215
|
declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["z","CallbackManagerForToolRun","BaseLangChain","RunnableConfig","RunnableFunc","ToolCall","ToolMessage","RunnableToolLike","ToolInputParsingException","InferInteropZodInput","InferInteropZodOutput","InteropZodObject","InteropZodType","ZodStringV3","ZodStringV4","ZodObjectV3","ZodObjectV4","StructuredToolCallInput","ToolInputSchemaBase","ToolReturnType","ResponseFormat","ToolInputSchemaInputType","ToolInputSchemaOutputType","ToolParams","ToolRunnableConfig","StructuredToolInterface","DynamicToolInput","DynamicStructuredToolInput","StringInputToolSchema","ToolInterface","ToolOutputType","ToolRuntime","JSONSchema","BaseDynamicToolInput","ContentAndArtifact","StructuredToolParams","ToolSchemaBase","isLangChainTool","isRunnableToolLike","isStructuredTool","isStructuredToolParams","StructuredTool","TInput","TConfig","TArg","SchemaT","SchemaOutputT","SchemaInputT","ToolOutputT","Record","Promise","Tool","ZodString","ZodOptional","ZodTypeAny","ZodObject","ZodEffects","input","NonNullable","DynamicTool","DynamicStructuredTool","Parameters","BaseToolkit","ToolWrapperParams","RunInput","tool","TState","TContext","ServerTool","ClientTool"],"sources":["../../src/tools/index.d.ts"],"sourcesContent":["import { z } from \"zod/v3\";\nimport { CallbackManagerForToolRun } from \"../callbacks/manager.js\";\nimport { BaseLangChain } from \"../language_models/base.js\";\nimport { type RunnableConfig } from \"../runnables/config.js\";\nimport type { RunnableFunc } from \"../runnables/base.js\";\nimport { ToolCall, ToolMessage } from \"../messages/tool.js\";\nimport type { RunnableToolLike } from \"../runnables/base.js\";\nimport { ToolInputParsingException } from \"./utils.js\";\nimport { type InferInteropZodInput, type InferInteropZodOutput, type InteropZodObject, type InteropZodType, type ZodStringV3, type ZodStringV4, type ZodObjectV3, type ZodObjectV4 } from \"../utils/types/zod.js\";\nimport type { StructuredToolCallInput, ToolInputSchemaBase, ToolReturnType, ResponseFormat, ToolInputSchemaInputType, ToolInputSchemaOutputType, ToolParams, ToolRunnableConfig, StructuredToolInterface, DynamicToolInput, DynamicStructuredToolInput, StringInputToolSchema, ToolInterface, ToolOutputType, ToolRuntime } from \"./types.js\";\nimport { type JSONSchema } from \"../utils/json_schema.js\";\nexport type { BaseDynamicToolInput, ContentAndArtifact, DynamicToolInput, DynamicStructuredToolInput, ResponseFormat, StructuredToolCallInput, StructuredToolInterface, StructuredToolParams, ToolInterface, ToolParams, ToolReturnType, ToolRunnableConfig, ToolInputSchemaBase as ToolSchemaBase, } from \"./types.js\";\nexport { isLangChainTool, isRunnableToolLike, isStructuredTool, isStructuredToolParams, type ToolRuntime, } from \"./types.js\";\nexport { ToolInputParsingException };\n/**\n * Base class for Tools that accept input of any shape defined by a Zod schema.\n */\nexport declare abstract class StructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends BaseLangChain<StructuredToolCallInput<SchemaT, SchemaInputT>, ToolOutputT | ToolMessage> implements StructuredToolInterface<SchemaT, SchemaInputT, ToolOutputT> {\n abstract name: string;\n abstract description: string;\n abstract schema: SchemaT;\n /**\n * Optional provider-specific extra fields for the tool.\n *\n * This is used to pass provider-specific configuration that doesn't fit into\n * standard tool fields.\n */\n extras?: Record<string, unknown>;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect: boolean;\n verboseParsingErrors: boolean;\n get lc_namespace(): string[];\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Default config object for the tool runnable.\n */\n defaultConfig?: ToolRunnableConfig;\n constructor(fields?: ToolParams);\n protected abstract _call(arg: SchemaOutputT, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n /**\n * Invokes the tool with the provided input and configuration.\n * @param input The input for the tool.\n * @param config Optional configuration for the tool.\n * @returns A Promise that resolves with the tool's output.\n */\n invoke<TInput extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(input: TInput, config?: TConfig): Promise<ToolReturnType<TInput, TConfig, ToolOutputT>>;\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument, configuration, and tags. It\n * parses the input according to the schema, handles any errors, and\n * manages callbacks.\n * @param arg The input argument for the tool.\n * @param configArg Optional configuration or callbacks for the tool.\n * @param tags Optional tags for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<TArg, TConfig, ToolOutputT>>;\n}\n/**\n * Base class for Tools that accept input as a string.\n */\nexport declare abstract class Tool<ToolOutputT = ToolOutputType> extends StructuredTool<StringInputToolSchema, ToolInputSchemaOutputType<StringInputToolSchema>, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> implements ToolInterface<StringInputToolSchema, ToolInputSchemaInputType<StringInputToolSchema>, ToolOutputT> {\n schema: z.ZodEffects<z.ZodObject<{\n input: z.ZodOptional<z.ZodString>;\n }, \"strip\", z.ZodTypeAny, {\n input?: string | undefined;\n }, {\n input?: string | undefined;\n }>, string | undefined, {\n input?: string | undefined;\n }>;\n constructor(fields?: ToolParams);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n *\n * Calls the tool with the provided argument and callbacks. It handles\n * string inputs specifically.\n * @param arg The input argument for the tool, which can be a string, undefined, or an input of the tool's schema.\n * @param callbacks Optional callbacks for the tool.\n * @returns A Promise that resolves with a string.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and description.\n */\nexport declare class DynamicTool<ToolOutputT = ToolOutputType> extends Tool<ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicToolInput<ToolOutputT>[\"func\"];\n constructor(fields: DynamicToolInput<ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends string | undefined | z.input<this[\"schema\"]> | ToolCall, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n /** @ignore */\n _call(input: string, runManager?: CallbackManagerForToolRun, parentConfig?: ToolRunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * A tool that can be created dynamically from a function, name, and\n * description, designed to work with structured data. It extends the\n * StructuredTool class and overrides the _call method to execute the\n * provided function when the tool is called.\n *\n * Schema can be passed as Zod or JSON schema. The tool will not validate\n * input if JSON schema is passed.\n */\nexport declare class DynamicStructuredTool<SchemaT = ToolInputSchemaBase, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType> extends StructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> {\n static lc_name(): string;\n name: string;\n description: string;\n func: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>[\"func\"];\n schema: SchemaT;\n constructor(fields: DynamicStructuredToolInput<SchemaT, SchemaOutputT, ToolOutputT>);\n /**\n * @deprecated Use .invoke() instead. Will be removed in 0.3.0.\n */\n call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, configArg?: TConfig, \n /** @deprecated */\n tags?: string[]): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;\n protected _call(arg: Parameters<DynamicStructuredToolInput<SchemaT, SchemaOutputT>[\"func\"]>[0], runManager?: CallbackManagerForToolRun, parentConfig?: RunnableConfig): Promise<ToolOutputT>;\n}\n/**\n * Abstract base class for toolkits in LangChain. Toolkits are collections\n * of tools that agents can use. Subclasses must implement the `tools`\n * property to provide the specific tools for the toolkit.\n */\nexport declare abstract class BaseToolkit {\n abstract tools: StructuredToolInterface[];\n getTools(): StructuredToolInterface[];\n}\n/**\n * Parameters for the tool function.\n * Schema can be provided as Zod or JSON schema.\n * Both schema types will be validated.\n * @template {ToolInputSchemaBase} RunInput The input schema for the tool.\n */\ninterface ToolWrapperParams<RunInput = ToolInputSchemaBase | undefined> extends ToolParams {\n /**\n * The name of the tool. If using with an LLM, this\n * will be passed as the tool name.\n */\n name: string;\n /**\n * The description of the tool.\n * @default `${fields.name} tool`\n */\n description?: string;\n /**\n * The input schema for the tool. If using an LLM, this\n * will be passed as the tool schema to generate arguments\n * for.\n */\n schema?: RunInput;\n /**\n * The tool response format.\n *\n * If \"content\" then the output of the tool is interpreted as the contents of a\n * ToolMessage. If \"content_and_artifact\" then the output is expected to be a\n * two-tuple corresponding to the (content, artifact) of a ToolMessage.\n *\n * @default \"content\"\n */\n responseFormat?: ResponseFormat;\n /**\n * Whether to return the tool's output directly.\n *\n * Setting this to true means that after the tool is called,\n * an agent should stop looping.\n */\n returnDirect?: boolean;\n}\n/**\n * Creates a new StructuredTool instance with the provided function, name, description, and schema.\n *\n * Schema can be provided as Zod or JSON schema, and both will be validated.\n *\n * @function\n * @template {ToolInputSchemaBase} SchemaT The input schema for the tool.\n * @template {ToolReturnType} ToolOutputT The output type of the tool.\n *\n * @param {RunnableFunc<z.output<SchemaT>, ToolOutputT>} func - The function to invoke when the tool is called.\n * @param {ToolWrapperParams<SchemaT>} fields - An object containing the following properties:\n * @param {string} fields.name The name of the tool.\n * @param {string | undefined} fields.description The description of the tool. Defaults to either the description on the Zod schema, or `${fields.name} tool`.\n * @param {z.AnyZodObject | z.ZodString | undefined} fields.schema The Zod schema defining the input for the tool. If undefined, it will default to a Zod string schema.\n *\n * @returns {DynamicStructuredTool<SchemaT>} A new StructuredTool instance.\n */\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType>(func: RunnableFunc<InferInteropZodOutput<SchemaT>, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends InteropZodObject | InteropZodType<string> | JSONSchema = InteropZodObject, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType>(func: RunnableFunc<SchemaOutputT, ToolOutputT, ToolRunnableConfig>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT> | DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV3, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodStringV4, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: InferInteropZodOutput<SchemaT>, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicTool<ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV3, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends ZodObjectV4, SchemaOutputT = InferInteropZodOutput<SchemaT>, SchemaInputT = InferInteropZodInput<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: SchemaOutputT, runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport declare function tool<SchemaT extends JSONSchema, SchemaOutputT = ToolInputSchemaOutputType<SchemaT>, SchemaInputT = ToolInputSchemaInputType<SchemaT>, ToolOutputT = ToolOutputType, TState = unknown, TContext = unknown>(func: (input: Parameters<DynamicStructuredToolInput<SchemaT>[\"func\"]>[0], runtime: ToolRuntime<TState, TContext>) => ToolOutputT | Promise<ToolOutputT>, fields: ToolWrapperParams<SchemaT>): DynamicStructuredTool<SchemaT, SchemaOutputT, SchemaInputT, ToolOutputT>;\nexport type ServerT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O6MmC,OAP7MnC,CAAAA,CAAAA,MAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,EAAAA,OAAAA,EAO4OqB,WAP5OrB,CAOwPwD,MAPxPxD,EAOgQyD,QAPhQzD,CAAAA,EAAAA,GAO8QsC,WAP9QtC,GAO4RwC,OAP5RxC,CAOoSsC,WAPpStC,CAAAA,EAAAA,MAAAA,EAO0TqD,iBAP1TrD,CAO4UmC,OAP5UnC,CAAAA,CAAAA,EAOuVkD,qBAPvVlD,CAO6WmC,OAP7WnC,EAOsXoC,aAPtXpC,EAOqYqC,YAPrYrC,EAOmZsC,WAPnZtC,CAAAA;AAAoEmC,KAQlIuB,UAAAA,GAAanB,MARqHJ,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AAArBpC,KAS7G4D,UAAAA,GAAa5C,uBATgGhB,GAStEkD,WATsElD,GASxDF,gBATwDE"}
|
package/dist/tools/types.d.cts
CHANGED
|
@@ -11,9 +11,7 @@ import { z } from "zod/v3";
|
|
|
11
11
|
|
|
12
12
|
//#region src/tools/types.d.ts
|
|
13
13
|
type ResponseFormat = "content" | "content_and_artifact" | string;
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
14
|
type ToolOutputType = any;
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
15
|
type ContentAndArtifact = [MessageContent, any];
|
|
18
16
|
/**
|
|
19
17
|
* Conditional type that determines the return type of the {@link StructuredTool.invoke} method.
|
|
@@ -75,11 +73,7 @@ interface ToolParams extends BaseLangChainParams {
|
|
|
75
73
|
*/
|
|
76
74
|
extras?: Record<string, unknown>;
|
|
77
75
|
}
|
|
78
|
-
type ToolRunnableConfig<
|
|
79
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
80
|
-
ConfigurableFieldType extends Record<string, any> = Record<string, any>,
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
ContextSchema = any> = RunnableConfig<ConfigurableFieldType> & {
|
|
76
|
+
type ToolRunnableConfig<ConfigurableFieldType extends Record<string, any> = Record<string, any>, ContextSchema = any> = RunnableConfig<ConfigurableFieldType> & {
|
|
83
77
|
toolCall?: ToolCall;
|
|
84
78
|
context?: ContextSchema;
|
|
85
79
|
};
|
|
@@ -134,9 +128,7 @@ type StructuredToolCallInput<SchemaT = ToolInputSchemaBase, SchemaInputT = ToolI
|
|
|
134
128
|
* This is primarily used for creating simple string-based tools where the LLM
|
|
135
129
|
* only needs to provide a single text value as input to the tool.
|
|
136
130
|
*/
|
|
137
|
-
type StringInputToolSchema = z.ZodType<string | undefined, z.ZodTypeDef,
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
139
|
-
any>;
|
|
131
|
+
type StringInputToolSchema = z.ZodType<string | undefined, z.ZodTypeDef, any>;
|
|
140
132
|
/**
|
|
141
133
|
* Interface that defines the shape of a LangChain structured tool.
|
|
142
134
|
*
|
|
@@ -211,9 +203,7 @@ interface ToolInterface<SchemaT = StringInputToolSchema, SchemaInputT = ToolInpu
|
|
|
211
203
|
* @param callbacks Optional callbacks for the tool.
|
|
212
204
|
* @returns A Promise that resolves with a string.
|
|
213
205
|
*/
|
|
214
|
-
call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(
|
|
215
|
-
// TODO: shouldn't this be narrowed based on SchemaT?
|
|
216
|
-
arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
206
|
+
call<TArg extends StructuredToolCallInput<SchemaT, SchemaInputT>, TConfig extends ToolRunnableConfig | undefined>(arg: TArg, callbacks?: TConfig): Promise<ToolReturnType<NonNullable<TArg>, TConfig, ToolOutputT>>;
|
|
217
207
|
}
|
|
218
208
|
/**
|
|
219
209
|
* Base interface for the input parameters of the {@link DynamicTool} and
|