@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":"document.d.cts","names":["DocumentInput","Metadata","Record","DocumentInterface","Document"],"sources":["../../src/documents/document.d.ts"],"sourcesContent":["export interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {\n pageContent: string;\n metadata?: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n}\nexport interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {\n pageContent: string;\n metadata: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n}\n/**\n * Interface for interacting with a document.\n */\nexport declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {\n pageContent: string;\n metadata: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n constructor(fields: DocumentInput<Metadata>);\n}\n//# sourceMappingURL=document.d.ts.map"],"mappings":";UAAiBA,+BAA+BE,sBAAsBA;EAArDF,WAAAA,EAAAA,MAAa;EAAkBE,QAAAA,CAAAA,EAEjCD,QAFiCC;EAAsBA;;AAE/C;AASvB;;;EAEcD,EAAAA,CAAAA,EAAAA,MAAAA;AAAQ;AAYDG,UAdJD,iBAcYF,CAAA,iBAduBC,MAcvB,CAAA,MAAA,EAAA,GAAA,CAAA,GAd6CA,MAc7C,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;EAAkBA,WAAAA,EAAAA,MAAAA;EAAsBA,QAAAA,EAZvDD,QAYuDC;EAEvDD;;;;;AAFuH;;;;;;cAAhHG,0BAA0BF,sBAAsBA,gCAAgCF,eAAeG;;YAEtGF;;;;;;;;sBAQUD,cAAcC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
//#region src/documents/document.d.ts
|
|
2
|
-
interface DocumentInput<
|
|
3
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4
|
-
Metadata extends Record<string, any> = Record<string, any>> {
|
|
2
|
+
interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {
|
|
5
3
|
pageContent: string;
|
|
6
4
|
metadata?: Metadata;
|
|
7
5
|
/**
|
|
@@ -12,9 +10,7 @@ Metadata extends Record<string, any> = Record<string, any>> {
|
|
|
12
10
|
*/
|
|
13
11
|
id?: string;
|
|
14
12
|
}
|
|
15
|
-
interface DocumentInterface<
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
-
Metadata extends Record<string, any> = Record<string, any>> {
|
|
13
|
+
interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {
|
|
18
14
|
pageContent: string;
|
|
19
15
|
metadata: Metadata;
|
|
20
16
|
/**
|
|
@@ -28,14 +24,9 @@ Metadata extends Record<string, any> = Record<string, any>> {
|
|
|
28
24
|
/**
|
|
29
25
|
* Interface for interacting with a document.
|
|
30
26
|
*/
|
|
31
|
-
declare class Document<
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
33
|
-
Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
|
|
27
|
+
declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {
|
|
34
28
|
pageContent: string;
|
|
35
29
|
metadata: Metadata;
|
|
36
|
-
// The ID field is optional at the moment.
|
|
37
|
-
// It will likely become required in a future major release after
|
|
38
|
-
// it has been adopted by enough vectorstore implementations.
|
|
39
30
|
/**
|
|
40
31
|
* An optional identifier for the document.
|
|
41
32
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"document.d.ts","names":["DocumentInput","Metadata","Record","DocumentInterface","Document"],"sources":["../../src/documents/document.d.ts"],"sourcesContent":["export interface DocumentInput<Metadata extends Record<string, any> = Record<string, any>> {\n pageContent: string;\n metadata?: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n}\nexport interface DocumentInterface<Metadata extends Record<string, any> = Record<string, any>> {\n pageContent: string;\n metadata: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n}\n/**\n * Interface for interacting with a document.\n */\nexport declare class Document<Metadata extends Record<string, any> = Record<string, any>> implements DocumentInput, DocumentInterface {\n pageContent: string;\n metadata: Metadata;\n /**\n * An optional identifier for the document.\n *\n * Ideally this should be unique across the document collection and formatted\n * as a UUID, but this will not be enforced.\n */\n id?: string;\n constructor(fields: DocumentInput<Metadata>);\n}\n//# sourceMappingURL=document.d.ts.map"],"mappings":";UAAiBA,+BAA+BE,sBAAsBA;EAArDF,WAAAA,EAAAA,MAAa;EAAkBE,QAAAA,CAAAA,EAEjCD,QAFiCC;EAAsBA;;AAE/C;AASvB;;;EAEcD,EAAAA,CAAAA,EAAAA,MAAAA;AAAQ;AAYDG,UAdJD,iBAcYF,CAAA,iBAduBC,MAcvB,CAAA,MAAA,EAAA,GAAA,CAAA,GAd6CA,MAc7C,CAAA,MAAA,EAAA,GAAA,CAAA,CAAA,CAAA;EAAkBA,WAAAA,EAAAA,MAAAA;EAAsBA,QAAAA,EAZvDD,QAYuDC;EAEvDD;;;;;AAFuH;;;;;;cAAhHG,0BAA0BF,sBAAsBA,gCAAgCF,eAAeG;;YAEtGF;;;;;;;;sBAQUD,cAAcC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.cts","names":["Runnable","BaseCallbackConfig","DocumentInterface","BaseDocumentTransformer","RunInput","RunOutput","Promise","MappingDocumentTransformer"],"sources":["../../src/documents/transformers.d.ts"],"sourcesContent":["import { Runnable } from \"../runnables/base.js\";\nimport type { BaseCallbackConfig } from \"../callbacks/manager.js\";\nimport type { DocumentInterface } from \"./document.js\";\n/**\n * Abstract base class for document transformation systems.\n *\n * A document transformation system takes an array of Documents and returns an\n * array of transformed Documents. These arrays do not necessarily have to have\n * the same length.\n *\n * One example of this is a text splitter that splits a large document into\n * many smaller documents.\n */\nexport declare abstract class BaseDocumentTransformer<RunInput extends DocumentInterface[] = DocumentInterface[], RunOutput extends DocumentInterface[] = DocumentInterface[]> extends Runnable<RunInput, RunOutput> {\n lc_namespace: string[];\n /**\n * Transform a list of documents.\n * @param documents A sequence of documents to be transformed.\n * @returns A list of transformed documents.\n */\n abstract transformDocuments(documents: RunInput): Promise<RunOutput>;\n /**\n * Method to invoke the document transformation. This method calls the\n * transformDocuments method with the provided input.\n * @param input The input documents to be transformed.\n * @param _options Optional configuration object to customize the behavior of callbacks.\n * @returns A Promise that resolves to the transformed documents.\n */\n invoke(input: RunInput, _options?: BaseCallbackConfig): Promise<RunOutput>;\n}\n/**\n * Class for document transformers that return exactly one transformed document\n * for each input document.\n */\nexport declare abstract class MappingDocumentTransformer extends BaseDocumentTransformer {\n transformDocuments(documents: DocumentInterface[]): Promise<DocumentInterface[]>;\n abstract _transformDocument(document: DocumentInterface): Promise<DocumentInterface>;\n}\n//# sourceMappingURL=transformers.d.ts.map"],"mappings":";;;;;;;;AAaA;;;;;;;;AAO8DK,uBAPhCF,uBAOgCE,CAAAA,iBAPSH,iBAOTG,EAAAA,GAP+BH,iBAO/BG,EAAAA,EAAAA,kBAPsEH,iBAOtEG,EAAAA,GAP4FH,iBAO5FG,EAAAA,CAAAA,SAPyHL,QAOzHK,CAPkID,QAOlIC,EAP4IA,SAO5IA,CAAAA,CAAAA;EAARC,YAAAA,EAAAA,MAAAA,EAAAA;EAQpCF;;;;;EAf6K,SAAA,kBAAA,CAAA,SAAA,EAOpJA,QAPoJ,CAAA,EAOzIE,OAPyI,CAOjID,SAPiI,CAAA;EAqBjKE;;;;;;;EAAmCJ,MAAAA,CAAAA,KAAAA,EAN/CC,QAM+CD,EAAAA,QAAAA,CAAAA,EAN1BF,kBAM0BE,CAAAA,EANLG,OAMKH,CANGE,SAMHF,CAAAA;AAAuB;;;;;uBAA1DI,0BAAAA,SAAmCJ,uBAAAA;gCAC/BD,sBAAsBI,QAAQJ;wCACtBA,oBAAoBI,QAAQJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformers.d.ts","names":["Runnable","BaseCallbackConfig","DocumentInterface","BaseDocumentTransformer","RunInput","RunOutput","Promise","MappingDocumentTransformer"],"sources":["../../src/documents/transformers.d.ts"],"sourcesContent":["import { Runnable } from \"../runnables/base.js\";\nimport type { BaseCallbackConfig } from \"../callbacks/manager.js\";\nimport type { DocumentInterface } from \"./document.js\";\n/**\n * Abstract base class for document transformation systems.\n *\n * A document transformation system takes an array of Documents and returns an\n * array of transformed Documents. These arrays do not necessarily have to have\n * the same length.\n *\n * One example of this is a text splitter that splits a large document into\n * many smaller documents.\n */\nexport declare abstract class BaseDocumentTransformer<RunInput extends DocumentInterface[] = DocumentInterface[], RunOutput extends DocumentInterface[] = DocumentInterface[]> extends Runnable<RunInput, RunOutput> {\n lc_namespace: string[];\n /**\n * Transform a list of documents.\n * @param documents A sequence of documents to be transformed.\n * @returns A list of transformed documents.\n */\n abstract transformDocuments(documents: RunInput): Promise<RunOutput>;\n /**\n * Method to invoke the document transformation. This method calls the\n * transformDocuments method with the provided input.\n * @param input The input documents to be transformed.\n * @param _options Optional configuration object to customize the behavior of callbacks.\n * @returns A Promise that resolves to the transformed documents.\n */\n invoke(input: RunInput, _options?: BaseCallbackConfig): Promise<RunOutput>;\n}\n/**\n * Class for document transformers that return exactly one transformed document\n * for each input document.\n */\nexport declare abstract class MappingDocumentTransformer extends BaseDocumentTransformer {\n transformDocuments(documents: DocumentInterface[]): Promise<DocumentInterface[]>;\n abstract _transformDocument(document: DocumentInterface): Promise<DocumentInterface>;\n}\n//# sourceMappingURL=transformers.d.ts.map"],"mappings":";;;;;;;;AAaA;;;;;;;;AAO8DK,uBAPhCF,uBAOgCE,CAAAA,iBAPSH,iBAOTG,EAAAA,GAP+BH,iBAO/BG,EAAAA,EAAAA,kBAPsEH,iBAOtEG,EAAAA,GAP4FH,iBAO5FG,EAAAA,CAAAA,SAPyHL,QAOzHK,CAPkID,QAOlIC,EAP4IA,SAO5IA,CAAAA,CAAAA;EAARC,YAAAA,EAAAA,MAAAA,EAAAA;EAQpCF;;;;;EAf6K,SAAA,kBAAA,CAAA,SAAA,EAOpJA,QAPoJ,CAAA,EAOzIE,OAPyI,CAOjID,SAPiI,CAAA;EAqBjKE;;;;;;;EAAmCJ,MAAAA,CAAAA,KAAAA,EAN/CC,QAM+CD,EAAAA,QAAAA,CAAAA,EAN1BF,kBAM0BE,CAAAA,EANLG,OAMKH,CANGE,SAMHF,CAAAA;AAAuB;;;;;uBAA1DI,0BAAAA,SAAmCJ,uBAAAA;gCAC/BD,sBAAsBI,QAAQJ;wCACtBA,oBAAoBI,QAAQJ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeddings.d.cts","names":["AsyncCaller","AsyncCallerParams","EmbeddingsParams","EmbeddingsInterface","TOutput","Promise","Embeddings"],"sources":["../src/embeddings.d.ts"],"sourcesContent":["import { AsyncCaller, AsyncCallerParams } from \"./utils/async_caller.js\";\n/**\n * The parameters required to initialize an instance of the Embeddings\n * class.\n */\nexport type EmbeddingsParams = AsyncCallerParams;\nexport interface EmbeddingsInterface<TOutput = number[]> {\n /**\n * An abstract method that takes an array of documents as input and\n * returns a promise that resolves to an array of vectors for each\n * document.\n * @param documents An array of documents to be embedded.\n * @returns A promise that resolves to an array of vectors for each document.\n */\n embedDocuments(documents: string[]): Promise<TOutput[]>;\n /**\n * An abstract method that takes a single document as input and returns a\n * promise that resolves to a vector for the query document.\n * @param document A single document to be embedded.\n * @returns A promise that resolves to a vector for the query document.\n */\n embedQuery(document: string): Promise<TOutput>;\n}\n/**\n * An abstract class that provides methods for embedding documents and\n * queries using LangChain.\n */\nexport declare abstract class Embeddings<TOutput = number[]> implements EmbeddingsInterface<TOutput> {\n /**\n * The async caller should be used by subclasses to make any async calls,\n * which will thus benefit from the concurrency and retry logic.\n */\n caller: AsyncCaller;\n constructor(params: EmbeddingsParams);\n /**\n * An abstract method that takes an array of documents as input and\n * returns a promise that resolves to an array of vectors for each\n * document.\n * @param documents An array of documents to be embedded.\n * @returns A promise that resolves to an array of vectors for each document.\n */\n abstract embedDocuments(documents: string[]): Promise<TOutput[]>;\n /**\n * An abstract method that takes a single document as input and returns a\n * promise that resolves to a vector for the query document.\n * @param document A single document to be embedded.\n * @returns A promise that resolves to a vector for the query document.\n */\n abstract embedQuery(document: string): Promise<TOutput>;\n}\n//# sourceMappingURL=embeddings.d.ts.map"],"mappings":";;;;;;AAKA;AACA;AAQiDI,KATrCF,gBAAAA,GAAmBD,iBASkBG;AAARC,UARxBF,mBAQwBE,CAAAA,UAAAA,MAAAA,EAAAA,CAAAA,CAAAA;EAOCD;;AAAD;AAMzC;;;;EAc0DA,cAAAA,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA,CAAAA,EA3BjBC,OA2BiBD,CA3BTA,OA2BSA,EAAAA,CAAAA;EAARC;;;;AAdyC;;gCANzDA,QAAQD;;;;;;uBAMZE,0CAA0CH,oBAAoBC;;;;;UAKhFJ;sBACYE;;;;;;;;gDAQ0BG,QAAQD;;;;;;;yCAOfC,QAAQD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embeddings.d.ts","names":["AsyncCaller","AsyncCallerParams","EmbeddingsParams","EmbeddingsInterface","TOutput","Promise","Embeddings"],"sources":["../src/embeddings.d.ts"],"sourcesContent":["import { AsyncCaller, AsyncCallerParams } from \"./utils/async_caller.js\";\n/**\n * The parameters required to initialize an instance of the Embeddings\n * class.\n */\nexport type EmbeddingsParams = AsyncCallerParams;\nexport interface EmbeddingsInterface<TOutput = number[]> {\n /**\n * An abstract method that takes an array of documents as input and\n * returns a promise that resolves to an array of vectors for each\n * document.\n * @param documents An array of documents to be embedded.\n * @returns A promise that resolves to an array of vectors for each document.\n */\n embedDocuments(documents: string[]): Promise<TOutput[]>;\n /**\n * An abstract method that takes a single document as input and returns a\n * promise that resolves to a vector for the query document.\n * @param document A single document to be embedded.\n * @returns A promise that resolves to a vector for the query document.\n */\n embedQuery(document: string): Promise<TOutput>;\n}\n/**\n * An abstract class that provides methods for embedding documents and\n * queries using LangChain.\n */\nexport declare abstract class Embeddings<TOutput = number[]> implements EmbeddingsInterface<TOutput> {\n /**\n * The async caller should be used by subclasses to make any async calls,\n * which will thus benefit from the concurrency and retry logic.\n */\n caller: AsyncCaller;\n constructor(params: EmbeddingsParams);\n /**\n * An abstract method that takes an array of documents as input and\n * returns a promise that resolves to an array of vectors for each\n * document.\n * @param documents An array of documents to be embedded.\n * @returns A promise that resolves to an array of vectors for each document.\n */\n abstract embedDocuments(documents: string[]): Promise<TOutput[]>;\n /**\n * An abstract method that takes a single document as input and returns a\n * promise that resolves to a vector for the query document.\n * @param document A single document to be embedded.\n * @returns A promise that resolves to a vector for the query document.\n */\n abstract embedQuery(document: string): Promise<TOutput>;\n}\n//# sourceMappingURL=embeddings.d.ts.map"],"mappings":";;;;;;AAKA;AACA;AAQiDI,KATrCF,gBAAAA,GAAmBD,iBASkBG;AAARC,UARxBF,mBAQwBE,CAAAA,UAAAA,MAAAA,EAAAA,CAAAA,CAAAA;EAOCD;;AAAD;AAMzC;;;;EAc0DA,cAAAA,CAAAA,SAAAA,EAAAA,MAAAA,EAAAA,CAAAA,EA3BjBC,OA2BiBD,CA3BTA,OA2BSA,EAAAA,CAAAA;EAARC;;;;AAdyC;;gCANzDA,QAAQD;;;;;;uBAMZE,0CAA0CH,oBAAoBC;;;;;UAKhFJ;sBACYE;;;;;;;;gDAQ0BG,QAAQD;;;;;;;yCAOfC,QAAQD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["Serializable","Example","BaseExampleSelector","Promise"],"sources":["../../src/example_selectors/base.d.ts"],"sourcesContent":["import { Serializable } from \"../load/serializable.js\";\nimport type { Example } from \"../prompts/base.js\";\n/**\n * Base class for example selectors.\n */\nexport declare abstract class BaseExampleSelector extends Serializable {\n lc_namespace: string[];\n /**\n * Adds an example to the example selector.\n * @param example The example to add to the example selector.\n * @returns A Promise that resolves to void or a string.\n */\n abstract addExample(example: Example): Promise<void | string>;\n /**\n * Selects examples from the example selector given the input variables.\n * @param input_variables The input variables to select examples with.\n * @returns A Promise that resolves to an array of selected examples.\n */\n abstract selectExamples(input_variables: Example): Promise<Example[]>;\n}\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;AAKA;AAOiCC,uBAPHC,mBAAAA,SAA4BF,YAAAA,CAOzBC;EAAUE,YAAAA,EAAAA,MAAAA,EAAAA;EAMEF;;;;AAbyB;+BAOrCA,UAAUE;;;;;;2CAMEF,UAAUE,QAAQF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":["Serializable","Example","BaseExampleSelector","Promise"],"sources":["../../src/example_selectors/base.d.ts"],"sourcesContent":["import { Serializable } from \"../load/serializable.js\";\nimport type { Example } from \"../prompts/base.js\";\n/**\n * Base class for example selectors.\n */\nexport declare abstract class BaseExampleSelector extends Serializable {\n lc_namespace: string[];\n /**\n * Adds an example to the example selector.\n * @param example The example to add to the example selector.\n * @returns A Promise that resolves to void or a string.\n */\n abstract addExample(example: Example): Promise<void | string>;\n /**\n * Selects examples from the example selector given the input variables.\n * @param input_variables The input variables to select examples with.\n * @returns A Promise that resolves to an array of selected examples.\n */\n abstract selectExamples(input_variables: Example): Promise<Example[]>;\n}\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;AAKA;AAOiCC,uBAPHC,mBAAAA,SAA4BF,YAAAA,CAOzBC;EAAUE,YAAAA,EAAAA,MAAAA,EAAAA;EAMEF;;;;AAbyB;+BAOrCA,UAAUE;;;;;;2CAMEF,UAAUE,QAAQF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.d.cts","names":["BaseChatModel","BasePromptTemplate","BaseLanguageModelInterface","BaseLLM","PartialValues","BaseGetPromptAsyncOptions","BasePromptSelector","Promise","ConditionalPromptSelector","Array","isLLM","isChatModel"],"sources":["../../src/example_selectors/conditional.d.ts"],"sourcesContent":["import type { BaseChatModel } from \"../language_models/chat_models.js\";\nimport type { BasePromptTemplate } from \"../prompts/base.js\";\nimport type { BaseLanguageModelInterface } from \"../language_models/base.js\";\nimport type { BaseLLM } from \"../language_models/llms.js\";\nimport type { PartialValues } from \"../utils/types/index.js\";\nexport type BaseGetPromptAsyncOptions = {\n partialVariables?: PartialValues;\n};\n/**\n * Abstract class that defines the interface for selecting a prompt for a\n * given language model.\n */\nexport declare abstract class BasePromptSelector {\n /**\n * Abstract method that must be implemented by any class that extends\n * `BasePromptSelector`. It takes a language model as an argument and\n * returns a prompt template.\n * @param llm The language model for which to get a prompt.\n * @returns A prompt template.\n */\n abstract getPrompt(llm: BaseLanguageModelInterface): BasePromptTemplate;\n /**\n * Asynchronous version of `getPrompt` that also accepts an options object\n * for partial variables.\n * @param llm The language model for which to get a prompt.\n * @param options Optional object for partial variables.\n * @returns A Promise that resolves to a prompt template.\n */\n getPromptAsync(llm: BaseLanguageModelInterface, options?: BaseGetPromptAsyncOptions): Promise<BasePromptTemplate>;\n}\n/**\n * Concrete implementation of `BasePromptSelector` that selects a prompt\n * based on a set of conditions. It has a default prompt that it returns\n * if none of the conditions are met.\n */\nexport declare class ConditionalPromptSelector extends BasePromptSelector {\n defaultPrompt: BasePromptTemplate;\n conditionals: Array<[\n condition: (llm: BaseLanguageModelInterface) => boolean,\n prompt: BasePromptTemplate\n ]>;\n constructor(default_prompt: BasePromptTemplate, conditionals?: Array<[\n condition: (llm: BaseLanguageModelInterface) => boolean,\n prompt: BasePromptTemplate\n ]>);\n /**\n * Method that selects a prompt based on a set of conditions. If none of\n * the conditions are met, it returns the default prompt.\n * @param llm The language model for which to get a prompt.\n * @returns A prompt template.\n */\n getPrompt(llm: BaseLanguageModelInterface): BasePromptTemplate;\n}\n/**\n * Type guard function that checks if a given language model is of type\n * `BaseLLM`.\n */\nexport declare function isLLM(llm: BaseLanguageModelInterface): llm is BaseLLM;\n/**\n * Type guard function that checks if a given language model is of type\n * `BaseChatModel`.\n */\nexport declare function isChatModel(llm: BaseLanguageModelInterface): llm is BaseChatModel;\n//# sourceMappingURL=conditional.d.ts.map"],"mappings":";;;;;;;KAKYK,yBAAAA;qBACWD;AADvB,CAAA;AAOA;;;;AAgB8DC,uBAhBhCC,kBAAAA,CAgBgCD;EAAoCJ;;AAAD;AAOjG;;;;EAEkBQ,SAAAA,SAAAA,CAAAA,GAAAA,EAjBUP,0BAiBVO,CAAAA,EAjBuCR,kBAiBvCQ;EAIcR;;;;;;;EANyC,cAAA,CAAA,GAAA,EAPjDC,0BAOiD,EAAA,OAAA,CAAA,EAPXG,yBAOW,CAAA,EAPiBE,OAOjB,CAPyBN,kBAOzB,CAAA;AAsBzE;AAKA;;;;;cA3BqBO,yBAAAA,SAAkCF,kBAAAA;iBACpCL;gBACDQ,wBACOP,gDACTD;8BAEgBA,mCAAmCQ,wBAC1CP,gDACTD;;;;;;;iBAQGC,6BAA6BD;;;;;;iBAMxBS,KAAAA,MAAWR,oCAAoCC;;;;;iBAK/CQ,WAAAA,MAAiBT,oCAAoCF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditional.d.ts","names":["BaseChatModel","BasePromptTemplate","BaseLanguageModelInterface","BaseLLM","PartialValues","BaseGetPromptAsyncOptions","BasePromptSelector","Promise","ConditionalPromptSelector","Array","isLLM","isChatModel"],"sources":["../../src/example_selectors/conditional.d.ts"],"sourcesContent":["import type { BaseChatModel } from \"../language_models/chat_models.js\";\nimport type { BasePromptTemplate } from \"../prompts/base.js\";\nimport type { BaseLanguageModelInterface } from \"../language_models/base.js\";\nimport type { BaseLLM } from \"../language_models/llms.js\";\nimport type { PartialValues } from \"../utils/types/index.js\";\nexport type BaseGetPromptAsyncOptions = {\n partialVariables?: PartialValues;\n};\n/**\n * Abstract class that defines the interface for selecting a prompt for a\n * given language model.\n */\nexport declare abstract class BasePromptSelector {\n /**\n * Abstract method that must be implemented by any class that extends\n * `BasePromptSelector`. It takes a language model as an argument and\n * returns a prompt template.\n * @param llm The language model for which to get a prompt.\n * @returns A prompt template.\n */\n abstract getPrompt(llm: BaseLanguageModelInterface): BasePromptTemplate;\n /**\n * Asynchronous version of `getPrompt` that also accepts an options object\n * for partial variables.\n * @param llm The language model for which to get a prompt.\n * @param options Optional object for partial variables.\n * @returns A Promise that resolves to a prompt template.\n */\n getPromptAsync(llm: BaseLanguageModelInterface, options?: BaseGetPromptAsyncOptions): Promise<BasePromptTemplate>;\n}\n/**\n * Concrete implementation of `BasePromptSelector` that selects a prompt\n * based on a set of conditions. It has a default prompt that it returns\n * if none of the conditions are met.\n */\nexport declare class ConditionalPromptSelector extends BasePromptSelector {\n defaultPrompt: BasePromptTemplate;\n conditionals: Array<[\n condition: (llm: BaseLanguageModelInterface) => boolean,\n prompt: BasePromptTemplate\n ]>;\n constructor(default_prompt: BasePromptTemplate, conditionals?: Array<[\n condition: (llm: BaseLanguageModelInterface) => boolean,\n prompt: BasePromptTemplate\n ]>);\n /**\n * Method that selects a prompt based on a set of conditions. If none of\n * the conditions are met, it returns the default prompt.\n * @param llm The language model for which to get a prompt.\n * @returns A prompt template.\n */\n getPrompt(llm: BaseLanguageModelInterface): BasePromptTemplate;\n}\n/**\n * Type guard function that checks if a given language model is of type\n * `BaseLLM`.\n */\nexport declare function isLLM(llm: BaseLanguageModelInterface): llm is BaseLLM;\n/**\n * Type guard function that checks if a given language model is of type\n * `BaseChatModel`.\n */\nexport declare function isChatModel(llm: BaseLanguageModelInterface): llm is BaseChatModel;\n//# sourceMappingURL=conditional.d.ts.map"],"mappings":";;;;;;;KAKYK,yBAAAA;qBACWD;AADvB,CAAA;AAOA;;;;AAgB8DC,uBAhBhCC,kBAAAA,CAgBgCD;EAAoCJ;;AAAD;AAOjG;;;;EAEkBQ,SAAAA,SAAAA,CAAAA,GAAAA,EAjBUP,0BAiBVO,CAAAA,EAjBuCR,kBAiBvCQ;EAIcR;;;;;;;EANyC,cAAA,CAAA,GAAA,EAPjDC,0BAOiD,EAAA,OAAA,CAAA,EAPXG,yBAOW,CAAA,EAPiBE,OAOjB,CAPyBN,kBAOzB,CAAA;AAsBzE;AAKA;;;;;cA3BqBO,yBAAAA,SAAkCF,kBAAAA;iBACpCL;gBACDQ,wBACOP,gDACTD;8BAEgBA,mCAAmCQ,wBAC1CP,gDACTD;;;;;;;iBAQGC,6BAA6BD;;;;;;iBAMxBS,KAAAA,MAAWR,oCAAoCC;;;;;iBAK/CQ,WAAAA,MAAiBT,oCAAoCF"}
|
|
@@ -56,7 +56,7 @@ interface LengthBasedExampleSelectorInput {
|
|
|
56
56
|
*/
|
|
57
57
|
declare class LengthBasedExampleSelector extends BaseExampleSelector {
|
|
58
58
|
protected examples: Example[];
|
|
59
|
-
examplePrompt
|
|
59
|
+
examplePrompt: PromptTemplate;
|
|
60
60
|
getTextLength: (text: string) => number;
|
|
61
61
|
maxLength: number;
|
|
62
62
|
exampleTextLengths: number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length_based.d.cts","names":["Example","BaseExampleSelector","PromptTemplate","LengthBasedExampleSelectorInput","LengthBasedExampleSelector","Promise"],"sources":["../../src/example_selectors/length_based.d.ts"],"sourcesContent":["import { Example } from \"../prompts/base.js\";\nimport { BaseExampleSelector } from \"./base.js\";\nimport { PromptTemplate } from \"../prompts/prompt.js\";\n/**\n * Interface for the input parameters of the LengthBasedExampleSelector\n * class.\n */\nexport interface LengthBasedExampleSelectorInput {\n examplePrompt: PromptTemplate;\n maxLength?: number;\n getTextLength?: (text: string) => number;\n}\n/**\n * A specialized example selector that selects examples based on their\n * length, ensuring that the total length of the selected examples does\n * not exceed a specified maximum length.\n * @example\n * ```typescript\n * const exampleSelector = new LengthBasedExampleSelector(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * {\n * examplePrompt: new PromptTemplate({\n * inputVariables: [\"input\", \"output\"],\n * template: \"Input: {input}\\nOutput: {output}\",\n * }),\n * maxLength: 25,\n * },\n * );\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt: new PromptTemplate({\n * inputVariables: [\"input\", \"output\"],\n * template: \"Input: {input}\\nOutput: {output}\",\n * }),\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n * console.log(dynamicPrompt.format({ adjective: \"big\" }));\n * console.log(\n * dynamicPrompt.format({\n * adjective:\n * \"big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else\",\n * }),\n * );\n * ```\n */\nexport declare class LengthBasedExampleSelector extends BaseExampleSelector {\n protected examples: Example[];\n examplePrompt: PromptTemplate;\n getTextLength: (text: string) => number;\n maxLength: number;\n exampleTextLengths: number[];\n constructor(data: LengthBasedExampleSelectorInput);\n /**\n * Adds an example to the list of examples and calculates its length.\n * @param example The example to be added.\n * @returns Promise that resolves when the example has been added and its length calculated.\n */\n addExample(example: Example): Promise<void>;\n /**\n * Calculates the lengths of the examples.\n * @param v Array of lengths of the examples.\n * @param values Instance of LengthBasedExampleSelector.\n * @returns Promise that resolves with an array of lengths of the examples.\n */\n calculateExampleTextLengths(v: number[], values: LengthBasedExampleSelector): Promise<number[]>;\n /**\n * Selects examples until the total length of the selected examples\n * reaches the maxLength.\n * @param inputVariables The input variables for the examples.\n * @returns Promise that resolves with an array of selected examples.\n */\n selectExamples(inputVariables: Example): Promise<Example[]>;\n /**\n * Creates a new instance of LengthBasedExampleSelector and adds a list of\n * examples to it.\n * @param examples Array of examples to be added.\n * @param args Input parameters for the LengthBasedExampleSelector.\n * @returns Promise that resolves with a new instance of LengthBasedExampleSelector with the examples added.\n */\n static fromExamples(examples: Example[], args: LengthBasedExampleSelectorInput): Promise<LengthBasedExampleSelector>;\n}\n//# sourceMappingURL=length_based.d.ts.map"],"mappings":";;;;;;;;AAOA;AA8CA;AACwBA,UA/CPG,+BAAAA,CA+COH;EACLE,aAAAA,EA/CAA,cA+CAA;EAIGC,SAAAA,CAAAA,EAAAA,MAAAA;EAMEH,aAAAA,CAAAA,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,MAAAA;;;;;;;;;;;;AAZmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAtDI,0BAAAA,SAAmCH,mBAAAA;sBAChCD;iBACLE;;;;oBAIGC;;;;;;sBAMEH,UAAUK;;;;;;;mDAOmBD,6BAA6BC;;;;;;;iCAO/CL,UAAUK,QAAQL;;;;;;;;gCAQnBA,iBAAiBG,kCAAkCE,QAAQD"}
|
|
@@ -56,7 +56,7 @@ interface LengthBasedExampleSelectorInput {
|
|
|
56
56
|
*/
|
|
57
57
|
declare class LengthBasedExampleSelector extends BaseExampleSelector {
|
|
58
58
|
protected examples: Example[];
|
|
59
|
-
examplePrompt
|
|
59
|
+
examplePrompt: PromptTemplate;
|
|
60
60
|
getTextLength: (text: string) => number;
|
|
61
61
|
maxLength: number;
|
|
62
62
|
exampleTextLengths: number[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"length_based.d.ts","names":["Example","BaseExampleSelector","PromptTemplate","LengthBasedExampleSelectorInput","LengthBasedExampleSelector","Promise"],"sources":["../../src/example_selectors/length_based.d.ts"],"sourcesContent":["import { Example } from \"../prompts/base.js\";\nimport { BaseExampleSelector } from \"./base.js\";\nimport { PromptTemplate } from \"../prompts/prompt.js\";\n/**\n * Interface for the input parameters of the LengthBasedExampleSelector\n * class.\n */\nexport interface LengthBasedExampleSelectorInput {\n examplePrompt: PromptTemplate;\n maxLength?: number;\n getTextLength?: (text: string) => number;\n}\n/**\n * A specialized example selector that selects examples based on their\n * length, ensuring that the total length of the selected examples does\n * not exceed a specified maximum length.\n * @example\n * ```typescript\n * const exampleSelector = new LengthBasedExampleSelector(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * {\n * examplePrompt: new PromptTemplate({\n * inputVariables: [\"input\", \"output\"],\n * template: \"Input: {input}\\nOutput: {output}\",\n * }),\n * maxLength: 25,\n * },\n * );\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt: new PromptTemplate({\n * inputVariables: [\"input\", \"output\"],\n * template: \"Input: {input}\\nOutput: {output}\",\n * }),\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n * console.log(dynamicPrompt.format({ adjective: \"big\" }));\n * console.log(\n * dynamicPrompt.format({\n * adjective:\n * \"big and huge and massive and large and gigantic and tall and much much much much much bigger than everything else\",\n * }),\n * );\n * ```\n */\nexport declare class LengthBasedExampleSelector extends BaseExampleSelector {\n protected examples: Example[];\n examplePrompt: PromptTemplate;\n getTextLength: (text: string) => number;\n maxLength: number;\n exampleTextLengths: number[];\n constructor(data: LengthBasedExampleSelectorInput);\n /**\n * Adds an example to the list of examples and calculates its length.\n * @param example The example to be added.\n * @returns Promise that resolves when the example has been added and its length calculated.\n */\n addExample(example: Example): Promise<void>;\n /**\n * Calculates the lengths of the examples.\n * @param v Array of lengths of the examples.\n * @param values Instance of LengthBasedExampleSelector.\n * @returns Promise that resolves with an array of lengths of the examples.\n */\n calculateExampleTextLengths(v: number[], values: LengthBasedExampleSelector): Promise<number[]>;\n /**\n * Selects examples until the total length of the selected examples\n * reaches the maxLength.\n * @param inputVariables The input variables for the examples.\n * @returns Promise that resolves with an array of selected examples.\n */\n selectExamples(inputVariables: Example): Promise<Example[]>;\n /**\n * Creates a new instance of LengthBasedExampleSelector and adds a list of\n * examples to it.\n * @param examples Array of examples to be added.\n * @param args Input parameters for the LengthBasedExampleSelector.\n * @returns Promise that resolves with a new instance of LengthBasedExampleSelector with the examples added.\n */\n static fromExamples(examples: Example[], args: LengthBasedExampleSelectorInput): Promise<LengthBasedExampleSelector>;\n}\n//# sourceMappingURL=length_based.d.ts.map"],"mappings":";;;;;;;;AAOA;AA8CA;AACwBA,UA/CPG,+BAAAA,CA+COH;EACLE,aAAAA,EA/CAA,cA+CAA;EAIGC,SAAAA,CAAAA,EAAAA,MAAAA;EAMEH,aAAAA,CAAAA,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,MAAAA;;;;;;;;;;;;AAZmD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAAtDI,0BAAAA,SAAmCH,mBAAAA;sBAChCD;iBACLE;;;;oBAIGC;;;;;;sBAMEH,UAAUK;;;;;;;mDAOmBD,6BAA6BC;;;;;;;iCAO/CL,UAAUK,QAAQL;;;;;;;;gCAQnBA,iBAAiBG,kCAAkCE,QAAQD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic_similarity.d.cts","names":["Embeddings","VectorStoreInterface","VectorStoreRetrieverInterface","VectorStore","Example","BaseExampleSelector","SemanticSimilarityExampleSelectorInput","V","SemanticSimilarityExampleSelector","T","C","Promise","Record","Parameters"],"sources":["../../src/example_selectors/semantic_similarity.d.ts"],"sourcesContent":["import type { Embeddings } from \"../embeddings.js\";\nimport type { VectorStoreInterface, VectorStoreRetrieverInterface, VectorStore } from \"../vectorstores.js\";\nimport type { Example } from \"../prompts/base.js\";\nimport { BaseExampleSelector } from \"./base.js\";\n/**\n * Interface for the input data of the SemanticSimilarityExampleSelector\n * class.\n */\nexport type SemanticSimilarityExampleSelectorInput<V extends VectorStoreInterface = VectorStoreInterface> = {\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n exampleKeys?: string[];\n inputKeys?: string[];\n vectorStoreRetriever?: never;\n} | {\n vectorStoreRetriever: VectorStoreRetrieverInterface<V>;\n exampleKeys?: string[];\n inputKeys?: string[];\n vectorStore?: never;\n k?: never;\n filter?: never;\n};\n/**\n * Class that selects examples based on semantic similarity. It extends\n * the BaseExampleSelector class.\n * @example\n * ```typescript\n * const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * new OpenAIEmbeddings(),\n * HNSWLib,\n * { k: 1 },\n * );\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt: PromptTemplate.fromTemplate(\n * \"Input: {input}\\nOutput: {output}\",\n * ),\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n * console.log(await dynamicPrompt.format({ adjective: \"rainy\" }));\n * ```\n */\nexport declare class SemanticSimilarityExampleSelector<V extends VectorStoreInterface = VectorStoreInterface> extends BaseExampleSelector {\n vectorStoreRetriever: VectorStoreRetrieverInterface<V>;\n exampleKeys?: string[];\n inputKeys?: string[];\n constructor(data: SemanticSimilarityExampleSelectorInput<V>);\n /**\n * Method that adds a new example to the vectorStore. The example is\n * converted to a string and added to the vectorStore as a document.\n * @param example The example to be added to the vectorStore.\n * @returns Promise that resolves when the example has been added to the vectorStore.\n */\n addExample(example: Example): Promise<void>;\n /**\n * Method that selects which examples to use based on semantic similarity.\n * It performs a similarity search in the vectorStore using the input\n * variables and returns the examples with the highest similarity.\n * @param inputVariables The input variables used for the similarity search.\n * @returns Promise that resolves with an array of the selected examples.\n */\n selectExamples<T>(inputVariables: Record<string, T>): Promise<Example[]>;\n /**\n * Static method that creates a new instance of\n * SemanticSimilarityExampleSelector. It takes a list of examples, an\n * instance of Embeddings, a VectorStore class, and an options object as\n * parameters. It converts the examples to strings, creates a VectorStore\n * from the strings and the embeddings, and returns a new\n * SemanticSimilarityExampleSelector with the created VectorStore and the\n * options provided.\n * @param examples The list of examples to be used.\n * @param embeddings The instance of Embeddings to be used.\n * @param vectorStoreCls The VectorStore class to be used.\n * @param options The options object for the SemanticSimilarityExampleSelector.\n * @returns Promise that resolves with a new instance of SemanticSimilarityExampleSelector.\n */\n static fromExamples<C extends typeof VectorStore>(examples: Record<string, string>[], embeddings: Embeddings, vectorStoreCls: C, options?: {\n k?: number;\n inputKeys?: string[];\n } & Parameters<C[\"fromTexts\"]>[3]): Promise<SemanticSimilarityExampleSelector>;\n}\n//# sourceMappingURL=semantic_similarity.d.ts.map"],"mappings":";;;;;;;;;AAQA;;AAAoFC,KAAxEK,sCAAwEL,CAAAA,UAAvBA,oBAAuBA,GAAAA,oBAAAA,CAAAA,GAAAA;EACnEM,WAAAA,EAAAA,CAAAA;EAEJA,CAAAA,CAAAA,EAAAA,MAAAA;EAK2CA,MAAAA,CAAAA,EAL3CA,CAK2CA,CAAAA,YAAAA,CAAAA;EAA9BL,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA6B,SAAA,CAAA,EAAA,MAAA,EAAA;EAoClCM,oBAAAA,CAAAA,EAAAA,KAAAA;CAA4CP,GAAAA;EAAuBA,oBAAAA,EApC9DC,6BAoC8DD,CApChCM,CAoCgCN,CAAAA;EAChCM,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA9BL,SAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAGmCK,WAAAA,CAAAA,EAAAA,KAAAA;EAAvCD,CAAAA,CAAAA,EAAAA,KAAAA;EAOEF,MAAAA,CAAAA,EAAAA,KAAAA;CAAUO;;;;;;;;;;;;;;AAXuG;;;;;;;;;;;;;;;;cAApHH,4CAA4CP,uBAAuBA,8BAA8BI,mBAAAA;wBAC5FH,8BAA8BK;;;oBAGlCD,uCAAuCC;;;;;;;sBAOrCH,UAAUO;;;;;;;;oCAQIC,eAAeH,KAAKE,QAAQP;;;;;;;;;;;;;;;uCAezBD,uBAAuBS,sCAAsCZ,4BAA4BU;;;MAG1HG,WAAWH,qBAAqBC,QAAQH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semantic_similarity.d.ts","names":["Embeddings","VectorStoreInterface","VectorStoreRetrieverInterface","VectorStore","Example","BaseExampleSelector","SemanticSimilarityExampleSelectorInput","V","SemanticSimilarityExampleSelector","T","C","Promise","Record","Parameters"],"sources":["../../src/example_selectors/semantic_similarity.d.ts"],"sourcesContent":["import type { Embeddings } from \"../embeddings.js\";\nimport type { VectorStoreInterface, VectorStoreRetrieverInterface, VectorStore } from \"../vectorstores.js\";\nimport type { Example } from \"../prompts/base.js\";\nimport { BaseExampleSelector } from \"./base.js\";\n/**\n * Interface for the input data of the SemanticSimilarityExampleSelector\n * class.\n */\nexport type SemanticSimilarityExampleSelectorInput<V extends VectorStoreInterface = VectorStoreInterface> = {\n vectorStore: V;\n k?: number;\n filter?: V[\"FilterType\"];\n exampleKeys?: string[];\n inputKeys?: string[];\n vectorStoreRetriever?: never;\n} | {\n vectorStoreRetriever: VectorStoreRetrieverInterface<V>;\n exampleKeys?: string[];\n inputKeys?: string[];\n vectorStore?: never;\n k?: never;\n filter?: never;\n};\n/**\n * Class that selects examples based on semantic similarity. It extends\n * the BaseExampleSelector class.\n * @example\n * ```typescript\n * const exampleSelector = await SemanticSimilarityExampleSelector.fromExamples(\n * [\n * { input: \"happy\", output: \"sad\" },\n * { input: \"tall\", output: \"short\" },\n * { input: \"energetic\", output: \"lethargic\" },\n * { input: \"sunny\", output: \"gloomy\" },\n * { input: \"windy\", output: \"calm\" },\n * ],\n * new OpenAIEmbeddings(),\n * HNSWLib,\n * { k: 1 },\n * );\n * const dynamicPrompt = new FewShotPromptTemplate({\n * exampleSelector,\n * examplePrompt: PromptTemplate.fromTemplate(\n * \"Input: {input}\\nOutput: {output}\",\n * ),\n * prefix: \"Give the antonym of every input\",\n * suffix: \"Input: {adjective}\\nOutput:\",\n * inputVariables: [\"adjective\"],\n * });\n * console.log(await dynamicPrompt.format({ adjective: \"rainy\" }));\n * ```\n */\nexport declare class SemanticSimilarityExampleSelector<V extends VectorStoreInterface = VectorStoreInterface> extends BaseExampleSelector {\n vectorStoreRetriever: VectorStoreRetrieverInterface<V>;\n exampleKeys?: string[];\n inputKeys?: string[];\n constructor(data: SemanticSimilarityExampleSelectorInput<V>);\n /**\n * Method that adds a new example to the vectorStore. The example is\n * converted to a string and added to the vectorStore as a document.\n * @param example The example to be added to the vectorStore.\n * @returns Promise that resolves when the example has been added to the vectorStore.\n */\n addExample(example: Example): Promise<void>;\n /**\n * Method that selects which examples to use based on semantic similarity.\n * It performs a similarity search in the vectorStore using the input\n * variables and returns the examples with the highest similarity.\n * @param inputVariables The input variables used for the similarity search.\n * @returns Promise that resolves with an array of the selected examples.\n */\n selectExamples<T>(inputVariables: Record<string, T>): Promise<Example[]>;\n /**\n * Static method that creates a new instance of\n * SemanticSimilarityExampleSelector. It takes a list of examples, an\n * instance of Embeddings, a VectorStore class, and an options object as\n * parameters. It converts the examples to strings, creates a VectorStore\n * from the strings and the embeddings, and returns a new\n * SemanticSimilarityExampleSelector with the created VectorStore and the\n * options provided.\n * @param examples The list of examples to be used.\n * @param embeddings The instance of Embeddings to be used.\n * @param vectorStoreCls The VectorStore class to be used.\n * @param options The options object for the SemanticSimilarityExampleSelector.\n * @returns Promise that resolves with a new instance of SemanticSimilarityExampleSelector.\n */\n static fromExamples<C extends typeof VectorStore>(examples: Record<string, string>[], embeddings: Embeddings, vectorStoreCls: C, options?: {\n k?: number;\n inputKeys?: string[];\n } & Parameters<C[\"fromTexts\"]>[3]): Promise<SemanticSimilarityExampleSelector>;\n}\n//# sourceMappingURL=semantic_similarity.d.ts.map"],"mappings":";;;;;;;;;AAQA;;AAAoFC,KAAxEK,sCAAwEL,CAAAA,UAAvBA,oBAAuBA,GAAAA,oBAAAA,CAAAA,GAAAA;EACnEM,WAAAA,EAAAA,CAAAA;EAEJA,CAAAA,CAAAA,EAAAA,MAAAA;EAK2CA,MAAAA,CAAAA,EAL3CA,CAK2CA,CAAAA,YAAAA,CAAAA;EAA9BL,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA6B,SAAA,CAAA,EAAA,MAAA,EAAA;EAoClCM,oBAAAA,CAAAA,EAAAA,KAAAA;CAA4CP,GAAAA;EAAuBA,oBAAAA,EApC9DC,6BAoC8DD,CApChCM,CAoCgCN,CAAAA;EAChCM,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAA9BL,SAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EAGmCK,WAAAA,CAAAA,EAAAA,KAAAA;EAAvCD,CAAAA,CAAAA,EAAAA,KAAAA;EAOEF,MAAAA,CAAAA,EAAAA,KAAAA;CAAUO;;;;;;;;;;;;;;AAXuG;;;;;;;;;;;;;;;;cAApHH,4CAA4CP,uBAAuBA,8BAA8BI,mBAAAA;wBAC5FH,8BAA8BK;;;oBAGlCD,uCAAuCC;;;;;;;sBAOrCH,UAAUO;;;;;;;;oCAQIC,eAAeH,KAAKE,QAAQP;;;;;;;;;;;;;;;uCAezBD,uBAAuBS,sCAAsCZ,4BAA4BU;;;MAG1HG,WAAWH,qBAAqBC,QAAQH"}
|
package/dist/indexing/base.d.cts
CHANGED
|
@@ -89,7 +89,6 @@ type IndexOptions = {
|
|
|
89
89
|
declare function _batch<T>(size: number, iterable: T[]): T[][];
|
|
90
90
|
declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];
|
|
91
91
|
declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
92
|
declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;
|
|
94
93
|
interface IndexArgs {
|
|
95
94
|
docsSource: BaseDocumentLoader | DocumentInterface[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["VectorStore","RecordManagerInterface","HashKeyEncoder","DocumentInterface","BaseDocumentLoader","Metadata","Record","IndexingResult","StringOrDocFunc","HashedDocumentInterface","HashedDocumentArgs","_HashedDocument","CleanupMode","IndexOptions","_batch","T","_deduplicateInOrder","_getSourceIdAssigner","_isBaseDocumentLoader","IndexArgs","index","Promise"],"sources":["../../src/indexing/base.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\nimport { RecordManagerInterface } from \"./record_manager.js\";\nimport { type HashKeyEncoder } from \"../utils/hash.js\";\nimport { DocumentInterface } from \"../documents/document.js\";\nimport { BaseDocumentLoader } from \"../document_loaders/base.js\";\ntype Metadata = Record<string, unknown>;\ntype IndexingResult = {\n numAdded: number;\n numDeleted: number;\n numUpdated: number;\n numSkipped: number;\n};\ntype StringOrDocFunc = string | ((doc: DocumentInterface) => string);\nexport interface HashedDocumentInterface extends DocumentInterface {\n uid: string;\n hash_?: string;\n contentHash?: string;\n metadataHash?: string;\n pageContent: string;\n metadata: Metadata;\n calculateHashes(): void;\n toDocument(): DocumentInterface;\n}\ninterface HashedDocumentArgs {\n pageContent: string;\n metadata: Metadata;\n uid: string;\n}\n/**\n * HashedDocument is a Document with hashes calculated.\n * Hashes are calculated based on page content and metadata.\n * It is used for indexing.\n */\nexport declare class _HashedDocument implements HashedDocumentInterface {\n uid: string;\n hash_?: string;\n contentHash?: string;\n metadataHash?: string;\n pageContent: string;\n metadata: Metadata;\n private keyEncoder;\n constructor(fields: HashedDocumentArgs);\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n calculateHashes(): void;\n toDocument(): DocumentInterface;\n static fromDocument(document: DocumentInterface, uid?: string): _HashedDocument;\n private _hashStringToUUID;\n private _hashNestedDictToUUID;\n}\nexport type CleanupMode = \"full\" | \"incremental\";\nexport type IndexOptions = {\n /**\n * The number of documents to index in one batch.\n */\n batchSize?: number;\n /**\n * The cleanup mode to use. Can be \"full\", \"incremental\" or undefined.\n * - **Incremental**: Cleans up all documents that haven't been updated AND\n * that are associated with source ids that were seen\n * during indexing.\n * Clean up is done continuously during indexing helping\n * to minimize the probability of users seeing duplicated\n * content.\n * - **Full**: Delete all documents that haven to been returned by the loader.\n * Clean up runs after all documents have been indexed.\n * This means that users may see duplicated content during indexing.\n * - **undefined**: Do not delete any documents.\n */\n cleanup?: CleanupMode;\n /**\n * Optional key that helps identify the original source of the document.\n * Must either be a string representing the key of the source in the metadata\n * or a function that takes a document and returns a string representing the source.\n * **Required when cleanup is incremental**.\n */\n sourceIdKey?: StringOrDocFunc;\n /**\n * Batch size to use when cleaning up documents.\n */\n cleanupBatchSize?: number;\n /**\n * Force update documents even if they are present in the\n * record manager. Useful if you are re-indexing with updated embeddings.\n */\n forceUpdate?: boolean;\n};\nexport declare function _batch<T>(size: number, iterable: T[]): T[][];\nexport declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];\nexport declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;\nexport declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;\ninterface IndexArgs {\n docsSource: BaseDocumentLoader | DocumentInterface[];\n recordManager: RecordManagerInterface;\n vectorStore: VectorStore;\n options?: IndexOptions;\n}\n/**\n * Index data from the doc source into the vector store.\n *\n * Indexing functionality uses a manager to keep track of which documents\n * are in the vector store.\n *\n * This allows us to keep track of which documents were updated, and which\n * documents were deleted, which documents should be skipped.\n *\n * For the time being, documents are indexed using their hashes, and users\n * are not able to specify the uid of the document.\n *\n * @param {IndexArgs} args\n * @param {BaseDocumentLoader | DocumentInterface[]} args.docsSource The source of documents to index. Can be a DocumentLoader or a list of Documents.\n * @param {RecordManagerInterface} args.recordManager The record manager to use for keeping track of indexed documents.\n * @param {VectorStore} args.vectorStore The vector store to use for storing the documents.\n * @param {IndexOptions | undefined} args.options Options for indexing.\n * @returns {Promise<IndexingResult>}\n */\nexport declare function index(args: IndexArgs): Promise<IndexingResult>;\nexport {};\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;KAKKK,QAAAA,GAAWC;KACXC,cAAAA;EADAF,QAAAA,EAAAA,MAAQ;EACRE,UAAAA,EAAAA,MAAc;EAMdC,UAAAA,EAAAA,MAAe;EACHC,UAAAA,EAAAA,MAAAA;CAMHJ;KAPTG,eAAAA,GASaL,MAAAA,GAAAA,CAAAA,CAAAA,GAAAA,EATqBA,iBASrBA,EAAAA,GAAAA,MAAAA,CAAAA;AAR+BA,UAAhCM,uBAAAA,SAAgCN,iBAAAA,CAAAA;EAAiB,GAAA,EAAA,MAAA;EAUxDO,KAAAA,CAAAA,EAAAA,MAAAA;EAUWC,WAAAA,CAAAA,EAAAA,MAAe;EAMtBN,YAAAA,CAAAA,EAAAA,MAAAA;EAEUK,WAAAA,EAAAA,MAAAA;EACgBR,QAAAA,EAvB1BG,QAuB0BH;EAEtBC,eAAAA,EAAAA,EAAAA,IAAAA;EACgBA,UAAAA,EAAAA,EAxBhBA,iBAwBgBA;;UAtBxBO,kBAAAA,CAUsCD;EAAuB,WAAA,EAAA,MAAA;EAgB3DG,QAAAA,EAxBEP,QAwBS;EACXQ,GAAAA,EAAAA,MAAAA;AAoCZ;AACA;AACA;AACA;AAAoF;;AAE/CV,cA1DhBQ,eAAAA,YAA2BF,uBA0DXN,CAAAA;EAClBF,GAAAA,EAAAA,MAAAA;EACFD,KAAAA,CAAAA,EAAAA,MAAAA;EACHa,WAAAA,CAAAA,EAAAA,MAAAA;EAAY,YAAA,CAAA,EAAA,MAAA;EAqBFO,WAAK,EAAA,MAAA;EAAOD,QAAAA,EA5EtBd,QA4EsBc;EAAoBZ,QAAAA,UAAAA;EAARc,WAAAA,CAAAA,MAAAA,EA1ExBX,kBA0EwBW;EAAO,qBAAA,CAAA,YAAA,EAzEfnB,cAyEe,CAAA,EAAA,IAAA;;gBAvErCC;gCACgBA,kCAAkCQ;;;;KAIxDC,WAAAA;KACAC,YAAAA;;;;;;;;;;;;;;;;;;YAkBED;;;;;;;gBAOIJ;;;;;;;;;;;iBAWMM,kCAAkCC,MAAMA;iBACxCC,mBAAAA,kBAAqCP,4BAA4BA;iBACjEQ,oBAAAA,cAAkCT,+BAA+BL;cACpEe,4CAA4Cd;UACvDe,SAAAA;cACMf,qBAAqBD;iBAClBF;eACFD;YACHa;;;;;;;;;;;;;;;;;;;;;iBAqBUO,KAAAA,OAAYD,YAAYE,QAAQd"}
|
package/dist/indexing/base.d.ts
CHANGED
|
@@ -89,7 +89,6 @@ type IndexOptions = {
|
|
|
89
89
|
declare function _batch<T>(size: number, iterable: T[]): T[][];
|
|
90
90
|
declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];
|
|
91
91
|
declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;
|
|
92
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
93
92
|
declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;
|
|
94
93
|
interface IndexArgs {
|
|
95
94
|
docsSource: BaseDocumentLoader | DocumentInterface[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","names":["VectorStore","RecordManagerInterface","HashKeyEncoder","DocumentInterface","BaseDocumentLoader","Metadata","Record","IndexingResult","StringOrDocFunc","HashedDocumentInterface","HashedDocumentArgs","_HashedDocument","CleanupMode","IndexOptions","_batch","T","_deduplicateInOrder","_getSourceIdAssigner","_isBaseDocumentLoader","IndexArgs","index","Promise"],"sources":["../../src/indexing/base.d.ts"],"sourcesContent":["import { VectorStore } from \"../vectorstores.js\";\nimport { RecordManagerInterface } from \"./record_manager.js\";\nimport { type HashKeyEncoder } from \"../utils/hash.js\";\nimport { DocumentInterface } from \"../documents/document.js\";\nimport { BaseDocumentLoader } from \"../document_loaders/base.js\";\ntype Metadata = Record<string, unknown>;\ntype IndexingResult = {\n numAdded: number;\n numDeleted: number;\n numUpdated: number;\n numSkipped: number;\n};\ntype StringOrDocFunc = string | ((doc: DocumentInterface) => string);\nexport interface HashedDocumentInterface extends DocumentInterface {\n uid: string;\n hash_?: string;\n contentHash?: string;\n metadataHash?: string;\n pageContent: string;\n metadata: Metadata;\n calculateHashes(): void;\n toDocument(): DocumentInterface;\n}\ninterface HashedDocumentArgs {\n pageContent: string;\n metadata: Metadata;\n uid: string;\n}\n/**\n * HashedDocument is a Document with hashes calculated.\n * Hashes are calculated based on page content and metadata.\n * It is used for indexing.\n */\nexport declare class _HashedDocument implements HashedDocumentInterface {\n uid: string;\n hash_?: string;\n contentHash?: string;\n metadataHash?: string;\n pageContent: string;\n metadata: Metadata;\n private keyEncoder;\n constructor(fields: HashedDocumentArgs);\n makeDefaultKeyEncoder(keyEncoderFn: HashKeyEncoder): void;\n calculateHashes(): void;\n toDocument(): DocumentInterface;\n static fromDocument(document: DocumentInterface, uid?: string): _HashedDocument;\n private _hashStringToUUID;\n private _hashNestedDictToUUID;\n}\nexport type CleanupMode = \"full\" | \"incremental\";\nexport type IndexOptions = {\n /**\n * The number of documents to index in one batch.\n */\n batchSize?: number;\n /**\n * The cleanup mode to use. Can be \"full\", \"incremental\" or undefined.\n * - **Incremental**: Cleans up all documents that haven't been updated AND\n * that are associated with source ids that were seen\n * during indexing.\n * Clean up is done continuously during indexing helping\n * to minimize the probability of users seeing duplicated\n * content.\n * - **Full**: Delete all documents that haven to been returned by the loader.\n * Clean up runs after all documents have been indexed.\n * This means that users may see duplicated content during indexing.\n * - **undefined**: Do not delete any documents.\n */\n cleanup?: CleanupMode;\n /**\n * Optional key that helps identify the original source of the document.\n * Must either be a string representing the key of the source in the metadata\n * or a function that takes a document and returns a string representing the source.\n * **Required when cleanup is incremental**.\n */\n sourceIdKey?: StringOrDocFunc;\n /**\n * Batch size to use when cleaning up documents.\n */\n cleanupBatchSize?: number;\n /**\n * Force update documents even if they are present in the\n * record manager. Useful if you are re-indexing with updated embeddings.\n */\n forceUpdate?: boolean;\n};\nexport declare function _batch<T>(size: number, iterable: T[]): T[][];\nexport declare function _deduplicateInOrder(hashedDocuments: HashedDocumentInterface[]): HashedDocumentInterface[];\nexport declare function _getSourceIdAssigner(sourceIdKey: StringOrDocFunc | null): (doc: DocumentInterface) => string | null;\nexport declare const _isBaseDocumentLoader: (arg: any) => arg is BaseDocumentLoader;\ninterface IndexArgs {\n docsSource: BaseDocumentLoader | DocumentInterface[];\n recordManager: RecordManagerInterface;\n vectorStore: VectorStore;\n options?: IndexOptions;\n}\n/**\n * Index data from the doc source into the vector store.\n *\n * Indexing functionality uses a manager to keep track of which documents\n * are in the vector store.\n *\n * This allows us to keep track of which documents were updated, and which\n * documents were deleted, which documents should be skipped.\n *\n * For the time being, documents are indexed using their hashes, and users\n * are not able to specify the uid of the document.\n *\n * @param {IndexArgs} args\n * @param {BaseDocumentLoader | DocumentInterface[]} args.docsSource The source of documents to index. Can be a DocumentLoader or a list of Documents.\n * @param {RecordManagerInterface} args.recordManager The record manager to use for keeping track of indexed documents.\n * @param {VectorStore} args.vectorStore The vector store to use for storing the documents.\n * @param {IndexOptions | undefined} args.options Options for indexing.\n * @returns {Promise<IndexingResult>}\n */\nexport declare function index(args: IndexArgs): Promise<IndexingResult>;\nexport {};\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;KAKKK,QAAAA,GAAWC;KACXC,cAAAA;EADAF,QAAAA,EAAAA,MAAQ;EACRE,UAAAA,EAAAA,MAAc;EAMdC,UAAAA,EAAAA,MAAe;EACHC,UAAAA,EAAAA,MAAAA;CAMHJ;KAPTG,eAAAA,GASaL,MAAAA,GAAAA,CAAAA,CAAAA,GAAAA,EATqBA,iBASrBA,EAAAA,GAAAA,MAAAA,CAAAA;AAR+BA,UAAhCM,uBAAAA,SAAgCN,iBAAAA,CAAAA;EAAiB,GAAA,EAAA,MAAA;EAUxDO,KAAAA,CAAAA,EAAAA,MAAAA;EAUWC,WAAAA,CAAAA,EAAAA,MAAe;EAMtBN,YAAAA,CAAAA,EAAAA,MAAAA;EAEUK,WAAAA,EAAAA,MAAAA;EACgBR,QAAAA,EAvB1BG,QAuB0BH;EAEtBC,eAAAA,EAAAA,EAAAA,IAAAA;EACgBA,UAAAA,EAAAA,EAxBhBA,iBAwBgBA;;UAtBxBO,kBAAAA,CAUsCD;EAAuB,WAAA,EAAA,MAAA;EAgB3DG,QAAAA,EAxBEP,QAwBS;EACXQ,GAAAA,EAAAA,MAAAA;AAoCZ;AACA;AACA;AACA;AAAoF;;AAE/CV,cA1DhBQ,eAAAA,YAA2BF,uBA0DXN,CAAAA;EAClBF,GAAAA,EAAAA,MAAAA;EACFD,KAAAA,CAAAA,EAAAA,MAAAA;EACHa,WAAAA,CAAAA,EAAAA,MAAAA;EAAY,YAAA,CAAA,EAAA,MAAA;EAqBFO,WAAK,EAAA,MAAA;EAAOD,QAAAA,EA5EtBd,QA4EsBc;EAAoBZ,QAAAA,UAAAA;EAARc,WAAAA,CAAAA,MAAAA,EA1ExBX,kBA0EwBW;EAAO,qBAAA,CAAA,YAAA,EAzEfnB,cAyEe,CAAA,EAAA,IAAA;;gBAvErCC;gCACgBA,kCAAkCQ;;;;KAIxDC,WAAAA;KACAC,YAAAA;;;;;;;;;;;;;;;;;;YAkBED;;;;;;;gBAOIJ;;;;;;;;;;;iBAWMM,kCAAkCC,MAAMA;iBACxCC,mBAAAA,kBAAqCP,4BAA4BA;iBACjEQ,oBAAAA,cAAkCT,+BAA+BL;cACpEe,4CAA4Cd;UACvDe,SAAAA;cACMf,qBAAqBD;iBAClBF;eACFD;YACHa;;;;;;;;;;;;;;;;;;;;;iBAqBUO,KAAAA,OAAYD,YAAYE,QAAQd"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Serializable } from "../load/serializable.cjs";
|
|
2
2
|
|
|
3
3
|
//#region src/indexing/record_manager.d.ts
|
|
4
|
-
// Arbitrary value, used for generating namespaced UUIDs.
|
|
5
4
|
declare const UUIDV5_NAMESPACE = "10f90ea3-90a4-4962-bf75-83a0f3c1c62a";
|
|
6
5
|
type UpdateOptions = {
|
|
7
6
|
groupIds?: (string | null)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record_manager.d.cts","names":["Serializable","UUIDV5_NAMESPACE","UpdateOptions","ListKeyOptions","RecordManagerInterface","Promise","RecordManager"],"sources":["../../src/indexing/record_manager.d.ts"],"sourcesContent":["import { Serializable } from \"../load/serializable.js\";\nexport declare const UUIDV5_NAMESPACE = \"10f90ea3-90a4-4962-bf75-83a0f3c1c62a\";\nexport type UpdateOptions = {\n groupIds?: (string | null)[];\n timeAtLeast?: number;\n};\nexport type ListKeyOptions = {\n before?: number;\n after?: number;\n groupIds?: (string | null)[];\n limit?: number;\n};\nexport interface RecordManagerInterface {\n /**\n * Creates schema in the record manager.\n * @returns Promise\n */\n createSchema(): Promise<void>;\n /**\n * Returns current time from the record manager.\n * @returns Current time\n */\n getTime(): Promise<number>;\n /**\n * Updates keys in the record manager.\n * @param keys List of keys to update\n * @param groupIds List of groupIds to update\n * @param timeAtLeast Update only if current time is at least this value\n * @returns Promise\n * @throws Error if timeAtLeast is provided and current time is less than timeAtLeast\n * @throws Error if number of keys does not match number of groupIds\n */\n update(keys: string[], updateOptions: UpdateOptions): Promise<void>;\n /**\n * Checks if keys exist in the record manager.\n * @param keys List of keys to check\n * @returns List of booleans indicating if key exists in same order as provided keys\n */\n exists(keys: string[]): Promise<boolean[]>;\n /**\n * Lists keys from the record manager.\n * @param before List keys before this timestamp\n * @param after List keys after this timestamp\n * @param groupIds List keys with these groupIds\n * @param limit Limit the number of keys returned\n * @returns List of keys\n *\n */\n listKeys(options: ListKeyOptions): Promise<string[]>;\n /**\n * Deletes keys from the record manager.\n * @param keys List of keys to delete\n */\n deleteKeys(keys: string[]): Promise<void>;\n}\nexport declare abstract class RecordManager extends Serializable implements RecordManagerInterface {\n lc_namespace: string[];\n abstract createSchema(): Promise<void>;\n abstract getTime(): Promise<number>;\n abstract update(keys: string[], updateOptions?: UpdateOptions): Promise<void>;\n abstract exists(keys: string[]): Promise<boolean[]>;\n abstract listKeys(options?: ListKeyOptions): Promise<string[]>;\n abstract deleteKeys(keys: string[]): Promise<void>;\n}\n//# sourceMappingURL=record_manager.d.ts.map"],"mappings":";;;cACqBC,gBAAAA;KACTC,aAAAA;EADSD,QAAAA,CAAAA,EAAAA,CAAAA,MAAAA,GAAgB,IAAA,CAAA,EAAA;EACzBC,WAAAA,CAAAA,EAAAA,MAAa;AAIzB,CAAA;AAMiBE,KANLD,cAAAA,GAM2B;EAKnBE,MAAAA,CAAAA,EAAAA,MAAAA;EAKLA,KAAAA,CAAAA,EAAAA,MAAAA;EAU2BH,QAAAA,CAAAA,EAAAA,CAAAA,MAAAA,GAAAA,IAAAA,CAAAA,EAAAA;EAAgBG,KAAAA,CAAAA,EAAAA,MAAAA;CAM9BA;AAUNF,UApCLC,sBAAAA,CAoCKD;EAAiBE;;AAKA;AAEvC;EAE6BA,YAAAA,EAAAA,EAxCTA,OAwCSA,CAAAA,IAAAA,CAAAA;EACLA;;;;EAGQF,OAAAA,EAAAA,EAvCjBE,OAuCiBF,CAAAA,MAAAA,CAAAA;EAAiBE;;;;AANiD;;;;;wCAvBxDH,gBAAgBG;;;;;;0BAM9BA;;;;;;;;;;oBAUNF,iBAAiBE;;;;;8BAKPA;;uBAEFC,aAAAA,SAAsBN,YAAAA,YAAwBI;;2BAE/CC;sBACLA;kDAC4BH,gBAAgBG;mCAC/BA;8BACLF,iBAAiBE;uCACRA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Serializable } from "../load/serializable.js";
|
|
2
2
|
|
|
3
3
|
//#region src/indexing/record_manager.d.ts
|
|
4
|
-
// Arbitrary value, used for generating namespaced UUIDs.
|
|
5
4
|
declare const UUIDV5_NAMESPACE = "10f90ea3-90a4-4962-bf75-83a0f3c1c62a";
|
|
6
5
|
type UpdateOptions = {
|
|
7
6
|
groupIds?: (string | null)[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record_manager.d.ts","names":["Serializable","UUIDV5_NAMESPACE","UpdateOptions","ListKeyOptions","RecordManagerInterface","Promise","RecordManager"],"sources":["../../src/indexing/record_manager.d.ts"],"sourcesContent":["import { Serializable } from \"../load/serializable.js\";\nexport declare const UUIDV5_NAMESPACE = \"10f90ea3-90a4-4962-bf75-83a0f3c1c62a\";\nexport type UpdateOptions = {\n groupIds?: (string | null)[];\n timeAtLeast?: number;\n};\nexport type ListKeyOptions = {\n before?: number;\n after?: number;\n groupIds?: (string | null)[];\n limit?: number;\n};\nexport interface RecordManagerInterface {\n /**\n * Creates schema in the record manager.\n * @returns Promise\n */\n createSchema(): Promise<void>;\n /**\n * Returns current time from the record manager.\n * @returns Current time\n */\n getTime(): Promise<number>;\n /**\n * Updates keys in the record manager.\n * @param keys List of keys to update\n * @param groupIds List of groupIds to update\n * @param timeAtLeast Update only if current time is at least this value\n * @returns Promise\n * @throws Error if timeAtLeast is provided and current time is less than timeAtLeast\n * @throws Error if number of keys does not match number of groupIds\n */\n update(keys: string[], updateOptions: UpdateOptions): Promise<void>;\n /**\n * Checks if keys exist in the record manager.\n * @param keys List of keys to check\n * @returns List of booleans indicating if key exists in same order as provided keys\n */\n exists(keys: string[]): Promise<boolean[]>;\n /**\n * Lists keys from the record manager.\n * @param before List keys before this timestamp\n * @param after List keys after this timestamp\n * @param groupIds List keys with these groupIds\n * @param limit Limit the number of keys returned\n * @returns List of keys\n *\n */\n listKeys(options: ListKeyOptions): Promise<string[]>;\n /**\n * Deletes keys from the record manager.\n * @param keys List of keys to delete\n */\n deleteKeys(keys: string[]): Promise<void>;\n}\nexport declare abstract class RecordManager extends Serializable implements RecordManagerInterface {\n lc_namespace: string[];\n abstract createSchema(): Promise<void>;\n abstract getTime(): Promise<number>;\n abstract update(keys: string[], updateOptions?: UpdateOptions): Promise<void>;\n abstract exists(keys: string[]): Promise<boolean[]>;\n abstract listKeys(options?: ListKeyOptions): Promise<string[]>;\n abstract deleteKeys(keys: string[]): Promise<void>;\n}\n//# sourceMappingURL=record_manager.d.ts.map"],"mappings":";;;cACqBC,gBAAAA;KACTC,aAAAA;EADSD,QAAAA,CAAAA,EAAAA,CAAAA,MAAAA,GAAgB,IAAA,CAAA,EAAA;EACzBC,WAAAA,CAAAA,EAAAA,MAAa;AAIzB,CAAA;AAMiBE,KANLD,cAAAA,GAM2B;EAKnBE,MAAAA,CAAAA,EAAAA,MAAAA;EAKLA,KAAAA,CAAAA,EAAAA,MAAAA;EAU2BH,QAAAA,CAAAA,EAAAA,CAAAA,MAAAA,GAAAA,IAAAA,CAAAA,EAAAA;EAAgBG,KAAAA,CAAAA,EAAAA,MAAAA;CAM9BA;AAUNF,UApCLC,sBAAAA,CAoCKD;EAAiBE;;AAKA;AAEvC;EAE6BA,YAAAA,EAAAA,EAxCTA,OAwCSA,CAAAA,IAAAA,CAAAA;EACLA;;;;EAGQF,OAAAA,EAAAA,EAvCjBE,OAuCiBF,CAAAA,MAAAA,CAAAA;EAAiBE;;;;AANiD;;;;;wCAvBxDH,gBAAgBG;;;;;;0BAM9BA;;;;;;;;;;oBAUNF,iBAAiBE;;;;;8BAKPA;;uBAEFC,aAAAA,SAAsBN,YAAAA,YAAwBI;;2BAE/CC;sBACLA;kDAC4BH,gBAAgBG;mCAC/BA;8BACLF,iBAAiBE;uCACRA"}
|
|
@@ -14,7 +14,6 @@ import { $ZodType } from "zod/v4/core";
|
|
|
14
14
|
import { TiktokenModel } from "js-tiktoken/lite";
|
|
15
15
|
|
|
16
16
|
//#region src/language_models/base.d.ts
|
|
17
|
-
// https://www.npmjs.com/package/js-tiktoken
|
|
18
17
|
declare const getModelNameForTiktoken: (modelName: string) => TiktokenModel;
|
|
19
18
|
declare const getEmbeddingContextSize: (modelName?: string | undefined) => number;
|
|
20
19
|
/**
|
|
@@ -152,15 +151,12 @@ type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {
|
|
|
152
151
|
/** @deprecated Use StructuredOutputMethodOptions instead */
|
|
153
152
|
type StructuredOutputMethodParams<RunOutput, IncludeRaw extends boolean = false> = {
|
|
154
153
|
/** @deprecated Pass schema in as the first argument */
|
|
155
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
156
154
|
schema: InteropZodType<RunOutput> | Record<string, any>;
|
|
157
155
|
name?: string;
|
|
158
156
|
method?: "functionCalling" | "jsonMode";
|
|
159
157
|
includeRaw?: IncludeRaw;
|
|
160
158
|
};
|
|
161
|
-
interface BaseLanguageModelInterface<
|
|
162
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
163
|
-
RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
|
|
159
|
+
interface BaseLanguageModelInterface<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
|
|
164
160
|
get callKeys(): string[];
|
|
165
161
|
generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
|
|
166
162
|
_modelType(): string;
|
|
@@ -169,7 +165,6 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
169
165
|
/**
|
|
170
166
|
* Get the identifying parameters of the LLM.
|
|
171
167
|
*/
|
|
172
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
173
168
|
_identifyingParams(): Record<string, any>;
|
|
174
169
|
serialize(): SerializedLLM;
|
|
175
170
|
}
|
|
@@ -178,9 +173,7 @@ type LanguageModelLike = Runnable<BaseLanguageModelInput, LanguageModelOutput>;
|
|
|
178
173
|
/**
|
|
179
174
|
* Base class for language models.
|
|
180
175
|
*/
|
|
181
|
-
declare abstract class BaseLanguageModel<
|
|
182
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
183
|
-
RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
|
|
176
|
+
declare abstract class BaseLanguageModel<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
|
|
184
177
|
/**
|
|
185
178
|
* Keys that the language model accepts as call options.
|
|
186
179
|
*/
|
|
@@ -210,16 +203,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
210
203
|
/**
|
|
211
204
|
* Get the identifying parameters of the LLM.
|
|
212
205
|
*/
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
214
206
|
_identifyingParams(): Record<string, any>;
|
|
215
207
|
/**
|
|
216
208
|
* Create a unique cache key for a specific call to a specific language model.
|
|
217
209
|
* @param callOptions Call options for the model
|
|
218
210
|
* @returns A unique cache key.
|
|
219
211
|
*/
|
|
220
|
-
_getSerializedCacheKeyParametersForCall(
|
|
221
|
-
// TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
|
|
222
|
-
{
|
|
212
|
+
_getSerializedCacheKeyParametersForCall({
|
|
223
213
|
config,
|
|
224
214
|
...callOptions
|
|
225
215
|
}: CallOptions & {
|
|
@@ -241,29 +231,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
241
231
|
* @returns {ModelProfile} An object describing the model's capabilities and constraints
|
|
242
232
|
*/
|
|
243
233
|
get profile(): ModelProfile;
|
|
244
|
-
withStructuredOutput?<
|
|
245
|
-
|
|
246
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
|
|
247
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
248
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
249
|
-
withStructuredOutput?<
|
|
250
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
251
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
253
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
234
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
235
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
254
236
|
raw: BaseMessage;
|
|
255
237
|
parsed: RunOutput;
|
|
256
238
|
}>;
|
|
257
|
-
withStructuredOutput?<
|
|
258
|
-
|
|
259
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
|
|
260
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
261
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
262
|
-
withStructuredOutput?<
|
|
263
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
264
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
|
|
265
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
266
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
239
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
240
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
267
241
|
raw: BaseMessage;
|
|
268
242
|
parsed: RunOutput;
|
|
269
243
|
}>;
|
|
@@ -280,11 +254,7 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
280
254
|
* @param {boolean | undefined} [includeRaw=false] Whether to include the raw output in the result. Defaults to false.
|
|
281
255
|
* @returns {Runnable<RunInput, RunOutput> | Runnable<RunInput, { raw: BaseMessage; parsed: RunOutput }>} A new runnable that calls the LLM with structured output.
|
|
282
256
|
*/
|
|
283
|
-
withStructuredOutput?<
|
|
284
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
285
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput>
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
257
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
288
258
|
raw: BaseMessage;
|
|
289
259
|
parsed: RunOutput;
|
|
290
260
|
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.cts","names":["TiktokenModel","ZodType","ZodTypeV3","$ZodType","ZodTypeV4","BaseCache","BasePromptValueInterface","BaseMessage","BaseMessageLike","MessageContent","LLMResult","CallbackManager","Callbacks","AsyncCaller","AsyncCallerParams","Runnable","RunnableInterface","RunnableConfig","JSONSchema","InferInteropZodOutput","InteropZodObject","InteropZodType","ModelProfile","getModelNameForTiktoken","getEmbeddingContextSize","getModelContextSize","isOpenAITool","ToolDefinition","CalculateMaxTokenProps","calculateMaxTokens","prompt","modelName","Promise","SerializedLLM","Record","BaseLangChainParams","BaseLangChain","RunInput","RunOutput","CallOptions","BaseLanguageModelParams","BaseLanguageModelTracingCallOptions","BaseLanguageModelCallOptions","FunctionDefinition","FunctionCallOption","BaseFunctionCallOptions","BaseLanguageModelInput","StructuredOutputType","StructuredOutputMethodOptions","IncludeRaw","StructuredOutputMethodParams","BaseLanguageModelInterface","LanguageModelOutput","LanguageModelLike","BaseLanguageModel","callbacks","callbackManager","config","TokenUsage"],"sources":["../../src/language_models/base.d.ts"],"sourcesContent":["import type { TiktokenModel } from \"js-tiktoken/lite\";\nimport type { ZodType as ZodTypeV3 } from \"zod/v3\";\nimport type { $ZodType as ZodTypeV4 } from \"zod/v4/core\";\nimport { type BaseCache } from \"../caches/index.js\";\nimport { type BasePromptValueInterface } from \"../prompt_values.js\";\nimport { type BaseMessage, type BaseMessageLike, type MessageContent } from \"../messages/base.js\";\nimport { type LLMResult } from \"../outputs.js\";\nimport { CallbackManager, Callbacks } from \"../callbacks/manager.js\";\nimport { AsyncCaller, AsyncCallerParams } from \"../utils/async_caller.js\";\nimport { Runnable, type RunnableInterface } from \"../runnables/base.js\";\nimport { RunnableConfig } from \"../runnables/config.js\";\nimport { JSONSchema } from \"../utils/json_schema.js\";\nimport { InferInteropZodOutput, InteropZodObject, InteropZodType } from \"../utils/types/zod.js\";\nimport { ModelProfile } from \"./profile.js\";\nexport declare const getModelNameForTiktoken: (modelName: string) => TiktokenModel;\nexport declare const getEmbeddingContextSize: (modelName?: string | undefined) => number;\n/**\n * Get the context window size (max input tokens) for a given model.\n *\n * Context window sizes are sourced from official model documentation:\n * - OpenAI: https://platform.openai.com/docs/models\n * - Anthropic: https://docs.anthropic.com/claude/docs/models-overview\n * - Google: https://ai.google.dev/gemini/docs/models/gemini\n *\n * @param modelName - The name of the model\n * @returns The context window size in tokens\n */\nexport declare const getModelContextSize: (modelName: string) => number;\n/**\n * Whether or not the input matches the OpenAI tool definition.\n * @param {unknown} tool The input to check.\n * @returns {boolean} Whether the input is an OpenAI tool definition.\n */\nexport declare function isOpenAITool(tool: unknown): tool is ToolDefinition;\ninterface CalculateMaxTokenProps {\n prompt: string;\n modelName: TiktokenModel;\n}\nexport declare const calculateMaxTokens: ({ prompt, modelName, }: CalculateMaxTokenProps) => Promise<number>;\nexport type SerializedLLM = {\n _model: string;\n _type: string;\n} & Record<string, any>;\nexport interface BaseLangChainParams {\n verbose?: boolean;\n callbacks?: Callbacks;\n tags?: string[];\n metadata?: Record<string, unknown>;\n}\n/**\n * Base class for language models, chains, tools.\n */\nexport declare abstract class BaseLangChain<RunInput, RunOutput, CallOptions extends RunnableConfig = RunnableConfig> extends Runnable<RunInput, RunOutput, CallOptions> implements BaseLangChainParams {\n /**\n * Whether to print out response text.\n */\n verbose: boolean;\n callbacks?: Callbacks;\n tags?: string[];\n metadata?: Record<string, unknown>;\n get lc_attributes(): {\n [key: string]: undefined;\n } | undefined;\n constructor(params: BaseLangChainParams);\n}\n/**\n * Base interface for language model parameters.\n * A subclass of {@link BaseLanguageModel} should have a constructor that\n * takes in a parameter that extends this interface.\n */\nexport interface BaseLanguageModelParams extends AsyncCallerParams, BaseLangChainParams {\n /**\n * @deprecated Use `callbacks` instead\n */\n callbackManager?: CallbackManager;\n cache?: BaseCache | boolean;\n}\nexport interface BaseLanguageModelTracingCallOptions {\n /**\n * Describes the format of structured outputs.\n * This should be provided if an output is considered to be structured\n */\n ls_structured_output_format?: {\n /**\n * An object containing the method used for structured output (e.g., \"jsonMode\").\n */\n kwargs: {\n method: string;\n };\n /**\n * The JSON schema describing the expected output structure.\n */\n schema?: JSONSchema;\n };\n}\nexport interface BaseLanguageModelCallOptions extends RunnableConfig, BaseLanguageModelTracingCallOptions {\n /**\n * Stop tokens to use for this call.\n * If not provided, the default stop tokens for the model will be used.\n */\n stop?: string[];\n}\nexport interface FunctionDefinition {\n /**\n * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain\n * underscores and dashes, with a maximum length of 64.\n */\n name: string;\n /**\n * The parameters the functions accepts, described as a JSON Schema object. See the\n * [guide](https://platform.openai.com/docs/guides/gpt/function-calling) for\n * examples, and the\n * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for\n * documentation about the format.\n *\n * To describe a function that accepts no parameters, provide the value\n * `{\"type\": \"object\", \"properties\": {}}`.\n */\n parameters: Record<string, unknown> | JSONSchema;\n /**\n * A description of what the function does, used by the model to choose when and\n * how to call the function.\n */\n description?: string;\n}\nexport interface ToolDefinition {\n type: \"function\";\n function: FunctionDefinition;\n}\nexport type FunctionCallOption = {\n name: string;\n};\nexport interface BaseFunctionCallOptions extends BaseLanguageModelCallOptions {\n function_call?: FunctionCallOption;\n functions?: FunctionDefinition[];\n}\nexport type BaseLanguageModelInput = BasePromptValueInterface | string | BaseMessageLike[];\nexport type StructuredOutputType = InferInteropZodOutput<InteropZodObject>;\nexport type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {\n name?: string;\n method?: \"functionCalling\" | \"jsonMode\" | \"jsonSchema\" | string;\n includeRaw?: IncludeRaw;\n /** Whether to use strict mode. Currently only supported by OpenAI models. */\n strict?: boolean;\n};\n/** @deprecated Use StructuredOutputMethodOptions instead */\nexport type StructuredOutputMethodParams<RunOutput, IncludeRaw extends boolean = false> = {\n /** @deprecated Pass schema in as the first argument */\n schema: InteropZodType<RunOutput> | Record<string, any>;\n name?: string;\n method?: \"functionCalling\" | \"jsonMode\";\n includeRaw?: IncludeRaw;\n};\nexport interface BaseLanguageModelInterface<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {\n get callKeys(): string[];\n generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;\n _modelType(): string;\n _llmType(): string;\n getNumTokens(content: MessageContent): Promise<number>;\n /**\n * Get the identifying parameters of the LLM.\n */\n _identifyingParams(): Record<string, any>;\n serialize(): SerializedLLM;\n}\nexport type LanguageModelOutput = BaseMessage | string;\nexport type LanguageModelLike = Runnable<BaseLanguageModelInput, LanguageModelOutput>;\n/**\n * Base class for language models.\n */\nexport declare abstract class BaseLanguageModel<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {\n /**\n * Keys that the language model accepts as call options.\n */\n get callKeys(): string[];\n /**\n * The async caller should be used by subclasses to make any async calls,\n * which will thus benefit from the concurrency and retry logic.\n */\n caller: AsyncCaller;\n cache?: BaseCache;\n constructor({ callbacks, callbackManager, ...params }: BaseLanguageModelParams);\n abstract generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;\n abstract _modelType(): string;\n abstract _llmType(): string;\n private _encoding?;\n /**\n * Get the number of tokens in the content.\n * @param content The content to get the number of tokens for.\n * @returns The number of tokens in the content.\n */\n getNumTokens(content: MessageContent): Promise<number>;\n protected static _convertInputToPromptValue(input: BaseLanguageModelInput): BasePromptValueInterface;\n /**\n * Get the identifying parameters of the LLM.\n */\n _identifyingParams(): Record<string, any>;\n /**\n * Create a unique cache key for a specific call to a specific language model.\n * @param callOptions Call options for the model\n * @returns A unique cache key.\n */\n _getSerializedCacheKeyParametersForCall({ config, ...callOptions }: CallOptions & {\n config?: RunnableConfig;\n }): string;\n /**\n * @deprecated\n * Return a json-like object representing this LLM.\n */\n serialize(): SerializedLLM;\n /**\n * @deprecated\n * Load an LLM from a json-like object describing it.\n */\n static deserialize(_data: SerializedLLM): Promise<BaseLanguageModel>;\n /**\n * Return profiling information for the model.\n *\n * @returns {ModelProfile} An object describing the model's capabilities and constraints\n */\n get profile(): ModelProfile;\n withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodTypeV3<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodTypeV3<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodTypeV4<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;\n withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodTypeV4<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n /**\n * Model wrapper that returns outputs formatted to match the given schema.\n *\n * @template {BaseLanguageModelInput} RunInput The input type for the Runnable, expected to be the same input for the LLM.\n * @template {Record<string, any>} RunOutput The output type for the Runnable, expected to be a Zod schema object for structured output validation.\n *\n * @param {InteropZodType<RunOutput>} schema The schema for the structured output. Either as a Zod schema or a valid JSON schema object.\n * If a Zod schema is passed, the returned attributes will be validated, whereas with JSON schema they will not be.\n * @param {string} name The name of the function to call.\n * @param {\"functionCalling\" | \"jsonMode\"} [method=functionCalling] The method to use for getting the structured output. Defaults to \"functionCalling\".\n * @param {boolean | undefined} [includeRaw=false] Whether to include the raw output in the result. Defaults to false.\n * @returns {Runnable<RunInput, RunOutput> | Runnable<RunInput, { raw: BaseMessage; parsed: RunOutput }>} A new runnable that calls the LLM with structured output.\n */\n withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {\n raw: BaseMessage;\n parsed: RunOutput;\n }>;\n}\n/**\n * Shared interface for token usage\n * return type from LLM calls.\n */\nexport interface TokenUsage {\n completionTokens?: number;\n promptTokens?: number;\n totalTokens?: number;\n}\nexport {};\n//# sourceMappingURL=base.d.ts.map"],"mappings":";;;;;;;;;;;;;;;;cAcqBuB,gDAAgDvB;cAChDwB;AADrB;AACA;AAYA;AAMA;AAA4E;AAK5E;;;;;AAAoG;AACxFS,cAZSR,mBAeX,EAAA,CAAA,SAAA,EAAA,MAAA,EAAA,GAAA,MAAA;AACV;AASA;;;;AAAiJa,iBAnBzHZ,YAAAA,CAmByHY,IAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA,IAnBpFX,cAmBoFW;UAlBvIV,sBAAAA,CAkBkJW;EAK5I3B,MAAAA,EAAAA,MAAAA;EAEDsB,SAAAA,EAvBAlC,aAuBAkC;;AAP+GnB,cAdzGc,kBAcyGd,EAAAA,CAAAA;EAAAA,MAAAA;EAAAA;AAAAA,CAAAA,EAd5Da,sBAc4Db,EAAAA,GAdjCiB,OAciCjB,CAAAA,MAAAA,CAAAA;AAAsDoB,KAbxKF,aAAAA,GAawKE;EAAmB,MAAA,EAAA,MAAA;EAkBtLK,KAAAA,EAAAA,MAAAA;CAIK7B,GAhClBuB,MAgCkBvB,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;AACVN,UAhCK8B,mBAAAA,CAgCL9B;EALqCS,OAAAA,CAAAA,EAAAA,OAAAA;EAAmBqB,SAAAA,CAAAA,EAzBpDvB,SAyBoDuB;EAAmB,IAAA,CAAA,EAAA,MAAA,EAAA;EAOtEM,QAAAA,CAAAA,EA9BFP,MA8BEO,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;AAkBjB;AAOA;AAuBA;AAIA;AAGiBI,uBAhFaT,aAgFU,CAAA,QAAA,EAAA,SAAA,EAAA,oBAhF6CnB,cAgF7C,GAhF8DA,cAgF9D,CAAA,SAhFsFF,QAgFtF,CAhF+FsB,QAgF/F,EAhFyGC,SAgFzG,EAhFoHC,WAgFpH,CAAA,YAhF4IJ,mBAgF5I,CAAA;EACpBS;;;EADyD,OAAA,EAAA,OAAA;EAIjEE,SAAAA,CAAAA,EA/EIlC,SA+EJkC;EACAC,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA;EACAC,QAAAA,CAAAA,EA/EGd,MA+EHc,CAAAA,MAAAA,EAAAA,OAA6B,CAAA;EAQ7BE,IAAAA,aAAAA,CAAAA,CAAAA,EAAAA;IAEeZ,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,SAAAA;EAAfjB,CAAAA,GAAAA,SAAAA;EAA4Ba,WAAAA,CAAAA,MAAAA,EArFhBC,mBAqFgBD;;AAGb;AAE3B;;;;AAAgMI,UAnF/KE,uBAAAA,SAAgC1B,iBAmF+IwB,EAnF5HH,mBAmF4HG,CAAAA;EAAWC;;;EAEhG3B,eAAAA,CAAAA,EAjFrFD,eAiFqFC;EAAoBF,KAAAA,CAAAA,EAhFnHL,SAgFmHK,GAAAA,OAAAA;;AAGrGD,UAjFTgC,mCAAAA,CAiFShC;EAAiBuB;;;;EAL4H,2BAAA,CAAA,EAAA;IAY3JoB;AACZ;;IAAiEA,MAAAA,EAAAA;MAAjCrC,MAAAA,EAAAA,MAAAA;IAAQ,CAAA;IAIVuC;;;IAA0IR,MAAAA,CAAAA,EA9EvJ5B,eA8EuJ4B;EAAwBR,CAAAA;;AAAuFA,UA3EtQI,4BAAAA,SAAqCzB,cA2EiOqB,EA3EjNG,mCA2EiNH,CAAAA;EAAWC;;;;EAWrQiB,IAAAA,CAAAA,EAAAA,MAAAA,EAAAA;;AACalD,UAhFzBqC,kBAAAA,CAgFyBrC;EAAiDiC;;;;EASjE9B,IAAAA,EAAAA,MAAAA;EAAiBuB;;;;;;;;;;EAuBGA,UAAAA,EAhG9BE,MAgG8BF,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAhGJd,eAgGIc;EAM3BV;;;;EAC4EpB,WAAAA,CAAAA,EAAAA,MAAAA;;AAAqD8C,UAhGnIrB,cAAAA,CAgGmIqB;EAAgDF,IAAAA,EAAAA,UAAAA;EAAwBR,QAAAA,EA9F9MK,kBA8F8ML;;AAChLJ,KA7FhCU,kBAAAA,GA6FgCV;EAAsBA,IAAAA,EAAAA,MAAAA;CAAuCI;AAAVpC,UA1F9E2C,uBAAAA,SAAgCH,4BA0F8CxC,CAAAA;EAAuBgC,aAAAA,CAAAA,EAzFlGU,kBAyFkGV;EAA8Bc,SAAAA,CAAAA,EAxFpIL,kBAwFoIK,EAAAA;;AACvIzC,KAvFDuC,sBAAAA,GAAyBxC,wBAuFxBC,GAAAA,MAAAA,GAvF4DC,eAuF5DD,EAAAA;AACG+B,KAvFJS,oBAAAA,GAAuB5B,qBAuFnBmB,CAvFyClB,gBAuFzCkB,CAAAA;AAF0KvB,KApF9KiC,6BAoF8KjC,CAAAA,mBAAAA,OAAAA,GAAAA,KAAAA,CAAAA,GAAAA;EAI9ImB,IAAAA,CAAAA,EAAAA,MAAAA;EAAsBA,MAAAA,CAAAA,EAAAA,iBAAAA,GAAAA,UAAAA,GAAAA,YAAAA,GAAAA,MAAAA;EAAuCI,UAAAA,CAAAA,EArFxFW,UAqFwFX;EAAVlC;EAAuB8B,MAAAA,CAAAA,EAAAA,OAAAA;CAA8Bc;;AAAwEV,KAhFhNY,4BAgFgNZ,CAAAA,SAAAA,EAAAA,mBAAAA,OAAAA,GAAAA,KAAAA,CAAAA,GAAAA;EAAjCvB;EAC/ImB,MAAAA,EA/EhCb,cA+EgCa,CA/EjBI,SA+EiBJ,CAAAA,GA/EJA,MA+EIA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;EAAsBA,IAAAA,CAAAA,EAAAA,MAAAA;EAAuCI,MAAAA,CAAAA,EAAAA,iBAAAA,GAAAA,UAAAA;EAAVlC,UAAAA,CAAAA,EA5E9E6C,UA4E8E7C;CAAuB8B;AAA8Bc,UA1EnIG,0BA0EmIH,CAAAA,YAAAA,GAAAA,EAAAA,oBA1EnEN,4BA0EmEM,GA1EpCN,4BA0EoCM,CAAAA,SA1EEhC,iBA0EFgC,CA1EoBF,sBA0EpBE,EA1E4CV,SA0E5CU,EA1EuDT,WA0EvDS,CAAAA,CAAAA;EAA+CF,IAAAA,QAAAA,EAAAA,EAAAA,MAAAA,EAAAA;EACtLvC,cAAAA,CAAAA,YAAAA,EAzEoBD,wBAyEpBC,EAAAA,EAAAA,OAAAA,CAAAA,EAAAA,MAAAA,EAAAA,GAzEqEgC,WAyErEhC,EAAAA,SAAAA,CAAAA,EAzE8FK,SAyE9FL,CAAAA,EAzE0GyB,OAyE1GzB,CAzEkHG,SAyElHH,CAAAA;EACG+B,UAAAA,EAAAA,EAAAA,MAAAA;EAF0KvB,QAAAA,EAAAA,EAAAA,MAAAA;EAiB9ImB,YAAAA,CAAAA,OAAAA,EAtFlBzB,cAsFkByB,CAAAA,EAtFDF,OAsFCE,CAAAA,MAAAA,CAAAA;EAAsBA;;;EAAyDA,kBAAAA,EAAAA,EAlFjGA,MAkFiGA,CAAAA,MAAAA,EAAAA,GAAAA,CAAAA;EAA8Bc,SAAAA,EAAAA,EAjFxIf,aAiFwIe;;AAA0EV,KA/EvNc,mBAAAA,GAAsB7C,WA+EiM+B,GAAAA,MAAAA;AAAjCvB,KA9EtLsC,iBAAAA,GAAoBtC,QA8EkKA,CA9EzJ+B,sBA8EyJ/B,EA9EjIqC,mBA8EiIrC,CAAAA;;;;AAA8CA,uBA1ElNuC,iBA0EkNvC,CAAAA,YAAAA,GAAAA,EAAAA,oBA1E3J2B,4BA0E2J3B,GA1E5H2B,4BA0E4H3B,CAAAA,SA1EtFqB,aA0EsFrB,CA1ExE+B,sBA0EwE/B,EA1EhDuB,SA0EgDvB,EA1ErCwB,WA0EqCxB,CAAAA,YA1EbyB,uBA0EazB,EA1EYoC,0BA0EZpC,CA1EuCuB,SA0EvCvB,EA1EkDwB,WA0ElDxB,CAAAA,CAAAA;EA1EtFqB;;;EAA4H,IAAA,QAAA,CAAA,CAAA,EAAA,MAAA,EAAA;EAmFrQsB;;;;UA1EL7C;UACAR;;;;;KAC+CmC;wCACjBlC,iDAAiDiC,yBAAyB3B,YAAYoB,QAAQtB;;;;;;;;;wBAS9GD,iBAAiBuB;qDACYc,yBAAyBxC;;;;wBAItD4B;;;;;;;;;KAM8CK;aACvDtB;;;;;;eAMAgB;;;;;4BAKaA,gBAAgBD,QAAQsB;;;;;;iBAMnChC;0CACyBY,sBAAsBA,6BAA6BhC,QAAUoC,aAAaJ,8BAA8Bc,uCAAuCjC,SAAS+B,wBAAwBR;0CAChLJ,sBAAsBA,6BAA6BhC,QAAUoC,aAAaJ,8BAA8Bc,sCAAsCjC,SAAS+B;SACtLvC;YACG+B;;0CAE4BJ,sBAAsBA,6BAA6B9B,SAAUkC,aAAaJ,8BAA8Bc,uCAAuCjC,SAAS+B,wBAAwBR;0CAChLJ,sBAAsBA,6BAA6B9B,SAAUkC,aAAaJ,8BAA8Bc,sCAAsCjC,SAAS+B;SACtLvC;YACG+B;;;;;;;;;;;;;;;0CAe4BJ,sBAAsBA,6BAA6Bb,eAAeiB,aAAaJ,8BAA8Bc,yCAAyCjC,SAAS+B,wBAAwBR,aAAavB,SAAS+B;SAC5OvC;YACG+B;;;;;;;UAOCoB,UAAAA"}
|
|
@@ -16,7 +16,6 @@ import { $ZodType } from "zod/v4/core";
|
|
|
16
16
|
import { TiktokenModel } from "js-tiktoken/lite";
|
|
17
17
|
|
|
18
18
|
//#region src/language_models/base.d.ts
|
|
19
|
-
// https://www.npmjs.com/package/js-tiktoken
|
|
20
19
|
declare const getModelNameForTiktoken: (modelName: string) => TiktokenModel;
|
|
21
20
|
declare const getEmbeddingContextSize: (modelName?: string | undefined) => number;
|
|
22
21
|
/**
|
|
@@ -154,15 +153,12 @@ type StructuredOutputMethodOptions<IncludeRaw extends boolean = false> = {
|
|
|
154
153
|
/** @deprecated Use StructuredOutputMethodOptions instead */
|
|
155
154
|
type StructuredOutputMethodParams<RunOutput, IncludeRaw extends boolean = false> = {
|
|
156
155
|
/** @deprecated Pass schema in as the first argument */
|
|
157
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
158
156
|
schema: InteropZodType<RunOutput> | Record<string, any>;
|
|
159
157
|
name?: string;
|
|
160
158
|
method?: "functionCalling" | "jsonMode";
|
|
161
159
|
includeRaw?: IncludeRaw;
|
|
162
160
|
};
|
|
163
|
-
interface BaseLanguageModelInterface<
|
|
164
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
165
|
-
RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
|
|
161
|
+
interface BaseLanguageModelInterface<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends RunnableInterface<BaseLanguageModelInput, RunOutput, CallOptions> {
|
|
166
162
|
get callKeys(): string[];
|
|
167
163
|
generatePrompt(promptValues: BasePromptValueInterface[], options?: string[] | CallOptions, callbacks?: Callbacks): Promise<LLMResult>;
|
|
168
164
|
_modelType(): string;
|
|
@@ -171,7 +167,6 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
171
167
|
/**
|
|
172
168
|
* Get the identifying parameters of the LLM.
|
|
173
169
|
*/
|
|
174
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
170
|
_identifyingParams(): Record<string, any>;
|
|
176
171
|
serialize(): SerializedLLM;
|
|
177
172
|
}
|
|
@@ -180,9 +175,7 @@ type LanguageModelLike = Runnable<BaseLanguageModelInput, LanguageModelOutput>;
|
|
|
180
175
|
/**
|
|
181
176
|
* Base class for language models.
|
|
182
177
|
*/
|
|
183
|
-
declare abstract class BaseLanguageModel<
|
|
184
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
185
|
-
RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
|
|
178
|
+
declare abstract class BaseLanguageModel<RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguageModelCallOptions> extends BaseLangChain<BaseLanguageModelInput, RunOutput, CallOptions> implements BaseLanguageModelParams, BaseLanguageModelInterface<RunOutput, CallOptions> {
|
|
186
179
|
/**
|
|
187
180
|
* Keys that the language model accepts as call options.
|
|
188
181
|
*/
|
|
@@ -212,16 +205,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
212
205
|
/**
|
|
213
206
|
* Get the identifying parameters of the LLM.
|
|
214
207
|
*/
|
|
215
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
208
|
_identifyingParams(): Record<string, any>;
|
|
217
209
|
/**
|
|
218
210
|
* Create a unique cache key for a specific call to a specific language model.
|
|
219
211
|
* @param callOptions Call options for the model
|
|
220
212
|
* @returns A unique cache key.
|
|
221
213
|
*/
|
|
222
|
-
_getSerializedCacheKeyParametersForCall(
|
|
223
|
-
// TODO: Fix when we remove the RunnableLambda backwards compatibility shim.
|
|
224
|
-
{
|
|
214
|
+
_getSerializedCacheKeyParametersForCall({
|
|
225
215
|
config,
|
|
226
216
|
...callOptions
|
|
227
217
|
}: CallOptions & {
|
|
@@ -243,29 +233,13 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
243
233
|
* @returns {ModelProfile} An object describing the model's capabilities and constraints
|
|
244
234
|
*/
|
|
245
235
|
get profile(): ModelProfile;
|
|
246
|
-
withStructuredOutput?<
|
|
247
|
-
|
|
248
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
|
|
249
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
250
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
251
|
-
withStructuredOutput?<
|
|
252
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
253
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput>
|
|
254
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
255
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
236
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
237
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
256
238
|
raw: BaseMessage;
|
|
257
239
|
parsed: RunOutput;
|
|
258
240
|
}>;
|
|
259
|
-
withStructuredOutput?<
|
|
260
|
-
|
|
261
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
|
|
262
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
263
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
264
|
-
withStructuredOutput?<
|
|
265
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
266
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput>
|
|
267
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
268
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
241
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<false>): Runnable<BaseLanguageModelInput, RunOutput>;
|
|
242
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: $ZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<true>): Runnable<BaseLanguageModelInput, {
|
|
269
243
|
raw: BaseMessage;
|
|
270
244
|
parsed: RunOutput;
|
|
271
245
|
}>;
|
|
@@ -282,11 +256,7 @@ RunOutput = any, CallOptions extends BaseLanguageModelCallOptions = BaseLanguage
|
|
|
282
256
|
* @param {boolean | undefined} [includeRaw=false] Whether to include the raw output in the result. Defaults to false.
|
|
283
257
|
* @returns {Runnable<RunInput, RunOutput> | Runnable<RunInput, { raw: BaseMessage; parsed: RunOutput }>} A new runnable that calls the LLM with structured output.
|
|
284
258
|
*/
|
|
285
|
-
withStructuredOutput?<
|
|
286
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
287
|
-
RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput>
|
|
288
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
289
|
-
| Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
259
|
+
withStructuredOutput?<RunOutput extends Record<string, any> = Record<string, any>>(schema: InteropZodType<RunOutput> | Record<string, any>, config?: StructuredOutputMethodOptions<boolean>): Runnable<BaseLanguageModelInput, RunOutput> | Runnable<BaseLanguageModelInput, {
|
|
290
260
|
raw: BaseMessage;
|
|
291
261
|
parsed: RunOutput;
|
|
292
262
|
}>;
|