@langchain/core 1.1.24 → 1.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +21 -0
- package/dist/_virtual/_rolldown/runtime.cjs +43 -0
- package/dist/_virtual/_rolldown/runtime.js +18 -0
- package/dist/agents.cjs +3 -1
- package/dist/agents.d.cts.map +1 -1
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +3 -1
- package/dist/caches/index.cjs +4 -4
- package/dist/caches/index.cjs.map +1 -1
- package/dist/caches/index.d.cts.map +1 -1
- package/dist/caches/index.d.ts.map +1 -1
- package/dist/caches/index.js +3 -4
- package/dist/caches/index.js.map +1 -1
- package/dist/callbacks/base.cjs +9 -16
- package/dist/callbacks/base.cjs.map +1 -1
- package/dist/callbacks/base.d.cts +1 -0
- package/dist/callbacks/base.d.cts.map +1 -1
- package/dist/callbacks/base.d.ts +1 -0
- package/dist/callbacks/base.d.ts.map +1 -1
- package/dist/callbacks/base.js +6 -15
- package/dist/callbacks/base.js.map +1 -1
- package/dist/callbacks/dispatch/index.cjs +6 -6
- package/dist/callbacks/dispatch/index.cjs.map +1 -1
- package/dist/callbacks/dispatch/index.d.cts +0 -1
- package/dist/callbacks/dispatch/index.d.cts.map +1 -1
- package/dist/callbacks/dispatch/index.d.ts +0 -1
- package/dist/callbacks/dispatch/index.d.ts.map +1 -1
- package/dist/callbacks/dispatch/index.js +4 -5
- package/dist/callbacks/dispatch/index.js.map +1 -1
- package/dist/callbacks/dispatch/web.cjs +1 -0
- package/dist/callbacks/dispatch/web.cjs.map +1 -1
- package/dist/callbacks/dispatch/web.d.cts +0 -1
- package/dist/callbacks/dispatch/web.d.cts.map +1 -1
- package/dist/callbacks/dispatch/web.d.ts +0 -1
- package/dist/callbacks/dispatch/web.d.ts.map +1 -1
- package/dist/callbacks/dispatch/web.js.map +1 -1
- package/dist/callbacks/manager.cjs +30 -50
- package/dist/callbacks/manager.cjs.map +1 -1
- package/dist/callbacks/manager.d.cts.map +1 -1
- package/dist/callbacks/manager.d.ts.map +1 -1
- package/dist/callbacks/manager.js +28 -49
- package/dist/callbacks/manager.js.map +1 -1
- package/dist/callbacks/promises.cjs +3 -3
- package/dist/callbacks/promises.js +2 -3
- package/dist/chat_history.cjs +4 -4
- package/dist/chat_history.cjs.map +1 -1
- package/dist/chat_history.d.cts +0 -1
- package/dist/chat_history.d.cts.map +1 -1
- package/dist/chat_history.d.ts +0 -1
- package/dist/chat_history.d.ts.map +1 -1
- package/dist/chat_history.js +3 -4
- package/dist/chat_history.js.map +1 -1
- package/dist/context.cjs +10 -2
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.cts.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +7 -0
- package/dist/context.js.map +1 -1
- package/dist/document_loaders/base.cjs +3 -3
- package/dist/document_loaders/base.cjs.map +1 -1
- package/dist/document_loaders/base.d.cts +0 -1
- package/dist/document_loaders/base.d.cts.map +1 -1
- package/dist/document_loaders/base.d.ts +0 -1
- package/dist/document_loaders/base.d.ts.map +1 -1
- package/dist/document_loaders/base.js +2 -3
- package/dist/document_loaders/base.js.map +1 -1
- package/dist/document_loaders/langsmith.cjs +4 -4
- package/dist/document_loaders/langsmith.cjs.map +1 -1
- package/dist/document_loaders/langsmith.d.cts.map +1 -1
- package/dist/document_loaders/langsmith.d.ts.map +1 -1
- package/dist/document_loaders/langsmith.js +2 -3
- package/dist/document_loaders/langsmith.js.map +1 -1
- package/dist/documents/document.cjs.map +1 -1
- package/dist/documents/document.d.cts.map +1 -1
- package/dist/documents/document.d.ts.map +1 -1
- package/dist/documents/document.js.map +1 -1
- package/dist/documents/index.cjs +3 -3
- package/dist/documents/index.js +2 -3
- package/dist/documents/transformers.cjs.map +1 -1
- package/dist/documents/transformers.d.cts +0 -1
- package/dist/documents/transformers.d.cts.map +1 -1
- package/dist/documents/transformers.d.ts +0 -1
- package/dist/documents/transformers.d.ts.map +1 -1
- package/dist/documents/transformers.js.map +1 -1
- package/dist/embeddings.cjs +3 -3
- package/dist/embeddings.cjs.map +1 -1
- package/dist/embeddings.d.cts +0 -1
- package/dist/embeddings.d.cts.map +1 -1
- package/dist/embeddings.d.ts +0 -1
- package/dist/embeddings.d.ts.map +1 -1
- package/dist/embeddings.js +2 -3
- package/dist/embeddings.js.map +1 -1
- package/dist/errors/index.cjs +141 -15
- package/dist/errors/index.cjs.map +1 -1
- package/dist/errors/index.d.cts +134 -11
- package/dist/errors/index.d.cts.map +1 -1
- package/dist/errors/index.d.ts +134 -11
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +138 -16
- package/dist/errors/index.js.map +1 -1
- package/dist/example_selectors/base.cjs.map +1 -1
- package/dist/example_selectors/base.d.cts +0 -1
- package/dist/example_selectors/base.d.cts.map +1 -1
- package/dist/example_selectors/base.d.ts +0 -1
- package/dist/example_selectors/base.d.ts.map +1 -1
- package/dist/example_selectors/base.js.map +1 -1
- package/dist/example_selectors/conditional.cjs +1 -2
- package/dist/example_selectors/conditional.cjs.map +1 -1
- package/dist/example_selectors/conditional.d.cts.map +1 -1
- package/dist/example_selectors/conditional.d.ts.map +1 -1
- package/dist/example_selectors/conditional.js +1 -2
- package/dist/example_selectors/conditional.js.map +1 -1
- package/dist/example_selectors/index.cjs +3 -3
- package/dist/example_selectors/index.js +2 -3
- package/dist/example_selectors/length_based.cjs +1 -2
- package/dist/example_selectors/length_based.cjs.map +1 -1
- package/dist/example_selectors/length_based.d.cts +0 -1
- package/dist/example_selectors/length_based.d.cts.map +1 -1
- package/dist/example_selectors/length_based.d.ts +0 -1
- package/dist/example_selectors/length_based.d.ts.map +1 -1
- package/dist/example_selectors/length_based.js +1 -2
- package/dist/example_selectors/length_based.js.map +1 -1
- package/dist/example_selectors/semantic_similarity.cjs +4 -8
- package/dist/example_selectors/semantic_similarity.cjs.map +1 -1
- package/dist/example_selectors/semantic_similarity.d.cts +0 -1
- package/dist/example_selectors/semantic_similarity.d.cts.map +1 -1
- package/dist/example_selectors/semantic_similarity.d.ts +0 -1
- package/dist/example_selectors/semantic_similarity.d.ts.map +1 -1
- package/dist/example_selectors/semantic_similarity.js +4 -8
- package/dist/example_selectors/semantic_similarity.js.map +1 -1
- package/dist/index.cjs +3 -1
- package/dist/index.js +3 -1
- package/dist/indexing/base.cjs +7 -11
- package/dist/indexing/base.cjs.map +1 -1
- package/dist/indexing/base.d.cts.map +1 -1
- package/dist/indexing/base.d.ts.map +1 -1
- package/dist/indexing/base.js +5 -9
- package/dist/indexing/base.js.map +1 -1
- package/dist/indexing/index.cjs +3 -3
- package/dist/indexing/index.js +2 -3
- package/dist/indexing/record_manager.cjs.map +1 -1
- package/dist/indexing/record_manager.d.cts.map +1 -1
- package/dist/indexing/record_manager.d.ts.map +1 -1
- package/dist/indexing/record_manager.js.map +1 -1
- package/dist/language_models/base.cjs +10 -14
- package/dist/language_models/base.cjs.map +1 -1
- package/dist/language_models/base.d.cts +2 -4
- package/dist/language_models/base.d.cts.map +1 -1
- package/dist/language_models/base.d.ts +2 -4
- package/dist/language_models/base.d.ts.map +1 -1
- package/dist/language_models/base.js +9 -14
- package/dist/language_models/base.js.map +1 -1
- package/dist/language_models/chat_models.cjs +19 -25
- package/dist/language_models/chat_models.cjs.map +1 -1
- package/dist/language_models/chat_models.d.cts.map +1 -1
- package/dist/language_models/chat_models.d.ts.map +1 -1
- package/dist/language_models/chat_models.js +18 -25
- package/dist/language_models/chat_models.js.map +1 -1
- package/dist/language_models/llms.cjs +12 -15
- package/dist/language_models/llms.cjs.map +1 -1
- package/dist/language_models/llms.d.cts.map +1 -1
- package/dist/language_models/llms.d.ts.map +1 -1
- package/dist/language_models/llms.js +11 -15
- package/dist/language_models/llms.js.map +1 -1
- package/dist/language_models/profile.cjs +3 -1
- package/dist/language_models/profile.d.cts.map +1 -1
- package/dist/language_models/profile.d.ts.map +1 -1
- package/dist/language_models/profile.js +3 -1
- package/dist/language_models/utils.cjs.map +1 -1
- package/dist/language_models/utils.js.map +1 -1
- package/dist/load/import_constants.cjs.map +1 -1
- package/dist/load/import_constants.js.map +1 -1
- package/dist/load/import_map.cjs +13 -14
- package/dist/load/import_map.js +13 -14
- package/dist/load/import_type.d.cts.map +1 -1
- package/dist/load/import_type.d.ts.map +1 -1
- package/dist/load/index.cjs +74 -13
- package/dist/load/index.cjs.map +1 -1
- package/dist/load/index.d.cts +13 -4
- package/dist/load/index.d.cts.map +1 -1
- package/dist/load/index.d.ts +13 -4
- package/dist/load/index.d.ts.map +1 -1
- package/dist/load/index.js +68 -8
- package/dist/load/index.js.map +1 -1
- package/dist/load/map_keys.cjs +5 -3
- package/dist/load/map_keys.cjs.map +1 -1
- package/dist/load/map_keys.d.cts.map +1 -1
- package/dist/load/map_keys.d.ts.map +1 -1
- package/dist/load/map_keys.js.map +1 -1
- package/dist/load/serializable.cjs +9 -19
- package/dist/load/serializable.cjs.map +1 -1
- package/dist/load/serializable.d.cts.map +1 -1
- package/dist/load/serializable.d.ts.map +1 -1
- package/dist/load/serializable.js +8 -19
- package/dist/load/serializable.js.map +1 -1
- package/dist/load/validation.cjs.map +1 -1
- package/dist/load/validation.js.map +1 -1
- package/dist/memory.cjs +3 -3
- package/dist/memory.cjs.map +1 -1
- package/dist/memory.d.cts.map +1 -1
- package/dist/memory.d.ts.map +1 -1
- package/dist/memory.js +2 -3
- package/dist/memory.js.map +1 -1
- package/dist/messages/ai.cjs.map +1 -1
- package/dist/messages/ai.d.cts.map +1 -1
- package/dist/messages/ai.d.ts.map +1 -1
- package/dist/messages/ai.js.map +1 -1
- package/dist/messages/base.cjs +10 -12
- package/dist/messages/base.cjs.map +1 -1
- package/dist/messages/base.d.cts +6 -3
- package/dist/messages/base.d.cts.map +1 -1
- package/dist/messages/base.d.ts +6 -3
- package/dist/messages/base.d.ts.map +1 -1
- package/dist/messages/base.js +10 -12
- package/dist/messages/base.js.map +1 -1
- package/dist/messages/block_translators/anthropic.cjs +30 -35
- package/dist/messages/block_translators/anthropic.cjs.map +1 -1
- package/dist/messages/block_translators/anthropic.js +30 -35
- package/dist/messages/block_translators/anthropic.js.map +1 -1
- package/dist/messages/block_translators/bedrock_converse.cjs +38 -46
- package/dist/messages/block_translators/bedrock_converse.cjs.map +1 -1
- package/dist/messages/block_translators/bedrock_converse.js +38 -46
- package/dist/messages/block_translators/bedrock_converse.js.map +1 -1
- package/dist/messages/block_translators/data.cjs.map +1 -1
- package/dist/messages/block_translators/data.js.map +1 -1
- package/dist/messages/block_translators/deepseek.cjs.map +1 -1
- package/dist/messages/block_translators/deepseek.js.map +1 -1
- package/dist/messages/block_translators/google.cjs +6 -9
- package/dist/messages/block_translators/google.cjs.map +1 -1
- package/dist/messages/block_translators/google.js +6 -9
- package/dist/messages/block_translators/google.js.map +1 -1
- package/dist/messages/block_translators/google_genai.cjs.map +1 -1
- package/dist/messages/block_translators/google_genai.js.map +1 -1
- package/dist/messages/block_translators/google_vertexai.cjs +1 -3
- package/dist/messages/block_translators/google_vertexai.cjs.map +1 -1
- package/dist/messages/block_translators/google_vertexai.js +1 -3
- package/dist/messages/block_translators/google_vertexai.js.map +1 -1
- package/dist/messages/block_translators/groq.cjs.map +1 -1
- package/dist/messages/block_translators/groq.js.map +1 -1
- package/dist/messages/block_translators/index.cjs.map +1 -1
- package/dist/messages/block_translators/index.js.map +1 -1
- package/dist/messages/block_translators/ollama.cjs.map +1 -1
- package/dist/messages/block_translators/ollama.js.map +1 -1
- package/dist/messages/block_translators/openai.cjs +6 -10
- package/dist/messages/block_translators/openai.cjs.map +1 -1
- package/dist/messages/block_translators/openai.js +6 -10
- package/dist/messages/block_translators/openai.js.map +1 -1
- package/dist/messages/block_translators/utils.cjs +1 -1
- package/dist/messages/block_translators/utils.cjs.map +1 -1
- package/dist/messages/block_translators/utils.js +1 -1
- package/dist/messages/block_translators/utils.js.map +1 -1
- package/dist/messages/block_translators/xai.cjs.map +1 -1
- package/dist/messages/block_translators/xai.js.map +1 -1
- package/dist/messages/chat.cjs.map +1 -1
- package/dist/messages/chat.d.cts.map +1 -1
- package/dist/messages/chat.d.ts.map +1 -1
- package/dist/messages/chat.js.map +1 -1
- package/dist/messages/content/base.d.cts.map +1 -1
- package/dist/messages/content/base.d.ts.map +1 -1
- package/dist/messages/content/data.cjs +1 -3
- package/dist/messages/content/data.cjs.map +1 -1
- package/dist/messages/content/data.d.cts +0 -1
- package/dist/messages/content/data.d.cts.map +1 -1
- package/dist/messages/content/data.d.ts +0 -1
- package/dist/messages/content/data.d.ts.map +1 -1
- package/dist/messages/content/data.js +1 -3
- package/dist/messages/content/data.js.map +1 -1
- package/dist/messages/content/index.cjs +2 -2
- package/dist/messages/content/index.cjs.map +1 -1
- package/dist/messages/content/index.d.cts.map +1 -1
- package/dist/messages/content/index.d.ts.map +1 -1
- package/dist/messages/content/index.js +6 -6
- package/dist/messages/content/index.js.map +1 -1
- package/dist/messages/content/multimodal.cjs.map +1 -1
- package/dist/messages/content/multimodal.d.cts +4 -8
- package/dist/messages/content/multimodal.d.cts.map +1 -1
- package/dist/messages/content/multimodal.d.ts +4 -8
- package/dist/messages/content/multimodal.d.ts.map +1 -1
- package/dist/messages/content/multimodal.js.map +1 -1
- package/dist/messages/content/tools.cjs.map +1 -1
- package/dist/messages/content/tools.d.cts.map +1 -1
- package/dist/messages/content/tools.d.ts.map +1 -1
- package/dist/messages/content/tools.js.map +1 -1
- package/dist/messages/format.cjs.map +1 -1
- package/dist/messages/format.d.cts.map +1 -1
- package/dist/messages/format.d.ts.map +1 -1
- package/dist/messages/format.js.map +1 -1
- package/dist/messages/function.cjs.map +1 -1
- package/dist/messages/function.d.cts.map +1 -1
- package/dist/messages/function.d.ts.map +1 -1
- package/dist/messages/function.js.map +1 -1
- package/dist/messages/human.cjs.map +1 -1
- package/dist/messages/human.d.cts.map +1 -1
- package/dist/messages/human.d.ts.map +1 -1
- package/dist/messages/human.js.map +1 -1
- package/dist/messages/index.cjs +4 -4
- package/dist/messages/index.js +3 -4
- package/dist/messages/message.cjs.map +1 -1
- package/dist/messages/message.d.cts +13 -24
- package/dist/messages/message.d.cts.map +1 -1
- package/dist/messages/message.d.ts +13 -24
- package/dist/messages/message.d.ts.map +1 -1
- package/dist/messages/message.js.map +1 -1
- package/dist/messages/metadata.cjs +1 -2
- package/dist/messages/metadata.cjs.map +1 -1
- package/dist/messages/metadata.d.cts.map +1 -1
- package/dist/messages/metadata.d.ts.map +1 -1
- package/dist/messages/metadata.js +1 -2
- package/dist/messages/metadata.js.map +1 -1
- package/dist/messages/modifier.cjs.map +1 -1
- package/dist/messages/modifier.d.cts.map +1 -1
- package/dist/messages/modifier.d.ts.map +1 -1
- package/dist/messages/modifier.js.map +1 -1
- package/dist/messages/system.cjs.map +1 -1
- package/dist/messages/system.d.cts.map +1 -1
- package/dist/messages/system.d.ts.map +1 -1
- package/dist/messages/system.js.map +1 -1
- package/dist/messages/tool.cjs +3 -3
- package/dist/messages/tool.cjs.map +1 -1
- package/dist/messages/tool.d.cts.map +1 -1
- package/dist/messages/tool.d.ts.map +1 -1
- package/dist/messages/tool.js +2 -3
- package/dist/messages/tool.js.map +1 -1
- package/dist/messages/transformers.cjs +8 -14
- package/dist/messages/transformers.cjs.map +1 -1
- package/dist/messages/transformers.d.cts.map +1 -1
- package/dist/messages/transformers.d.ts.map +1 -1
- package/dist/messages/transformers.js +8 -14
- package/dist/messages/transformers.js.map +1 -1
- package/dist/messages/utils.cjs +11 -14
- package/dist/messages/utils.cjs.map +1 -1
- package/dist/messages/utils.d.cts +7 -7
- package/dist/messages/utils.d.cts.map +1 -1
- package/dist/messages/utils.d.ts +7 -7
- package/dist/messages/utils.d.ts.map +1 -1
- package/dist/messages/utils.js +11 -14
- package/dist/messages/utils.js.map +1 -1
- package/dist/output_parsers/base.cjs +5 -5
- package/dist/output_parsers/base.cjs.map +1 -1
- package/dist/output_parsers/base.d.cts.map +1 -1
- package/dist/output_parsers/base.d.ts.map +1 -1
- package/dist/output_parsers/base.js +5 -5
- package/dist/output_parsers/base.js.map +1 -1
- package/dist/output_parsers/bytes.cjs.map +1 -1
- package/dist/output_parsers/bytes.d.cts +0 -1
- package/dist/output_parsers/bytes.d.cts.map +1 -1
- package/dist/output_parsers/bytes.d.ts +0 -1
- package/dist/output_parsers/bytes.d.ts.map +1 -1
- package/dist/output_parsers/bytes.js.map +1 -1
- package/dist/output_parsers/index.cjs +3 -3
- package/dist/output_parsers/index.js +2 -3
- package/dist/output_parsers/json.cjs +1 -1
- package/dist/output_parsers/json.cjs.map +1 -1
- package/dist/output_parsers/json.d.cts +0 -1
- package/dist/output_parsers/json.d.cts.map +1 -1
- package/dist/output_parsers/json.d.ts.map +1 -1
- package/dist/output_parsers/json.js +1 -1
- package/dist/output_parsers/json.js.map +1 -1
- package/dist/output_parsers/list.cjs.map +1 -1
- package/dist/output_parsers/list.d.cts +0 -1
- package/dist/output_parsers/list.d.cts.map +1 -1
- package/dist/output_parsers/list.d.ts +0 -1
- package/dist/output_parsers/list.d.ts.map +1 -1
- package/dist/output_parsers/list.js.map +1 -1
- package/dist/output_parsers/openai_functions/index.cjs +3 -3
- package/dist/output_parsers/openai_functions/index.js +2 -3
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs +6 -9
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.cjs.map +1 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts +0 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.cts.map +1 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.d.ts.map +1 -1
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.js +6 -9
- package/dist/output_parsers/openai_functions/json_output_functions_parsers.js.map +1 -1
- package/dist/output_parsers/openai_tools/index.cjs +3 -3
- package/dist/output_parsers/openai_tools/index.js +2 -3
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs +14 -21
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.cjs.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts +1 -2
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.cts.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts +1 -2
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.d.ts.map +1 -1
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js +14 -21
- package/dist/output_parsers/openai_tools/json_output_tools_parsers.js.map +1 -1
- package/dist/output_parsers/string.cjs +3 -0
- package/dist/output_parsers/string.cjs.map +1 -1
- package/dist/output_parsers/string.d.cts +0 -1
- package/dist/output_parsers/string.d.cts.map +1 -1
- package/dist/output_parsers/string.d.ts +0 -1
- package/dist/output_parsers/string.d.ts.map +1 -1
- package/dist/output_parsers/string.js +3 -0
- package/dist/output_parsers/string.js.map +1 -1
- package/dist/output_parsers/structured.cjs +10 -13
- package/dist/output_parsers/structured.cjs.map +1 -1
- package/dist/output_parsers/structured.d.cts.map +1 -1
- package/dist/output_parsers/structured.d.ts.map +1 -1
- package/dist/output_parsers/structured.js +8 -11
- package/dist/output_parsers/structured.js.map +1 -1
- package/dist/output_parsers/transform.cjs +3 -3
- package/dist/output_parsers/transform.cjs.map +1 -1
- package/dist/output_parsers/transform.d.cts +0 -1
- package/dist/output_parsers/transform.d.cts.map +1 -1
- package/dist/output_parsers/transform.d.ts +0 -1
- package/dist/output_parsers/transform.d.ts.map +1 -1
- package/dist/output_parsers/transform.js.map +1 -1
- package/dist/output_parsers/xml.cjs +4 -7
- package/dist/output_parsers/xml.cjs.map +1 -1
- package/dist/output_parsers/xml.d.cts.map +1 -1
- package/dist/output_parsers/xml.d.ts.map +1 -1
- package/dist/output_parsers/xml.js +4 -7
- package/dist/output_parsers/xml.js.map +1 -1
- package/dist/outputs.cjs +3 -3
- package/dist/outputs.cjs.map +1 -1
- package/dist/outputs.d.cts.map +1 -1
- package/dist/outputs.d.ts.map +1 -1
- package/dist/outputs.js +2 -3
- package/dist/outputs.js.map +1 -1
- package/dist/prompt_values.cjs +3 -3
- package/dist/prompt_values.cjs.map +1 -1
- package/dist/prompt_values.d.cts +1 -3
- package/dist/prompt_values.d.cts.map +1 -1
- package/dist/prompt_values.d.ts +1 -3
- package/dist/prompt_values.d.ts.map +1 -1
- package/dist/prompt_values.js +2 -3
- package/dist/prompt_values.js.map +1 -1
- package/dist/prompts/base.cjs +2 -3
- package/dist/prompts/base.cjs.map +1 -1
- package/dist/prompts/base.d.cts.map +1 -1
- package/dist/prompts/base.d.ts.map +1 -1
- package/dist/prompts/base.js +2 -3
- package/dist/prompts/base.js.map +1 -1
- package/dist/prompts/chat.cjs +22 -37
- package/dist/prompts/chat.cjs.map +1 -1
- package/dist/prompts/chat.d.cts +1 -0
- package/dist/prompts/chat.d.cts.map +1 -1
- package/dist/prompts/chat.d.ts +1 -0
- package/dist/prompts/chat.d.ts.map +1 -1
- package/dist/prompts/chat.js +22 -37
- package/dist/prompts/chat.js.map +1 -1
- package/dist/prompts/dict.cjs.map +1 -1
- package/dist/prompts/dict.d.cts.map +1 -1
- package/dist/prompts/dict.d.ts.map +1 -1
- package/dist/prompts/dict.js.map +1 -1
- package/dist/prompts/few_shot.cjs +9 -14
- package/dist/prompts/few_shot.cjs.map +1 -1
- package/dist/prompts/few_shot.d.cts.map +1 -1
- package/dist/prompts/few_shot.d.ts.map +1 -1
- package/dist/prompts/few_shot.js +9 -14
- package/dist/prompts/few_shot.js.map +1 -1
- package/dist/prompts/image.cjs +3 -5
- package/dist/prompts/image.cjs.map +1 -1
- package/dist/prompts/image.d.cts +0 -1
- package/dist/prompts/image.d.cts.map +1 -1
- package/dist/prompts/image.d.ts +0 -1
- package/dist/prompts/image.d.ts.map +1 -1
- package/dist/prompts/image.js +3 -5
- package/dist/prompts/image.js.map +1 -1
- package/dist/prompts/index.cjs +3 -3
- package/dist/prompts/index.js +2 -3
- package/dist/prompts/pipeline.cjs.map +1 -1
- package/dist/prompts/pipeline.d.cts +0 -1
- package/dist/prompts/pipeline.d.cts.map +1 -1
- package/dist/prompts/pipeline.d.ts +0 -1
- package/dist/prompts/pipeline.d.ts.map +1 -1
- package/dist/prompts/pipeline.js.map +1 -1
- package/dist/prompts/prompt.cjs +9 -12
- package/dist/prompts/prompt.cjs.map +1 -1
- package/dist/prompts/prompt.d.cts +0 -1
- package/dist/prompts/prompt.d.cts.map +1 -1
- package/dist/prompts/prompt.d.ts.map +1 -1
- package/dist/prompts/prompt.js +9 -12
- package/dist/prompts/prompt.js.map +1 -1
- package/dist/prompts/serde.d.cts +0 -1
- package/dist/prompts/serde.d.cts.map +1 -1
- package/dist/prompts/serde.d.ts +0 -1
- package/dist/prompts/serde.d.ts.map +1 -1
- package/dist/prompts/string.cjs +1 -2
- package/dist/prompts/string.cjs.map +1 -1
- package/dist/prompts/string.d.cts +0 -1
- package/dist/prompts/string.d.cts.map +1 -1
- package/dist/prompts/string.d.ts +0 -1
- package/dist/prompts/string.d.ts.map +1 -1
- package/dist/prompts/string.js +1 -2
- package/dist/prompts/string.js.map +1 -1
- package/dist/prompts/structured.cjs.map +1 -1
- package/dist/prompts/structured.d.cts +0 -1
- package/dist/prompts/structured.d.cts.map +1 -1
- package/dist/prompts/structured.d.ts.map +1 -1
- package/dist/prompts/structured.js.map +1 -1
- package/dist/prompts/template.cjs +7 -11
- package/dist/prompts/template.cjs.map +1 -1
- package/dist/prompts/template.d.cts +0 -1
- package/dist/prompts/template.d.cts.map +1 -1
- package/dist/prompts/template.d.ts.map +1 -1
- package/dist/prompts/template.js +4 -9
- package/dist/prompts/template.js.map +1 -1
- package/dist/retrievers/document_compressors/index.cjs +3 -3
- package/dist/retrievers/document_compressors/index.cjs.map +1 -1
- package/dist/retrievers/document_compressors/index.d.cts +0 -1
- package/dist/retrievers/document_compressors/index.d.cts.map +1 -1
- package/dist/retrievers/document_compressors/index.d.ts +0 -1
- package/dist/retrievers/document_compressors/index.d.ts.map +1 -1
- package/dist/retrievers/document_compressors/index.js +2 -3
- package/dist/retrievers/document_compressors/index.js.map +1 -1
- package/dist/retrievers/index.cjs +4 -5
- package/dist/retrievers/index.cjs.map +1 -1
- package/dist/retrievers/index.d.cts +0 -1
- package/dist/retrievers/index.d.cts.map +1 -1
- package/dist/retrievers/index.d.ts +0 -1
- package/dist/retrievers/index.d.ts.map +1 -1
- package/dist/retrievers/index.js +3 -5
- package/dist/retrievers/index.js.map +1 -1
- package/dist/runnables/base.cjs +44 -67
- package/dist/runnables/base.cjs.map +1 -1
- package/dist/runnables/base.d.cts +1 -2
- package/dist/runnables/base.d.cts.map +1 -1
- package/dist/runnables/base.d.ts +1 -2
- package/dist/runnables/base.d.ts.map +1 -1
- package/dist/runnables/base.js +40 -63
- package/dist/runnables/base.js.map +1 -1
- package/dist/runnables/branch.cjs +4 -8
- package/dist/runnables/branch.cjs.map +1 -1
- package/dist/runnables/branch.d.cts +0 -1
- package/dist/runnables/branch.d.cts.map +1 -1
- package/dist/runnables/branch.d.ts +0 -1
- package/dist/runnables/branch.d.ts.map +1 -1
- package/dist/runnables/branch.js +4 -8
- package/dist/runnables/branch.js.map +1 -1
- package/dist/runnables/config.cjs +1 -1
- package/dist/runnables/config.cjs.map +1 -1
- package/dist/runnables/config.d.cts.map +1 -1
- package/dist/runnables/config.d.ts.map +1 -1
- package/dist/runnables/config.js +1 -1
- package/dist/runnables/config.js.map +1 -1
- package/dist/runnables/graph.cjs +6 -8
- package/dist/runnables/graph.cjs.map +1 -1
- package/dist/runnables/graph.d.cts.map +1 -1
- package/dist/runnables/graph.d.ts.map +1 -1
- package/dist/runnables/graph.js +4 -7
- package/dist/runnables/graph.js.map +1 -1
- package/dist/runnables/graph_mermaid.cjs +6 -9
- package/dist/runnables/graph_mermaid.cjs.map +1 -1
- package/dist/runnables/graph_mermaid.js +6 -9
- package/dist/runnables/graph_mermaid.js.map +1 -1
- package/dist/runnables/history.cjs +4 -6
- package/dist/runnables/history.cjs.map +1 -1
- package/dist/runnables/history.d.cts.map +1 -1
- package/dist/runnables/history.d.ts.map +1 -1
- package/dist/runnables/history.js +4 -6
- package/dist/runnables/history.js.map +1 -1
- package/dist/runnables/index.cjs +3 -3
- package/dist/runnables/index.js +2 -3
- package/dist/runnables/iter.cjs.map +1 -1
- package/dist/runnables/iter.js.map +1 -1
- package/dist/runnables/passthrough.cjs +1 -1
- package/dist/runnables/passthrough.cjs.map +1 -1
- package/dist/runnables/passthrough.d.cts.map +1 -1
- package/dist/runnables/passthrough.d.ts.map +1 -1
- package/dist/runnables/passthrough.js +1 -1
- package/dist/runnables/passthrough.js.map +1 -1
- package/dist/runnables/router.cjs +2 -3
- package/dist/runnables/router.cjs.map +1 -1
- package/dist/runnables/router.d.cts.map +1 -1
- package/dist/runnables/router.d.ts.map +1 -1
- package/dist/runnables/router.js +2 -3
- package/dist/runnables/router.js.map +1 -1
- package/dist/runnables/types.d.cts +1 -2
- package/dist/runnables/types.d.cts.map +1 -1
- package/dist/runnables/types.d.ts +1 -2
- package/dist/runnables/types.d.ts.map +1 -1
- package/dist/runnables/utils.cjs +1 -2
- package/dist/runnables/utils.cjs.map +1 -1
- package/dist/runnables/utils.js +1 -2
- package/dist/runnables/utils.js.map +1 -1
- package/dist/runnables/wrappers.cjs.map +1 -1
- package/dist/runnables/wrappers.js.map +1 -1
- package/dist/singletons/async_local_storage/context.cjs +4 -5
- package/dist/singletons/async_local_storage/context.cjs.map +1 -1
- package/dist/singletons/async_local_storage/context.d.cts +0 -1
- package/dist/singletons/async_local_storage/context.d.cts.map +1 -1
- package/dist/singletons/async_local_storage/context.d.ts +0 -1
- package/dist/singletons/async_local_storage/context.d.ts.map +1 -1
- package/dist/singletons/async_local_storage/context.js +2 -3
- package/dist/singletons/async_local_storage/context.js.map +1 -1
- package/dist/singletons/async_local_storage/globals.cjs.map +1 -1
- package/dist/singletons/async_local_storage/globals.d.cts.map +1 -1
- package/dist/singletons/async_local_storage/globals.d.ts.map +1 -1
- package/dist/singletons/async_local_storage/globals.js.map +1 -1
- package/dist/singletons/async_local_storage/index.cjs +5 -10
- package/dist/singletons/async_local_storage/index.cjs.map +1 -1
- package/dist/singletons/async_local_storage/index.d.cts.map +1 -1
- package/dist/singletons/async_local_storage/index.d.ts.map +1 -1
- package/dist/singletons/async_local_storage/index.js +3 -8
- package/dist/singletons/async_local_storage/index.js.map +1 -1
- package/dist/singletons/callbacks.cjs +4 -4
- package/dist/singletons/callbacks.cjs.map +1 -1
- package/dist/singletons/callbacks.d.cts +0 -1
- package/dist/singletons/callbacks.d.cts.map +1 -1
- package/dist/singletons/callbacks.d.ts +0 -1
- package/dist/singletons/callbacks.d.ts.map +1 -1
- package/dist/singletons/callbacks.js +1 -2
- package/dist/singletons/callbacks.js.map +1 -1
- package/dist/singletons/index.cjs +3 -3
- package/dist/singletons/index.js +2 -3
- package/dist/singletons/tracer.cjs +3 -6
- package/dist/singletons/tracer.cjs.map +1 -1
- package/dist/singletons/tracer.js +1 -4
- package/dist/singletons/tracer.js.map +1 -1
- package/dist/stores.cjs +3 -3
- package/dist/stores.cjs.map +1 -1
- package/dist/stores.d.cts +0 -1
- package/dist/stores.d.cts.map +1 -1
- package/dist/stores.d.ts +0 -1
- package/dist/stores.d.ts.map +1 -1
- package/dist/stores.js +2 -3
- package/dist/stores.js.map +1 -1
- package/dist/structured_query/base.cjs +3 -3
- package/dist/structured_query/base.cjs.map +1 -1
- package/dist/structured_query/base.d.cts +0 -1
- package/dist/structured_query/base.d.cts.map +1 -1
- package/dist/structured_query/base.d.ts +0 -1
- package/dist/structured_query/base.d.ts.map +1 -1
- package/dist/structured_query/base.js +3 -3
- package/dist/structured_query/base.js.map +1 -1
- package/dist/structured_query/functional.cjs +3 -3
- package/dist/structured_query/functional.cjs.map +1 -1
- package/dist/structured_query/functional.d.cts +0 -1
- package/dist/structured_query/functional.d.cts.map +1 -1
- package/dist/structured_query/functional.d.ts +0 -1
- package/dist/structured_query/functional.d.ts.map +1 -1
- package/dist/structured_query/functional.js +3 -3
- package/dist/structured_query/functional.js.map +1 -1
- package/dist/structured_query/index.cjs +3 -3
- package/dist/structured_query/index.js +2 -3
- package/dist/structured_query/ir.cjs.map +1 -1
- package/dist/structured_query/ir.d.cts +0 -1
- package/dist/structured_query/ir.d.cts.map +1 -1
- package/dist/structured_query/ir.d.ts +0 -1
- package/dist/structured_query/ir.d.ts.map +1 -1
- package/dist/structured_query/ir.js.map +1 -1
- package/dist/structured_query/utils.cjs.map +1 -1
- package/dist/structured_query/utils.d.cts.map +1 -1
- package/dist/structured_query/utils.d.ts.map +1 -1
- package/dist/structured_query/utils.js.map +1 -1
- package/dist/tools/index.cjs +11 -12
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.d.cts +2 -1
- package/dist/tools/index.d.cts.map +1 -1
- package/dist/tools/index.d.ts +2 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +7 -9
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/types.cjs.map +1 -1
- package/dist/tools/types.d.cts +1 -0
- package/dist/tools/types.d.cts.map +1 -1
- package/dist/tools/types.d.ts +1 -0
- package/dist/tools/types.d.ts.map +1 -1
- package/dist/tools/types.js.map +1 -1
- package/dist/tools/utils.cjs.map +1 -1
- package/dist/tools/utils.d.cts +0 -1
- package/dist/tools/utils.d.cts.map +1 -1
- package/dist/tools/utils.d.ts +0 -1
- package/dist/tools/utils.d.ts.map +1 -1
- package/dist/tools/utils.js.map +1 -1
- package/dist/tracers/base.cjs +7 -7
- package/dist/tracers/base.cjs.map +1 -1
- package/dist/tracers/base.d.cts +6 -12
- package/dist/tracers/base.d.cts.map +1 -1
- package/dist/tracers/base.d.ts +6 -12
- package/dist/tracers/base.d.ts.map +1 -1
- package/dist/tracers/base.js +5 -6
- package/dist/tracers/base.js.map +1 -1
- package/dist/tracers/console.cjs +9 -9
- package/dist/tracers/console.cjs.map +1 -1
- package/dist/tracers/console.d.cts +0 -1
- package/dist/tracers/console.d.cts.map +1 -1
- package/dist/tracers/console.d.ts +0 -1
- package/dist/tracers/console.d.ts.map +1 -1
- package/dist/tracers/console.js +6 -8
- package/dist/tracers/console.js.map +1 -1
- package/dist/tracers/event_stream.cjs +2 -4
- package/dist/tracers/event_stream.cjs.map +1 -1
- package/dist/tracers/event_stream.d.cts +2 -5
- package/dist/tracers/event_stream.d.cts.map +1 -1
- package/dist/tracers/event_stream.d.ts +2 -5
- package/dist/tracers/event_stream.d.ts.map +1 -1
- package/dist/tracers/event_stream.js +2 -4
- package/dist/tracers/event_stream.js.map +1 -1
- package/dist/tracers/log_stream.cjs +5 -5
- package/dist/tracers/log_stream.cjs.map +1 -1
- package/dist/tracers/log_stream.d.cts +14 -31
- package/dist/tracers/log_stream.d.cts.map +1 -1
- package/dist/tracers/log_stream.d.ts +14 -31
- package/dist/tracers/log_stream.d.ts.map +1 -1
- package/dist/tracers/log_stream.js +4 -5
- package/dist/tracers/log_stream.js.map +1 -1
- package/dist/tracers/root_listener.cjs.map +1 -1
- package/dist/tracers/root_listener.js.map +1 -1
- package/dist/tracers/run_collector.cjs +3 -3
- package/dist/tracers/run_collector.cjs.map +1 -1
- package/dist/tracers/run_collector.d.cts +0 -1
- package/dist/tracers/run_collector.d.cts.map +1 -1
- package/dist/tracers/run_collector.d.ts +0 -1
- package/dist/tracers/run_collector.d.ts.map +1 -1
- package/dist/tracers/run_collector.js +2 -3
- package/dist/tracers/run_collector.js.map +1 -1
- package/dist/tracers/tracer_langchain.cjs +8 -11
- package/dist/tracers/tracer_langchain.cjs.map +1 -1
- package/dist/tracers/tracer_langchain.d.cts +8 -8
- package/dist/tracers/tracer_langchain.d.cts.map +1 -1
- package/dist/tracers/tracer_langchain.d.ts +8 -8
- package/dist/tracers/tracer_langchain.d.ts.map +1 -1
- package/dist/tracers/tracer_langchain.js +5 -9
- package/dist/tracers/tracer_langchain.js.map +1 -1
- package/dist/types/_internal.d.cts.map +1 -1
- package/dist/types/_internal.d.ts.map +1 -1
- package/dist/types/stream.cjs +3 -1
- package/dist/types/stream.js +3 -1
- package/dist/types/type-utils.d.cts.map +1 -1
- package/dist/types/type-utils.d.ts.map +1 -1
- package/dist/utils/async_caller.cjs +8 -9
- package/dist/utils/async_caller.cjs.map +1 -1
- package/dist/utils/async_caller.d.cts.map +1 -1
- package/dist/utils/async_caller.d.ts.map +1 -1
- package/dist/utils/async_caller.js +5 -8
- package/dist/utils/async_caller.js.map +1 -1
- package/dist/utils/callbacks.cjs +2 -3
- package/dist/utils/callbacks.cjs.map +1 -1
- package/dist/utils/callbacks.js +2 -3
- package/dist/utils/callbacks.js.map +1 -1
- package/dist/utils/chunk_array.cjs +4 -5
- package/dist/utils/chunk_array.cjs.map +1 -1
- package/dist/utils/chunk_array.d.cts.map +1 -1
- package/dist/utils/chunk_array.d.ts.map +1 -1
- package/dist/utils/chunk_array.js +3 -5
- package/dist/utils/chunk_array.js.map +1 -1
- package/dist/utils/context.cjs +4 -5
- package/dist/utils/context.cjs.map +1 -1
- package/dist/utils/context.d.cts.map +1 -1
- package/dist/utils/context.d.ts.map +1 -1
- package/dist/utils/context.js +3 -5
- package/dist/utils/context.js.map +1 -1
- package/dist/utils/env.cjs +9 -12
- package/dist/utils/env.cjs.map +1 -1
- package/dist/utils/env.d.cts.map +1 -1
- package/dist/utils/env.d.ts.map +1 -1
- package/dist/utils/env.js +8 -12
- package/dist/utils/env.js.map +1 -1
- package/dist/utils/event_source_parse.cjs +9 -9
- package/dist/utils/event_source_parse.cjs.map +1 -1
- package/dist/utils/event_source_parse.d.cts.map +1 -1
- package/dist/utils/event_source_parse.d.ts.map +1 -1
- package/dist/utils/event_source_parse.js +8 -9
- package/dist/utils/event_source_parse.js.map +1 -1
- package/dist/utils/fast-json-patch/index.cjs +3 -0
- package/dist/utils/fast-json-patch/index.cjs.map +1 -1
- package/dist/utils/fast-json-patch/index.js +4 -0
- package/dist/utils/fast-json-patch/index.js.map +1 -1
- package/dist/utils/fast-json-patch/src/core.cjs +6 -10
- package/dist/utils/fast-json-patch/src/core.cjs.map +1 -1
- package/dist/utils/fast-json-patch/src/core.d.cts +0 -1
- package/dist/utils/fast-json-patch/src/core.d.cts.map +1 -1
- package/dist/utils/fast-json-patch/src/core.d.ts +0 -1
- package/dist/utils/fast-json-patch/src/core.d.ts.map +1 -1
- package/dist/utils/fast-json-patch/src/core.js +6 -10
- package/dist/utils/fast-json-patch/src/core.js.map +1 -1
- package/dist/utils/fast-json-patch/src/duplex.cjs +5 -3
- package/dist/utils/fast-json-patch/src/duplex.cjs.map +1 -1
- package/dist/utils/fast-json-patch/src/duplex.d.cts +0 -1
- package/dist/utils/fast-json-patch/src/duplex.d.cts.map +1 -1
- package/dist/utils/fast-json-patch/src/duplex.d.ts +0 -1
- package/dist/utils/fast-json-patch/src/duplex.d.ts.map +1 -1
- package/dist/utils/fast-json-patch/src/duplex.js +5 -3
- package/dist/utils/fast-json-patch/src/duplex.js.map +1 -1
- package/dist/utils/fast-json-patch/src/helpers.cjs +4 -4
- package/dist/utils/fast-json-patch/src/helpers.cjs.map +1 -1
- package/dist/utils/fast-json-patch/src/helpers.js +4 -4
- package/dist/utils/fast-json-patch/src/helpers.js.map +1 -1
- package/dist/utils/format.cjs +3 -1
- package/dist/utils/format.d.cts.map +1 -1
- package/dist/utils/format.d.ts.map +1 -1
- package/dist/utils/format.js +3 -1
- package/dist/utils/function_calling.cjs +3 -3
- package/dist/utils/function_calling.cjs.map +1 -1
- package/dist/utils/function_calling.d.cts +0 -1
- package/dist/utils/function_calling.d.cts.map +1 -1
- package/dist/utils/function_calling.d.ts +0 -1
- package/dist/utils/function_calling.d.ts.map +1 -1
- package/dist/utils/function_calling.js +2 -3
- package/dist/utils/function_calling.js.map +1 -1
- package/dist/utils/hash.cjs +3 -3
- package/dist/utils/hash.d.cts +0 -1
- package/dist/utils/hash.d.cts.map +1 -1
- package/dist/utils/hash.d.ts +0 -1
- package/dist/utils/hash.d.ts.map +1 -1
- package/dist/utils/hash.js +2 -3
- package/dist/utils/is-network-error/index.cjs +2 -3
- package/dist/utils/is-network-error/index.cjs.map +1 -1
- package/dist/utils/is-network-error/index.js +2 -3
- package/dist/utils/is-network-error/index.js.map +1 -1
- package/dist/utils/js-sha256/hash.cjs +41 -34
- package/dist/utils/js-sha256/hash.cjs.map +1 -1
- package/dist/utils/js-sha256/hash.d.cts.map +1 -1
- package/dist/utils/js-sha256/hash.d.ts.map +1 -1
- package/dist/utils/js-sha256/hash.js +41 -35
- package/dist/utils/js-sha256/hash.js.map +1 -1
- package/dist/utils/json.cjs.map +1 -1
- package/dist/utils/json.d.cts.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/json_patch.cjs +3 -3
- package/dist/utils/json_patch.js +2 -3
- package/dist/utils/json_schema.cjs +12 -14
- package/dist/utils/json_schema.cjs.map +1 -1
- package/dist/utils/json_schema.d.cts.map +1 -1
- package/dist/utils/json_schema.d.ts.map +1 -1
- package/dist/utils/json_schema.js +4 -7
- package/dist/utils/json_schema.js.map +1 -1
- package/dist/utils/math.cjs +7 -8
- package/dist/utils/math.cjs.map +1 -1
- package/dist/utils/math.d.cts.map +1 -1
- package/dist/utils/math.d.ts.map +1 -1
- package/dist/utils/math.js +8 -10
- package/dist/utils/math.js.map +1 -1
- package/dist/utils/ml-distance/distances.cjs.map +1 -1
- package/dist/utils/ml-distance/distances.js.map +1 -1
- package/dist/utils/ml-distance/similarities.cjs.map +1 -1
- package/dist/utils/ml-distance/similarities.d.cts.map +1 -1
- package/dist/utils/ml-distance/similarities.d.ts.map +1 -1
- package/dist/utils/ml-distance/similarities.js.map +1 -1
- package/dist/utils/ml-distance-euclidean/euclidean.cjs.map +1 -1
- package/dist/utils/ml-distance-euclidean/euclidean.js.map +1 -1
- package/dist/utils/namespace.cjs +63 -0
- package/dist/utils/namespace.cjs.map +1 -0
- package/dist/utils/namespace.d.cts +73 -0
- package/dist/utils/namespace.d.cts.map +1 -0
- package/dist/utils/namespace.d.ts +73 -0
- package/dist/utils/namespace.d.ts.map +1 -0
- package/dist/utils/namespace.js +62 -0
- package/dist/utils/namespace.js.map +1 -0
- package/dist/utils/p-retry/index.cjs +2 -2
- package/dist/utils/p-retry/index.cjs.map +1 -1
- package/dist/utils/p-retry/index.js +2 -2
- package/dist/utils/p-retry/index.js.map +1 -1
- package/dist/utils/sax-js/sax.cjs +28 -34
- package/dist/utils/sax-js/sax.cjs.map +1 -1
- package/dist/utils/sax-js/sax.js +28 -34
- package/dist/utils/sax-js/sax.js.map +1 -1
- package/dist/utils/signal.cjs +1 -1
- package/dist/utils/signal.cjs.map +1 -1
- package/dist/utils/signal.d.cts.map +1 -1
- package/dist/utils/signal.d.ts.map +1 -1
- package/dist/utils/signal.js +1 -1
- package/dist/utils/signal.js.map +1 -1
- package/dist/utils/ssrf.cjs +8 -10
- package/dist/utils/ssrf.cjs.map +1 -1
- package/dist/utils/ssrf.d.cts.map +1 -1
- package/dist/utils/ssrf.d.ts.map +1 -1
- package/dist/utils/ssrf.js +7 -10
- package/dist/utils/ssrf.js.map +1 -1
- package/dist/utils/stream.cjs +4 -4
- package/dist/utils/stream.cjs.map +1 -1
- package/dist/utils/stream.d.cts.map +1 -1
- package/dist/utils/stream.d.ts.map +1 -1
- package/dist/utils/stream.js +3 -4
- package/dist/utils/stream.js.map +1 -1
- package/dist/utils/testing/chat_models.cjs +3 -5
- package/dist/utils/testing/chat_models.cjs.map +1 -1
- package/dist/utils/testing/chat_models.d.cts.map +1 -1
- package/dist/utils/testing/chat_models.d.ts.map +1 -1
- package/dist/utils/testing/chat_models.js +3 -5
- package/dist/utils/testing/chat_models.js.map +1 -1
- package/dist/utils/testing/embeddings.cjs +2 -4
- package/dist/utils/testing/embeddings.cjs.map +1 -1
- package/dist/utils/testing/embeddings.d.cts +0 -1
- package/dist/utils/testing/embeddings.d.cts.map +1 -1
- package/dist/utils/testing/embeddings.d.ts +0 -1
- package/dist/utils/testing/embeddings.d.ts.map +1 -1
- package/dist/utils/testing/embeddings.js +2 -4
- package/dist/utils/testing/embeddings.js.map +1 -1
- package/dist/utils/testing/index.cjs +3 -3
- package/dist/utils/testing/index.js +2 -3
- package/dist/utils/testing/llms.cjs.map +1 -1
- package/dist/utils/testing/llms.d.cts.map +1 -1
- package/dist/utils/testing/llms.d.ts.map +1 -1
- package/dist/utils/testing/llms.js.map +1 -1
- package/dist/utils/testing/message_history.cjs +1 -1
- package/dist/utils/testing/message_history.cjs.map +1 -1
- package/dist/utils/testing/message_history.d.cts.map +1 -1
- package/dist/utils/testing/message_history.d.ts.map +1 -1
- package/dist/utils/testing/message_history.js +1 -1
- package/dist/utils/testing/message_history.js.map +1 -1
- package/dist/utils/testing/output_parsers.cjs.map +1 -1
- package/dist/utils/testing/output_parsers.d.cts +0 -1
- package/dist/utils/testing/output_parsers.d.cts.map +1 -1
- package/dist/utils/testing/output_parsers.d.ts +0 -1
- package/dist/utils/testing/output_parsers.d.ts.map +1 -1
- package/dist/utils/testing/output_parsers.js.map +1 -1
- package/dist/utils/testing/retrievers.cjs +1 -1
- package/dist/utils/testing/retrievers.cjs.map +1 -1
- package/dist/utils/testing/retrievers.d.cts.map +1 -1
- package/dist/utils/testing/retrievers.d.ts.map +1 -1
- package/dist/utils/testing/retrievers.js +1 -1
- package/dist/utils/testing/retrievers.js.map +1 -1
- package/dist/utils/testing/runnables.cjs.map +1 -1
- package/dist/utils/testing/runnables.d.cts.map +1 -1
- package/dist/utils/testing/runnables.d.ts.map +1 -1
- package/dist/utils/testing/runnables.js.map +1 -1
- package/dist/utils/testing/tools.cjs.map +1 -1
- package/dist/utils/testing/tools.d.cts.map +1 -1
- package/dist/utils/testing/tools.d.ts.map +1 -1
- package/dist/utils/testing/tools.js.map +1 -1
- package/dist/utils/testing/tracers.cjs.map +1 -1
- package/dist/utils/testing/tracers.d.cts.map +1 -1
- package/dist/utils/testing/tracers.d.ts.map +1 -1
- package/dist/utils/testing/tracers.js.map +1 -1
- package/dist/utils/testing/vectorstores.cjs +7 -11
- package/dist/utils/testing/vectorstores.cjs.map +1 -1
- package/dist/utils/testing/vectorstores.d.cts +0 -1
- package/dist/utils/testing/vectorstores.d.cts.map +1 -1
- package/dist/utils/testing/vectorstores.d.ts +0 -1
- package/dist/utils/testing/vectorstores.d.ts.map +1 -1
- package/dist/utils/testing/vectorstores.js +7 -11
- package/dist/utils/testing/vectorstores.js.map +1 -1
- package/dist/utils/tiktoken.cjs +4 -4
- package/dist/utils/tiktoken.cjs.map +1 -1
- package/dist/utils/tiktoken.d.cts.map +1 -1
- package/dist/utils/tiktoken.d.ts.map +1 -1
- package/dist/utils/tiktoken.js +2 -3
- package/dist/utils/tiktoken.js.map +1 -1
- package/dist/utils/types/index.cjs +3 -3
- package/dist/utils/types/index.d.cts +0 -1
- package/dist/utils/types/index.d.cts.map +1 -1
- package/dist/utils/types/index.d.ts +0 -1
- package/dist/utils/types/index.d.ts.map +1 -1
- package/dist/utils/types/index.js +2 -3
- package/dist/utils/types/zod.cjs +17 -32
- package/dist/utils/types/zod.cjs.map +1 -1
- package/dist/utils/types/zod.d.cts +1 -1
- package/dist/utils/types/zod.d.cts.map +1 -1
- package/dist/utils/types/zod.d.ts +1 -1
- package/dist/utils/types/zod.d.ts.map +1 -1
- package/dist/utils/types/zod.js +15 -30
- package/dist/utils/types/zod.js.map +1 -1
- package/dist/utils/zod-to-json-schema/Options.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/Options.js.map +1 -1
- package/dist/utils/zod-to-json-schema/Refs.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/Refs.js.map +1 -1
- package/dist/utils/zod-to-json-schema/errorMessages.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/errorMessages.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/errorMessages.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/errorMessages.js.map +1 -1
- package/dist/utils/zod-to-json-schema/getRelativePath.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/getRelativePath.js.map +1 -1
- package/dist/utils/zod-to-json-schema/index.js +2 -0
- package/dist/utils/zod-to-json-schema/parseDef.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parseDef.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parseTypes.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parseTypes.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/any.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/any.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/any.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/any.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/array.cjs +2 -2
- package/dist/utils/zod-to-json-schema/parsers/array.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/array.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/array.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/array.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/bigint.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/bigint.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/bigint.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/boolean.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/boolean.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/boolean.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/branded.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/branded.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/catch.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/catch.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/date.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts +0 -1
- package/dist/utils/zod-to-json-schema/parsers/date.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/date.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/date.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/default.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/default.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/effects.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/effects.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/enum.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/enum.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/enum.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/enum.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.cjs +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.js +1 -1
- package/dist/utils/zod-to-json-schema/parsers/intersection.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/literal.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts +0 -1
- package/dist/utils/zod-to-json-schema/parsers/literal.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/literal.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/literal.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/map.cjs +17 -19
- package/dist/utils/zod-to-json-schema/parsers/map.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts +0 -1
- package/dist/utils/zod-to-json-schema/parsers/map.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/map.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/map.js +17 -19
- package/dist/utils/zod-to-json-schema/parsers/map.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs +2 -3
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js +2 -3
- package/dist/utils/zod-to-json-schema/parsers/nativeEnum.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/never.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/never.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/never.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/never.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/null.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/null.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/null.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/null.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nullable.cjs +5 -5
- package/dist/utils/zod-to-json-schema/parsers/nullable.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nullable.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/nullable.js +5 -5
- package/dist/utils/zod-to-json-schema/parsers/nullable.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/number.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/number.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/number.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/number.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/object.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/object.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/object.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/object.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/optional.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/optional.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs +2 -3
- package/dist/utils/zod-to-json-schema/parsers/pipeline.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/pipeline.js +2 -3
- package/dist/utils/zod-to-json-schema/parsers/pipeline.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/promise.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/promise.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/readonly.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/readonly.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/record.cjs +4 -4
- package/dist/utils/zod-to-json-schema/parsers/record.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/record.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/record.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/record.js +2 -2
- package/dist/utils/zod-to-json-schema/parsers/record.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/set.cjs +4 -5
- package/dist/utils/zod-to-json-schema/parsers/set.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/set.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/set.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/set.js +4 -5
- package/dist/utils/zod-to-json-schema/parsers/set.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/string.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts +0 -1
- package/dist/utils/zod-to-json-schema/parsers/string.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts +0 -1
- package/dist/utils/zod-to-json-schema/parsers/string.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/string.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/tuple.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/tuple.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/tuple.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/undefined.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/undefined.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/undefined.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/union.cjs +3 -6
- package/dist/utils/zod-to-json-schema/parsers/union.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/union.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/union.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/union.js +3 -6
- package/dist/utils/zod-to-json-schema/parsers/union.js.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/unknown.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.cts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/unknown.d.ts.map +1 -1
- package/dist/utils/zod-to-json-schema/parsers/unknown.js.map +1 -1
- package/dist/utils/zod-to-json-schema/selectParser.cjs +3 -3
- package/dist/utils/zod-to-json-schema/selectParser.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/selectParser.js +1 -1
- package/dist/utils/zod-to-json-schema/selectParser.js.map +1 -1
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs +3 -3
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.cjs.map +1 -1
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.js +3 -3
- package/dist/utils/zod-to-json-schema/zodToJsonSchema.js.map +1 -1
- package/dist/vectorstores.cjs +4 -5
- package/dist/vectorstores.cjs.map +1 -1
- package/dist/vectorstores.d.cts +0 -1
- package/dist/vectorstores.d.cts.map +1 -1
- package/dist/vectorstores.d.ts +0 -1
- package/dist/vectorstores.d.ts.map +1 -1
- package/dist/vectorstores.js +3 -5
- package/dist/vectorstores.js.map +1 -1
- package/package.json +2 -2
- package/dist/_virtual/rolldown_runtime.cjs +0 -32
- package/dist/_virtual/rolldown_runtime.js +0 -11
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","names":[
|
|
1
|
+
{"version":3,"file":"json.js","names":[],"sources":["../../src/output_parsers/json.ts"],"sourcesContent":["import { BaseCumulativeTransformOutputParser } from \"./transform.js\";\nimport { Operation, compare } from \"../utils/json_patch.js\";\nimport { ChatGeneration, Generation } from \"../outputs.js\";\nimport { parseJsonMarkdown, parsePartialJson } from \"../utils/json.js\";\nimport type { BaseMessage } from \"../messages/index.js\";\n\n/**\n * Class for parsing the output of an LLM into a JSON object.\n */\nexport class JsonOutputParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Record<string, any> = Record<string, any>,\n> extends BaseCumulativeTransformOutputParser<T> {\n static lc_name() {\n return \"JsonOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\"];\n\n lc_serializable = true;\n\n /** @internal */\n override _concatOutputChunks<T>(first: T, second: T): T {\n if (this.diff) {\n return super._concatOutputChunks(first, second);\n }\n return second;\n }\n\n protected _diff(\n prev: unknown | undefined,\n next: unknown\n ): Operation[] | undefined {\n if (!next) {\n return undefined;\n }\n if (!prev) {\n return [{ op: \"replace\", path: \"\", value: next }];\n }\n return compare(prev, next);\n }\n\n // This should actually return Partial<T>, but there's no way\n // to specify emitted chunks as instances separate from the main output type.\n async parsePartialResult(\n generations: ChatGeneration[] | Generation[]\n ): Promise<T | undefined> {\n return parseJsonMarkdown(generations[0].text) as T | undefined;\n }\n\n async parse(text: string): Promise<T> {\n return parseJsonMarkdown(text, JSON.parse) as T;\n }\n\n getFormatInstructions(): string {\n return \"\";\n }\n\n /**\n * Extracts text content from a message for JSON parsing.\n * Uses the message's `.text` accessor which properly handles both\n * string content and ContentBlock[] arrays (extracting text from text blocks).\n * @param message The message to extract text from\n * @returns The text content of the message\n */\n protected _baseMessageToString(message: BaseMessage): string {\n return message.text;\n }\n}\n\nexport { parsePartialJson, parseJsonMarkdown };\n"],"mappings":";;;;;;;;;AASA,IAAa,mBAAb,cAGU,oCAAuC;CAC/C,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe,CAAC,kBAAkB,iBAAiB;CAEnD,kBAAkB;;CAGlB,AAAS,oBAAuB,OAAU,QAAc;AACtD,MAAI,KAAK,KACP,QAAO,MAAM,oBAAoB,OAAO,OAAO;AAEjD,SAAO;;CAGT,AAAU,MACR,MACA,MACyB;AACzB,MAAI,CAAC,KACH;AAEF,MAAI,CAAC,KACH,QAAO,CAAC;GAAE,IAAI;GAAW,MAAM;GAAI,OAAO;GAAM,CAAC;AAEnD,SAAO,QAAQ,MAAM,KAAK;;CAK5B,MAAM,mBACJ,aACwB;AACxB,SAAO,kBAAkB,YAAY,GAAG,KAAK;;CAG/C,MAAM,MAAM,MAA0B;AACpC,SAAO,kBAAkB,MAAM,KAAK,MAAM;;CAG5C,wBAAgC;AAC9B,SAAO;;;;;;;;;CAUT,AAAU,qBAAqB,SAA8B;AAC3D,SAAO,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.cjs","names":["BaseTransformOutputParser","
|
|
1
|
+
{"version":3,"file":"list.cjs","names":["BaseTransformOutputParser","OutputParserException"],"sources":["../../src/output_parsers/list.ts"],"sourcesContent":["import { BaseMessage } from \"../messages/index.js\";\nimport { OutputParserException } from \"./base.js\";\nimport { BaseTransformOutputParser } from \"./transform.js\";\n\n/**\n * Class to parse the output of an LLM call to a list.\n * @augments BaseOutputParser\n */\nexport abstract class ListOutputParser extends BaseTransformOutputParser<\n string[]\n> {\n re?: RegExp;\n\n async *_transform(\n inputGenerator: AsyncGenerator<string | BaseMessage>\n ): AsyncGenerator<string[]> {\n let buffer = \"\";\n for await (const input of inputGenerator) {\n if (typeof input === \"string\") {\n // add current chunk to buffer\n buffer += input;\n } else {\n // extract message content and add to buffer\n buffer += input.content;\n }\n // get parts in buffer\n if (!this.re) {\n const parts = await this.parse(buffer);\n if (parts.length > 1) {\n // if there are multiple parts, yield all but the last one\n for (const part of parts.slice(0, -1)) {\n yield [part];\n }\n // keep the last part in the buffer\n buffer = parts[parts.length - 1];\n }\n } else {\n // if there is a regex, get all matches\n const matches = [...buffer.matchAll(this.re)];\n if (matches.length > 1) {\n let doneIdx = 0;\n // if there are multiple matches, yield all but the last one\n for (const match of matches.slice(0, -1)) {\n yield [match[1]];\n doneIdx += (match.index ?? 0) + match[0].length;\n }\n // keep the last match in the buffer\n buffer = buffer.slice(doneIdx);\n }\n }\n }\n\n // yield the last part\n for (const part of await this.parse(buffer)) {\n yield [part];\n }\n }\n}\n\n/**\n * Class to parse the output of an LLM call as a comma-separated list.\n * @augments ListOutputParser\n */\nexport class CommaSeparatedListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"CommaSeparatedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n /**\n * Parses the given text into an array of strings, using a comma as the\n * separator. If the parsing fails, throws an OutputParserException.\n * @param text The text to parse.\n * @returns An array of strings obtained by splitting the input text at each comma.\n */\n async parse(text: string): Promise<string[]> {\n try {\n return text\n .trim()\n .split(\",\")\n .map((s) => s.trim());\n } catch {\n throw new OutputParserException(`Could not parse output: ${text}`, text);\n }\n }\n\n /**\n * Provides instructions on the expected format of the response for the\n * CommaSeparatedListOutputParser.\n * @returns A string containing instructions on the expected format of the response.\n */\n getFormatInstructions(): string {\n return `Your response should be a list of comma separated values, eg: \\`foo, bar, baz\\``;\n }\n}\n\n/**\n * Class to parse the output of an LLM call to a list with a specific length and separator.\n * @augments ListOutputParser\n */\nexport class CustomListOutputParser extends ListOutputParser {\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n private length: number | undefined;\n\n private separator: string;\n\n constructor({ length, separator }: { length?: number; separator?: string }) {\n super(...arguments);\n this.length = length;\n this.separator = separator || \",\";\n }\n\n /**\n * Parses the given text into an array of strings, using the specified\n * separator. If the parsing fails or the number of items in the list\n * doesn't match the expected length, throws an OutputParserException.\n * @param text The text to parse.\n * @returns An array of strings obtained by splitting the input text at each occurrence of the specified separator.\n */\n async parse(text: string): Promise<string[]> {\n try {\n const items = text\n .trim()\n .split(this.separator)\n .map((s) => s.trim());\n if (this.length !== undefined && items.length !== this.length) {\n throw new OutputParserException(\n `Incorrect number of items. Expected ${this.length}, got ${items.length}.`\n );\n }\n return items;\n } catch (e) {\n if (Object.getPrototypeOf(e) === OutputParserException.prototype) {\n throw e;\n }\n throw new OutputParserException(`Could not parse output: ${text}`);\n }\n }\n\n /**\n * Provides instructions on the expected format of the response for the\n * CustomListOutputParser, including the number of items and the\n * separator.\n * @returns A string containing instructions on the expected format of the response.\n */\n getFormatInstructions(): string {\n return `Your response should be a list of ${\n this.length === undefined ? \"\" : `${this.length} `\n }items separated by \"${this.separator}\" (eg: \\`foo${this.separator} bar${\n this.separator\n } baz\\`)`;\n }\n}\n\nexport class NumberedListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"NumberedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n getFormatInstructions(): string {\n return `Your response should be a numbered list with each item on a new line. For example: \\n\\n1. foo\\n\\n2. bar\\n\\n3. baz`;\n }\n\n re = /\\d+\\.\\s([^\\n]+)/g;\n\n async parse(text: string): Promise<string[]> {\n return [...(text.matchAll(this.re) ?? [])].map((m) => m[1]);\n }\n}\n\nexport class MarkdownListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"NumberedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n getFormatInstructions(): string {\n return `Your response should be a numbered list with each item on a new line. For example: \\n\\n1. foo\\n\\n2. bar\\n\\n3. baz`;\n }\n\n re = /^\\s*[-*]\\s([^\\n]+)$/gm;\n\n async parse(text: string): Promise<string[]> {\n return [...(text.matchAll(this.re) ?? [])].map((m) => m[1]);\n }\n}\n"],"m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|
1
|
+
{"version":3,"file":"list.d.cts","names":[],"sources":["../../src/output_parsers/list.ts"],"mappings":";;;;;;AAQA;;uBAAsB,gBAAA,SAAyB,yBAAA;EAG7C,EAAA,GAAK,MAAA;EAEE,UAAA,CACL,cAAA,EAAgB,cAAA,UAAwB,WAAA,IACvC,cAAA;AAAA;;;;;cAgDQ,8BAAA,SAAuC,gBAAA;EAAA,OAC3C,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAxDkB;;;;;;EAgEZ,KAAA,CAAM,IAAA,WAAe,OAAA;EAfe;;;;;EA+B1C,qBAAA,CAAA;AAAA;;;;;cASW,sBAAA,SAA+B,gBAAA;EAC1C,YAAA;EAAA,QAEQ,MAAA;EAAA,QAEA,SAAA;EAER,WAAA,CAAA;IAAc,MAAA;IAAQ;EAAA;IAAe,MAAA;IAAiB,SAAA;EAAA;EAPZ;;;;;;;EAoBpC,KAAA,CAAM,IAAA,WAAe,OAAA;EAbb;;;;;;EAuCd,qBAAA,CAAA;AAAA;AAAA,cASW,wBAAA,SAAiC,gBAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,qBAAA,CAAA;EAIA,EAAA,EAAE,MAAA;EAEI,KAAA,CAAM,IAAA,WAAe,OAAA;AAAA;AAAA,cAKhB,wBAAA,SAAiC,gBAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,qBAAA,CAAA;EAIA,EAAA,EAAE,MAAA;EAEI,KAAA,CAAM,IAAA,WAAe,OAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"list.d.ts","names":[],"sources":["../../src/output_parsers/list.ts"],"mappings":";;;;;;;;AAQA;uBAAsB,gBAAA,SAAyB,yBAAA;EAG7C,EAAA,GAAK,MAAA;EAEE,UAAA,CACL,cAAA,EAAgB,cAAA,UAAwB,WAAA,IACvC,cAAA;AAAA;;;;;cAgDQ,8BAAA,SAAuC,gBAAA;EAAA,OAC3C,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAzDO;;;;;;EAiED,KAAA,CAAM,IAAA,WAAe,OAAA;EAfhB;;;;;EA+BX,qBAAA,CAAA;AAAA;;;;;cASW,sBAAA,SAA+B,gBAAA;EAC1C,YAAA;EAAA,QAEQ,MAAA;EAAA,QAEA,SAAA;EAER,WAAA,CAAA;IAAc,MAAA;IAAQ;EAAA;IAAe,MAAA;IAAiB,SAAA;EAAA;EAa3B;;;;;;;EAArB,KAAA,CAAM,IAAA,WAAe,OAAA;EAb3B;;;;;;EAuCA,qBAAA,CAAA;AAAA;AAAA,cASW,wBAAA,SAAiC,gBAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,qBAAA,CAAA;EAIA,EAAA,EAAE,MAAA;EAEI,KAAA,CAAM,IAAA,WAAe,OAAA;AAAA;AAAA,cAKhB,wBAAA,SAAiC,gBAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,qBAAA,CAAA;EAIA,EAAA,EAAE,MAAA;EAEI,KAAA,CAAM,IAAA,WAAe,OAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","names":[
|
|
1
|
+
{"version":3,"file":"list.js","names":[],"sources":["../../src/output_parsers/list.ts"],"sourcesContent":["import { BaseMessage } from \"../messages/index.js\";\nimport { OutputParserException } from \"./base.js\";\nimport { BaseTransformOutputParser } from \"./transform.js\";\n\n/**\n * Class to parse the output of an LLM call to a list.\n * @augments BaseOutputParser\n */\nexport abstract class ListOutputParser extends BaseTransformOutputParser<\n string[]\n> {\n re?: RegExp;\n\n async *_transform(\n inputGenerator: AsyncGenerator<string | BaseMessage>\n ): AsyncGenerator<string[]> {\n let buffer = \"\";\n for await (const input of inputGenerator) {\n if (typeof input === \"string\") {\n // add current chunk to buffer\n buffer += input;\n } else {\n // extract message content and add to buffer\n buffer += input.content;\n }\n // get parts in buffer\n if (!this.re) {\n const parts = await this.parse(buffer);\n if (parts.length > 1) {\n // if there are multiple parts, yield all but the last one\n for (const part of parts.slice(0, -1)) {\n yield [part];\n }\n // keep the last part in the buffer\n buffer = parts[parts.length - 1];\n }\n } else {\n // if there is a regex, get all matches\n const matches = [...buffer.matchAll(this.re)];\n if (matches.length > 1) {\n let doneIdx = 0;\n // if there are multiple matches, yield all but the last one\n for (const match of matches.slice(0, -1)) {\n yield [match[1]];\n doneIdx += (match.index ?? 0) + match[0].length;\n }\n // keep the last match in the buffer\n buffer = buffer.slice(doneIdx);\n }\n }\n }\n\n // yield the last part\n for (const part of await this.parse(buffer)) {\n yield [part];\n }\n }\n}\n\n/**\n * Class to parse the output of an LLM call as a comma-separated list.\n * @augments ListOutputParser\n */\nexport class CommaSeparatedListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"CommaSeparatedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n /**\n * Parses the given text into an array of strings, using a comma as the\n * separator. If the parsing fails, throws an OutputParserException.\n * @param text The text to parse.\n * @returns An array of strings obtained by splitting the input text at each comma.\n */\n async parse(text: string): Promise<string[]> {\n try {\n return text\n .trim()\n .split(\",\")\n .map((s) => s.trim());\n } catch {\n throw new OutputParserException(`Could not parse output: ${text}`, text);\n }\n }\n\n /**\n * Provides instructions on the expected format of the response for the\n * CommaSeparatedListOutputParser.\n * @returns A string containing instructions on the expected format of the response.\n */\n getFormatInstructions(): string {\n return `Your response should be a list of comma separated values, eg: \\`foo, bar, baz\\``;\n }\n}\n\n/**\n * Class to parse the output of an LLM call to a list with a specific length and separator.\n * @augments ListOutputParser\n */\nexport class CustomListOutputParser extends ListOutputParser {\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n private length: number | undefined;\n\n private separator: string;\n\n constructor({ length, separator }: { length?: number; separator?: string }) {\n super(...arguments);\n this.length = length;\n this.separator = separator || \",\";\n }\n\n /**\n * Parses the given text into an array of strings, using the specified\n * separator. If the parsing fails or the number of items in the list\n * doesn't match the expected length, throws an OutputParserException.\n * @param text The text to parse.\n * @returns An array of strings obtained by splitting the input text at each occurrence of the specified separator.\n */\n async parse(text: string): Promise<string[]> {\n try {\n const items = text\n .trim()\n .split(this.separator)\n .map((s) => s.trim());\n if (this.length !== undefined && items.length !== this.length) {\n throw new OutputParserException(\n `Incorrect number of items. Expected ${this.length}, got ${items.length}.`\n );\n }\n return items;\n } catch (e) {\n if (Object.getPrototypeOf(e) === OutputParserException.prototype) {\n throw e;\n }\n throw new OutputParserException(`Could not parse output: ${text}`);\n }\n }\n\n /**\n * Provides instructions on the expected format of the response for the\n * CustomListOutputParser, including the number of items and the\n * separator.\n * @returns A string containing instructions on the expected format of the response.\n */\n getFormatInstructions(): string {\n return `Your response should be a list of ${\n this.length === undefined ? \"\" : `${this.length} `\n }items separated by \"${this.separator}\" (eg: \\`foo${this.separator} bar${\n this.separator\n } baz\\`)`;\n }\n}\n\nexport class NumberedListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"NumberedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n getFormatInstructions(): string {\n return `Your response should be a numbered list with each item on a new line. For example: \\n\\n1. foo\\n\\n2. bar\\n\\n3. baz`;\n }\n\n re = /\\d+\\.\\s([^\\n]+)/g;\n\n async parse(text: string): Promise<string[]> {\n return [...(text.matchAll(this.re) ?? [])].map((m) => m[1]);\n }\n}\n\nexport class MarkdownListOutputParser extends ListOutputParser {\n static lc_name() {\n return \"NumberedListOutputParser\";\n }\n\n lc_namespace = [\"langchain_core\", \"output_parsers\", \"list\"];\n\n lc_serializable = true;\n\n getFormatInstructions(): string {\n return `Your response should be a numbered list with each item on a new line. For example: \\n\\n1. foo\\n\\n2. bar\\n\\n3. baz`;\n }\n\n re = /^\\s*[-*]\\s([^\\n]+)$/gm;\n\n async parse(text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
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_json_output_functions_parsers = require('./json_output_functions_parsers.cjs');
|
|
3
4
|
|
|
4
5
|
//#region src/output_parsers/openai_functions/index.ts
|
|
5
|
-
var openai_functions_exports = {
|
|
6
|
-
require_rolldown_runtime.__export(openai_functions_exports, {
|
|
6
|
+
var openai_functions_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
7
7
|
JsonKeyOutputFunctionsParser: () => require_json_output_functions_parsers.JsonKeyOutputFunctionsParser,
|
|
8
8
|
JsonOutputFunctionsParser: () => require_json_output_functions_parsers.JsonOutputFunctionsParser,
|
|
9
9
|
OutputFunctionsParser: () => require_json_output_functions_parsers.OutputFunctionsParser
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { JsonKeyOutputFunctionsParser, JsonOutputFunctionsParser, OutputFunctionsParser } from "./json_output_functions_parsers.js";
|
|
3
3
|
|
|
4
4
|
//#region src/output_parsers/openai_functions/index.ts
|
|
5
|
-
var openai_functions_exports = {
|
|
6
|
-
__export(openai_functions_exports, {
|
|
5
|
+
var openai_functions_exports = /* @__PURE__ */ __exportAll({
|
|
7
6
|
JsonKeyOutputFunctionsParser: () => JsonKeyOutputFunctionsParser,
|
|
8
7
|
JsonOutputFunctionsParser: () => JsonOutputFunctionsParser,
|
|
9
8
|
OutputFunctionsParser: () => OutputFunctionsParser
|
|
@@ -33,8 +33,7 @@ var OutputFunctionsParser = class extends require_base.BaseLLMOutputParser {
|
|
|
33
33
|
*/
|
|
34
34
|
async parseResult(generations) {
|
|
35
35
|
if ("message" in generations[0]) {
|
|
36
|
-
const
|
|
37
|
-
const functionCall = gen.message.additional_kwargs.function_call;
|
|
36
|
+
const functionCall = generations[0].message.additional_kwargs.function_call;
|
|
38
37
|
if (!functionCall) throw new Error(`No function_call in message ${JSON.stringify(generations)}`);
|
|
39
38
|
if (!functionCall.arguments) throw new Error(`No arguments in function_call ${JSON.stringify(generations)}`);
|
|
40
39
|
if (this.argsOnly) return functionCall.arguments;
|
|
@@ -64,16 +63,15 @@ var JsonOutputFunctionsParser = class extends require_transform.BaseCumulativeTr
|
|
|
64
63
|
this.outputParser = new OutputFunctionsParser(config);
|
|
65
64
|
}
|
|
66
65
|
_diff(prev, next) {
|
|
67
|
-
if (!next) return
|
|
68
|
-
|
|
69
|
-
return ops;
|
|
66
|
+
if (!next) return;
|
|
67
|
+
return require_duplex.compare(prev ?? {}, next);
|
|
70
68
|
}
|
|
71
69
|
async parsePartialResult(generations) {
|
|
72
70
|
const generation = generations[0];
|
|
73
|
-
if (!generation.message) return
|
|
71
|
+
if (!generation.message) return;
|
|
74
72
|
const { message } = generation;
|
|
75
73
|
const functionCall = message.additional_kwargs.function_call;
|
|
76
|
-
if (!functionCall) return
|
|
74
|
+
if (!functionCall) return;
|
|
77
75
|
if (this.argsOnly) return require_json.parsePartialJson(functionCall.arguments);
|
|
78
76
|
return {
|
|
79
77
|
...functionCall,
|
|
@@ -132,8 +130,7 @@ var JsonKeyOutputFunctionsParser = class extends require_base.BaseLLMOutputParse
|
|
|
132
130
|
* @returns The value of a specific attribute of the parsed JSON object.
|
|
133
131
|
*/
|
|
134
132
|
async parseResult(generations) {
|
|
135
|
-
|
|
136
|
-
return result[this.attrName];
|
|
133
|
+
return (await this.outputParser.parseResult(generations))[this.attrName];
|
|
137
134
|
}
|
|
138
135
|
};
|
|
139
136
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_output_functions_parsers.cjs","names":["BaseLLMOutputParser","
|
|
1
|
+
{"version":3,"file":"json_output_functions_parsers.cjs","names":["BaseLLMOutputParser","BaseCumulativeTransformOutputParser","compare","parsePartialJson"],"sources":["../../../src/output_parsers/openai_functions/json_output_functions_parsers.ts"],"sourcesContent":["import { Optional } from \"../../types/type-utils.js\";\nimport { Generation, ChatGeneration } from \"../../outputs.js\";\nimport { BaseLLMOutputParser } from \"../base.js\";\nimport { parsePartialJson } from \"../json.js\";\nimport {\n BaseCumulativeTransformOutputParser,\n BaseCumulativeTransformOutputParserInput,\n} from \"../transform.js\";\nimport { JsonSchema7ObjectType } from \"../../utils/json_schema.js\";\nimport {\n compare,\n type Operation as JSONPatchOperation,\n} from \"../../utils/json_patch.js\";\n\n/**\n * Represents optional parameters for a function in a JSON Schema.\n */\nexport type FunctionParameters = Optional<\n JsonSchema7ObjectType,\n \"additionalProperties\"\n>;\n\n/**\n * Class for parsing the output of an LLM. Can be configured to return\n * only the arguments of the function call in the output.\n */\nexport class OutputFunctionsParser extends BaseLLMOutputParser<string> {\n static lc_name() {\n return \"OutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n argsOnly = true;\n\n constructor(config?: { argsOnly?: boolean }) {\n super();\n this.argsOnly = config?.argsOnly ?? this.argsOnly;\n }\n\n /**\n * Parses the output and returns a string representation of the function\n * call or its arguments.\n * @param generations The output of the LLM to parse.\n * @returns A string representation of the function call or its arguments.\n */\n async parseResult(\n generations: Generation[] | ChatGeneration[]\n ): Promise<string> {\n if (\"message\" in generations[0]) {\n const gen = generations[0] as ChatGeneration;\n const functionCall = gen.message.additional_kwargs.function_call;\n if (!functionCall) {\n throw new Error(\n `No function_call in message ${JSON.stringify(generations)}`\n );\n }\n if (!functionCall.arguments) {\n throw new Error(\n `No arguments in function_call ${JSON.stringify(generations)}`\n );\n }\n if (this.argsOnly) {\n return functionCall.arguments;\n }\n return JSON.stringify(functionCall);\n } else {\n throw new Error(\n `No message in generations ${JSON.stringify(generations)}`\n );\n }\n }\n}\n\n/**\n * Class for parsing the output of an LLM into a JSON object. Uses an\n * instance of `OutputFunctionsParser` to parse the output.\n */\nexport class JsonOutputFunctionsParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Output extends Record<string, any> = Record<string, any>,\n> extends BaseCumulativeTransformOutputParser<Output> {\n static lc_name() {\n return \"JsonOutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n outputParser: OutputFunctionsParser;\n\n argsOnly = true;\n\n constructor(\n config?: { argsOnly?: boolean } & BaseCumulativeTransformOutputParserInput\n ) {\n super(config);\n this.argsOnly = config?.argsOnly ?? this.argsOnly;\n this.outputParser = new OutputFunctionsParser(config);\n }\n\n protected _diff(\n prev: unknown | undefined,\n next: unknown\n ): JSONPatchOperation[] | undefined {\n if (!next) {\n return undefined;\n }\n const ops = compare(prev ?? {}, next);\n return ops;\n }\n\n async parsePartialResult(\n generations: ChatGeneration[]\n ): Promise<Output | undefined> {\n const generation = generations[0];\n if (!generation.message) {\n return undefined;\n }\n const { message } = generation;\n const functionCall = message.additional_kwargs.function_call;\n if (!functionCall) {\n return undefined;\n }\n if (this.argsOnly) {\n return parsePartialJson(functionCall.arguments);\n }\n\n return {\n ...functionCall,\n arguments: parsePartialJson(functionCall.arguments),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as Record<string, any> as Output;\n }\n\n /**\n * Parses the output and returns a JSON object. If `argsOnly` is true,\n * only the arguments of the function call are returned.\n * @param generations The output of the LLM to parse.\n * @returns A JSON object representation of the function call or its arguments.\n */\n async parseResult(\n generations: Generation[] | ChatGeneration[]\n ): Promise<Output> {\n const result = await this.outputParser.parseResult(generations);\n if (!result) {\n throw new Error(\n `No result from \"OutputFunctionsParser\" ${JSON.stringify(generations)}`\n );\n }\n return this.parse(result);\n }\n\n async parse(text: string): Promise<Output> {\n const parsedResult = JSON.parse(text);\n if (this.argsOnly) {\n return parsedResult;\n }\n parsedResult.arguments = JSON.parse(parsedResult.arguments);\n return parsedResult;\n }\n\n getFormatInstructions(): string {\n return \"\";\n }\n}\n\n/**\n * Class for parsing the output of an LLM into a JSON object and returning\n * a specific attribute. Uses an instance of `JsonOutputFunctionsParser`\n * to parse the output.\n */\nexport class JsonKeyOutputFunctionsParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Record<string, any> = Record<string, any>,\n> extends BaseLLMOutputParser<T> {\n static lc_name() {\n return \"JsonKeyOutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n outputParser = new JsonOutputFunctionsParser();\n\n attrName: string;\n\n get lc_aliases() {\n return {\n attrName: \"key_name\",\n };\n }\n\n constructor(fields: { attrName: string }) {\n super(fields);\n this.attrName = fields.attrName;\n }\n\n /**\n * Parses the output and returns a specific attribute of the parsed JSON\n * object.\n * @param generations The output of the LLM to parse.\n * @returns The value of a specific attribute of the parsed JSON object.\n */\n async parseResult(generations: Generation[] | ChatGeneration[]): Promise<T> {\n const result = await this.outputParser.parseResult(generations);\n return result[this.attrName as keyof typeof result] as T;\n }\n}\n"],"mappings":";;;;;;;;;;;;AA0BA,IAAa,wBAAb,cAA2CA,iCAA4B;CACrE,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAkB;EAAmB;CAElE,kBAAkB;CAElB,WAAW;CAEX,YAAY,QAAiC;AAC3C,SAAO;AACP,OAAK,WAAW,QAAQ,YAAY,KAAK;;;;;;;;CAS3C,MAAM,YACJ,aACiB;AACjB,MAAI,aAAa,YAAY,IAAI;GAE/B,MAAM,eADM,YAAY,GACC,QAAQ,kBAAkB;AACnD,OAAI,CAAC,aACH,OAAM,IAAI,MACR,+BAA+B,KAAK,UAAU,YAAY,GAC3D;AAEH,OAAI,CAAC,aAAa,UAChB,OAAM,IAAI,MACR,iCAAiC,KAAK,UAAU,YAAY,GAC7D;AAEH,OAAI,KAAK,SACP,QAAO,aAAa;AAEtB,UAAO,KAAK,UAAU,aAAa;QAEnC,OAAM,IAAI,MACR,6BAA6B,KAAK,UAAU,YAAY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AAO;AACb,OAAK,WAAW,OAAO;;;;;;;;CASzB,MAAM,YAAY,aAA0D;AAE1E,UADe,MAAM,KAAK,aAAa,YAAY,YAAY,EACjD,KAAK"}
|
|
@@ -6,7 +6,6 @@ import { BaseCumulativeTransformOutputParser, BaseCumulativeTransformOutputParse
|
|
|
6
6
|
import { Optional } from "../../types/type-utils.cjs";
|
|
7
7
|
|
|
8
8
|
//#region src/output_parsers/openai_functions/json_output_functions_parsers.d.ts
|
|
9
|
-
|
|
10
9
|
/**
|
|
11
10
|
* Represents optional parameters for a function in a JSON Schema.
|
|
12
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_output_functions_parsers.d.cts","names":[
|
|
1
|
+
{"version":3,"file":"json_output_functions_parsers.d.cts","names":[],"sources":["../../../src/output_parsers/openai_functions/json_output_functions_parsers.ts"],"mappings":";;;;;;;;;;AAiBA;KAAY,kBAAA,GAAqB,QAAA,CAC/B,qBAAA;;;;AAQF;cAAa,qBAAA,SAA8B,mBAAA;EAAA,OAClC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,QAAA;EAEA,WAAA,CAAY,MAAA;IAAW,QAAA;EAAA;EAXkB;;;;;;EAsBnC,WAAA,CACJ,WAAA,EAAa,UAAA,KAAe,cAAA,KAC3B,OAAA;AAAA;;;;;cA8BQ,yBAAA,gBAEI,MAAA,gBAAsB,MAAA,uBAC7B,mCAAA,CAAoC,MAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,YAAA,EAAc,qBAAA;EAEd,QAAA;EAEA,WAAA,CACE,MAAA;IAAW,QAAA;EAAA,IAAuB,wCAAA;EAAA,UAO1B,KAAA,CACR,IAAA,uBACA,IAAA,YACC,SAAA;EAQG,kBAAA,CACJ,WAAA,EAAa,cAAA,KACZ,OAAA,CAAQ,MAAA;EAVR;;;;;;EAqCG,WAAA,CACJ,WAAA,EAAa,UAAA,KAAe,cAAA,KAC3B,OAAA,CAAQ,MAAA;EAUL,KAAA,CAAM,IAAA,WAAe,OAAA,CAAQ,MAAA;EASnC,qBAAA,CAAA;AAAA;;;;;;cAUW,4BAAA,WAED,MAAA,gBAAsB,MAAA,uBACxB,mBAAA,CAAoB,CAAA;EAAA,OACrB,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,YAAA,EAAY,yBAAA,CAAA,MAAA;EAEZ,QAAA;EAAA,IAEI,UAAA,CAAA;;;EAMJ,WAAA,CAAY,MAAA;IAAU,QAAA;EAAA;EApGpB;;;;;;EA+GI,WAAA,CAAY,WAAA,EAAa,UAAA,KAAe,cAAA,KAAmB,OAAA,CAAQ,CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_output_functions_parsers.d.ts","names":[
|
|
1
|
+
{"version":3,"file":"json_output_functions_parsers.d.ts","names":[],"sources":["../../../src/output_parsers/openai_functions/json_output_functions_parsers.ts"],"mappings":";;;;;;;;;;;;KAiBY,kBAAA,GAAqB,QAAA,CAC/B,qBAAA;;;;;cAQW,qBAAA,SAA8B,mBAAA;EAAA,OAClC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,QAAA;EAEA,WAAA,CAAY,MAAA;IAAW,QAAA;EAAA;EAXqC;;;;;;EAsBtD,WAAA,CACJ,WAAA,EAAa,UAAA,KAAe,cAAA,KAC3B,OAAA;AAAA;;;;;cA8BQ,yBAAA,gBAEI,MAAA,gBAAsB,MAAA,uBAC7B,mCAAA,CAAoC,MAAA;EAAA,OACrC,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,YAAA,EAAc,qBAAA;EAEd,QAAA;EAEA,WAAA,CACE,MAAA;IAAW,QAAA;EAAA,IAAuB,wCAAA;EAAA,UAO1B,KAAA,CACR,IAAA,uBACA,IAAA,YACC,SAAA;EAQG,kBAAA,CACJ,WAAA,EAAa,cAAA,KACZ,OAAA,CAAQ,MAAA;EApByB;;;;;;EA+C9B,WAAA,CACJ,WAAA,EAAa,UAAA,KAAe,cAAA,KAC3B,OAAA,CAAQ,MAAA;EAUL,KAAA,CAAM,IAAA,WAAe,OAAA,CAAQ,MAAA;EASnC,qBAAA,CAAA;AAAA;;;;;;cAUW,4BAAA,WAED,MAAA,gBAAsB,MAAA,uBACxB,mBAAA,CAAoB,CAAA;EAAA,OACrB,OAAA,CAAA;EAIP,YAAA;EAEA,eAAA;EAEA,YAAA,EAAY,yBAAA,CAAA,MAAA;EAEZ,QAAA;EAAA,IAEI,UAAA,CAAA;;;EAMJ,WAAA,CAAY,MAAA;IAAU,QAAA;EAAA;EApGc;;;;;;EA+G9B,WAAA,CAAY,WAAA,EAAa,UAAA,KAAe,cAAA,KAAmB,OAAA,CAAQ,CAAA;AAAA"}
|
|
@@ -33,8 +33,7 @@ var OutputFunctionsParser = class extends BaseLLMOutputParser {
|
|
|
33
33
|
*/
|
|
34
34
|
async parseResult(generations) {
|
|
35
35
|
if ("message" in generations[0]) {
|
|
36
|
-
const
|
|
37
|
-
const functionCall = gen.message.additional_kwargs.function_call;
|
|
36
|
+
const functionCall = generations[0].message.additional_kwargs.function_call;
|
|
38
37
|
if (!functionCall) throw new Error(`No function_call in message ${JSON.stringify(generations)}`);
|
|
39
38
|
if (!functionCall.arguments) throw new Error(`No arguments in function_call ${JSON.stringify(generations)}`);
|
|
40
39
|
if (this.argsOnly) return functionCall.arguments;
|
|
@@ -64,16 +63,15 @@ var JsonOutputFunctionsParser = class extends BaseCumulativeTransformOutputParse
|
|
|
64
63
|
this.outputParser = new OutputFunctionsParser(config);
|
|
65
64
|
}
|
|
66
65
|
_diff(prev, next) {
|
|
67
|
-
if (!next) return
|
|
68
|
-
|
|
69
|
-
return ops;
|
|
66
|
+
if (!next) return;
|
|
67
|
+
return compare(prev ?? {}, next);
|
|
70
68
|
}
|
|
71
69
|
async parsePartialResult(generations) {
|
|
72
70
|
const generation = generations[0];
|
|
73
|
-
if (!generation.message) return
|
|
71
|
+
if (!generation.message) return;
|
|
74
72
|
const { message } = generation;
|
|
75
73
|
const functionCall = message.additional_kwargs.function_call;
|
|
76
|
-
if (!functionCall) return
|
|
74
|
+
if (!functionCall) return;
|
|
77
75
|
if (this.argsOnly) return parsePartialJson(functionCall.arguments);
|
|
78
76
|
return {
|
|
79
77
|
...functionCall,
|
|
@@ -132,8 +130,7 @@ var JsonKeyOutputFunctionsParser = class extends BaseLLMOutputParser {
|
|
|
132
130
|
* @returns The value of a specific attribute of the parsed JSON object.
|
|
133
131
|
*/
|
|
134
132
|
async parseResult(generations) {
|
|
135
|
-
|
|
136
|
-
return result[this.attrName];
|
|
133
|
+
return (await this.outputParser.parseResult(generations))[this.attrName];
|
|
137
134
|
}
|
|
138
135
|
};
|
|
139
136
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json_output_functions_parsers.js","names":[
|
|
1
|
+
{"version":3,"file":"json_output_functions_parsers.js","names":[],"sources":["../../../src/output_parsers/openai_functions/json_output_functions_parsers.ts"],"sourcesContent":["import { Optional } from \"../../types/type-utils.js\";\nimport { Generation, ChatGeneration } from \"../../outputs.js\";\nimport { BaseLLMOutputParser } from \"../base.js\";\nimport { parsePartialJson } from \"../json.js\";\nimport {\n BaseCumulativeTransformOutputParser,\n BaseCumulativeTransformOutputParserInput,\n} from \"../transform.js\";\nimport { JsonSchema7ObjectType } from \"../../utils/json_schema.js\";\nimport {\n compare,\n type Operation as JSONPatchOperation,\n} from \"../../utils/json_patch.js\";\n\n/**\n * Represents optional parameters for a function in a JSON Schema.\n */\nexport type FunctionParameters = Optional<\n JsonSchema7ObjectType,\n \"additionalProperties\"\n>;\n\n/**\n * Class for parsing the output of an LLM. Can be configured to return\n * only the arguments of the function call in the output.\n */\nexport class OutputFunctionsParser extends BaseLLMOutputParser<string> {\n static lc_name() {\n return \"OutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n argsOnly = true;\n\n constructor(config?: { argsOnly?: boolean }) {\n super();\n this.argsOnly = config?.argsOnly ?? this.argsOnly;\n }\n\n /**\n * Parses the output and returns a string representation of the function\n * call or its arguments.\n * @param generations The output of the LLM to parse.\n * @returns A string representation of the function call or its arguments.\n */\n async parseResult(\n generations: Generation[] | ChatGeneration[]\n ): Promise<string> {\n if (\"message\" in generations[0]) {\n const gen = generations[0] as ChatGeneration;\n const functionCall = gen.message.additional_kwargs.function_call;\n if (!functionCall) {\n throw new Error(\n `No function_call in message ${JSON.stringify(generations)}`\n );\n }\n if (!functionCall.arguments) {\n throw new Error(\n `No arguments in function_call ${JSON.stringify(generations)}`\n );\n }\n if (this.argsOnly) {\n return functionCall.arguments;\n }\n return JSON.stringify(functionCall);\n } else {\n throw new Error(\n `No message in generations ${JSON.stringify(generations)}`\n );\n }\n }\n}\n\n/**\n * Class for parsing the output of an LLM into a JSON object. Uses an\n * instance of `OutputFunctionsParser` to parse the output.\n */\nexport class JsonOutputFunctionsParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n Output extends Record<string, any> = Record<string, any>,\n> extends BaseCumulativeTransformOutputParser<Output> {\n static lc_name() {\n return \"JsonOutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n outputParser: OutputFunctionsParser;\n\n argsOnly = true;\n\n constructor(\n config?: { argsOnly?: boolean } & BaseCumulativeTransformOutputParserInput\n ) {\n super(config);\n this.argsOnly = config?.argsOnly ?? this.argsOnly;\n this.outputParser = new OutputFunctionsParser(config);\n }\n\n protected _diff(\n prev: unknown | undefined,\n next: unknown\n ): JSONPatchOperation[] | undefined {\n if (!next) {\n return undefined;\n }\n const ops = compare(prev ?? {}, next);\n return ops;\n }\n\n async parsePartialResult(\n generations: ChatGeneration[]\n ): Promise<Output | undefined> {\n const generation = generations[0];\n if (!generation.message) {\n return undefined;\n }\n const { message } = generation;\n const functionCall = message.additional_kwargs.function_call;\n if (!functionCall) {\n return undefined;\n }\n if (this.argsOnly) {\n return parsePartialJson(functionCall.arguments);\n }\n\n return {\n ...functionCall,\n arguments: parsePartialJson(functionCall.arguments),\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n } as Record<string, any> as Output;\n }\n\n /**\n * Parses the output and returns a JSON object. If `argsOnly` is true,\n * only the arguments of the function call are returned.\n * @param generations The output of the LLM to parse.\n * @returns A JSON object representation of the function call or its arguments.\n */\n async parseResult(\n generations: Generation[] | ChatGeneration[]\n ): Promise<Output> {\n const result = await this.outputParser.parseResult(generations);\n if (!result) {\n throw new Error(\n `No result from \"OutputFunctionsParser\" ${JSON.stringify(generations)}`\n );\n }\n return this.parse(result);\n }\n\n async parse(text: string): Promise<Output> {\n const parsedResult = JSON.parse(text);\n if (this.argsOnly) {\n return parsedResult;\n }\n parsedResult.arguments = JSON.parse(parsedResult.arguments);\n return parsedResult;\n }\n\n getFormatInstructions(): string {\n return \"\";\n }\n}\n\n/**\n * Class for parsing the output of an LLM into a JSON object and returning\n * a specific attribute. Uses an instance of `JsonOutputFunctionsParser`\n * to parse the output.\n */\nexport class JsonKeyOutputFunctionsParser<\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n T extends Record<string, any> = Record<string, any>,\n> extends BaseLLMOutputParser<T> {\n static lc_name() {\n return \"JsonKeyOutputFunctionsParser\";\n }\n\n lc_namespace = [\"langchain\", \"output_parsers\", \"openai_functions\"];\n\n lc_serializable = true;\n\n outputParser = new JsonOutputFunctionsParser();\n\n attrName: string;\n\n get lc_aliases() {\n return {\n attrName: \"key_name\",\n };\n }\n\n constructor(fields: { attrName: string }) {\n super(fields);\n this.attrName = fields.attrName;\n }\n\n /**\n * Parses the output and returns a specific attribute of the parsed JSON\n * object.\n * @param generations The output of the LLM to parse.\n * @returns The value of a specific attribute of the parsed JSON object.\n */\n async parseResult(generations: Generation[] | ChatGeneration[]): Promise<T> {\n const result = await this.outputParser.parseResult(generations);\n return result[this.attrName as keyof typeof result] as T;\n }\n}\n"],"mappings":";;;;;;;;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ACJ,aACiB;EACjB,MAAM,SAAS,MAAM,KAAK,aAAa,YAAY,YAAY;AAC/D,MAAI,CAAC,OACH,OAAM,IAAI,MACR,0CAA0C,KAAK,UAAU,YAAY,GACtE;AAEH,SAAO,KAAK,MAAM,OAAO;;CAG3B,MAAM,MAAM,MAA+B;EACzC,MAAM,eAAe,KAAK,MAAM,KAAK;AACrC,MAAI,KAAK,SACP,QAAO;AAET,eAAa,YAAY,KAAK,MAAM,aAAa,UAAU;AAC3D,SAAO;;CAGT,wBAAgC;AAC9B,SAAO;;;;;;;;AASX,IAAa,+BAAb,cAGU,oBAAuB;CAC/B,OAAO,UAAU;AACf,SAAO;;CAGT,eAAe;EAAC;EAAa;EAAkB;EAAmB;CAElE,kBAAkB;CAElB,eAAe,IAAI,2BAA2B;CAE9C;CAEA,IAAI,aAAa;AACf,SAAO,EACL,UAAU,YACX;;CAGH,YAAY,QAA8B;AACxC,QAAM,OAAO;AACb,OAAK,WAAW,OAAO;;;;;;;;CASzB,MAAM,YAAY,aAA0D;AAE1E,UADe,MAAM,KAAK,aAAa,YAAY,YAAY,EACjD,KAAK"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_json_output_tools_parsers = require('./json_output_tools_parsers.cjs');
|
|
3
4
|
|
|
4
5
|
//#region src/output_parsers/openai_tools/index.ts
|
|
5
|
-
var openai_tools_exports = {
|
|
6
|
-
require_rolldown_runtime.__export(openai_tools_exports, {
|
|
6
|
+
var openai_tools_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
7
7
|
JsonOutputKeyToolsParser: () => require_json_output_tools_parsers.JsonOutputKeyToolsParser,
|
|
8
8
|
JsonOutputToolsParser: () => require_json_output_tools_parsers.JsonOutputToolsParser,
|
|
9
9
|
convertLangChainToolCallToOpenAI: () => require_json_output_tools_parsers.convertLangChainToolCallToOpenAI,
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
2
|
import { JsonOutputKeyToolsParser, JsonOutputToolsParser, convertLangChainToolCallToOpenAI, makeInvalidToolCall, parseToolCall } from "./json_output_tools_parsers.js";
|
|
3
3
|
|
|
4
4
|
//#region src/output_parsers/openai_tools/index.ts
|
|
5
|
-
var openai_tools_exports = {
|
|
6
|
-
__export(openai_tools_exports, {
|
|
5
|
+
var openai_tools_exports = /* @__PURE__ */ __exportAll({
|
|
7
6
|
JsonOutputKeyToolsParser: () => JsonOutputKeyToolsParser,
|
|
8
7
|
JsonOutputToolsParser: () => JsonOutputToolsParser,
|
|
9
8
|
convertLangChainToolCallToOpenAI: () => convertLangChainToolCallToOpenAI,
|
|
@@ -7,12 +7,12 @@ require('../json.cjs');
|
|
|
7
7
|
|
|
8
8
|
//#region src/output_parsers/openai_tools/json_output_tools_parsers.ts
|
|
9
9
|
function parseToolCall(rawToolCall, options) {
|
|
10
|
-
if (rawToolCall.function === void 0) return
|
|
10
|
+
if (rawToolCall.function === void 0) return;
|
|
11
11
|
let functionArgs;
|
|
12
12
|
if (options?.partial) try {
|
|
13
13
|
functionArgs = require_json.parsePartialJson(rawToolCall.function.arguments ?? "{}");
|
|
14
14
|
} catch {
|
|
15
|
-
return
|
|
15
|
+
return;
|
|
16
16
|
}
|
|
17
17
|
else try {
|
|
18
18
|
functionArgs = JSON.parse(rawToolCall.function.arguments);
|
|
@@ -79,8 +79,7 @@ var JsonOutputToolsParser = class extends require_transform.BaseCumulativeTransf
|
|
|
79
79
|
throw new Error("Not implemented.");
|
|
80
80
|
}
|
|
81
81
|
async parseResult(generations) {
|
|
82
|
-
|
|
83
|
-
return result;
|
|
82
|
+
return await this.parsePartialResult(generations, false);
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Parses the output and returns a JSON object. If `argsOnly` is true,
|
|
@@ -92,22 +91,19 @@ var JsonOutputToolsParser = class extends require_transform.BaseCumulativeTransf
|
|
|
92
91
|
const message = generations[0].message;
|
|
93
92
|
let toolCalls;
|
|
94
93
|
if (require_ai.isAIMessage(message) && message.tool_calls?.length) toolCalls = message.tool_calls.map((toolCall) => {
|
|
95
|
-
const { id
|
|
94
|
+
const { id, ...rest } = toolCall;
|
|
96
95
|
if (!this.returnId) return rest;
|
|
97
96
|
return {
|
|
98
97
|
id,
|
|
99
98
|
...rest
|
|
100
99
|
};
|
|
101
100
|
});
|
|
102
|
-
else if (message.additional_kwargs.tool_calls !== void 0) {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
returnId: this.returnId,
|
|
107
|
-
partial
|
|
108
|
-
});
|
|
101
|
+
else if (message.additional_kwargs.tool_calls !== void 0) toolCalls = JSON.parse(JSON.stringify(message.additional_kwargs.tool_calls)).map((rawToolCall) => {
|
|
102
|
+
return parseToolCall(rawToolCall, {
|
|
103
|
+
returnId: this.returnId,
|
|
104
|
+
partial
|
|
109
105
|
});
|
|
110
|
-
}
|
|
106
|
+
});
|
|
111
107
|
if (!toolCalls) return [];
|
|
112
108
|
const parsedToolCalls = [];
|
|
113
109
|
for (const toolCall of toolCalls) if (toolCall !== void 0) {
|
|
@@ -154,23 +150,20 @@ var JsonOutputKeyToolsParser = class extends JsonOutputToolsParser {
|
|
|
154
150
|
else throw new require_base.OutputParserException(`Failed to parse. Text: "${JSON.stringify(result, null, 2)}". Error: ${JSON.stringify(zodParsedResult.error?.issues)}`, JSON.stringify(result, null, 2));
|
|
155
151
|
}
|
|
156
152
|
async parsePartialResult(generations) {
|
|
157
|
-
const
|
|
158
|
-
const matchingResults = results.filter((result) => result.type === this.keyName);
|
|
153
|
+
const matchingResults = (await super.parsePartialResult(generations)).filter((result) => result.type === this.keyName);
|
|
159
154
|
let returnedValues = matchingResults;
|
|
160
|
-
if (!matchingResults.length) return
|
|
155
|
+
if (!matchingResults.length) return;
|
|
161
156
|
if (!this.returnId) returnedValues = matchingResults.map((result) => result.args);
|
|
162
157
|
if (this.returnSingle) return returnedValues[0];
|
|
163
158
|
return returnedValues;
|
|
164
159
|
}
|
|
165
160
|
async parseResult(generations) {
|
|
166
|
-
const
|
|
167
|
-
const matchingResults = results.filter((result) => result.type === this.keyName);
|
|
161
|
+
const matchingResults = (await super.parsePartialResult(generations, false)).filter((result) => result.type === this.keyName);
|
|
168
162
|
let returnedValues = matchingResults;
|
|
169
|
-
if (!matchingResults.length) return
|
|
163
|
+
if (!matchingResults.length) return;
|
|
170
164
|
if (!this.returnId) returnedValues = matchingResults.map((result) => result.args);
|
|
171
165
|
if (this.returnSingle) return this._validateResult(returnedValues[0]);
|
|
172
|
-
|
|
173
|
-
return toolCallResults;
|
|
166
|
+
return await Promise.all(returnedValues.map((value) => this._validateResult(value)));
|
|
174
167
|
}
|
|
175
168
|
};
|
|
176
169
|
|