haystack-ai 2.30.2rc1__tar.gz → 2.31.0__tar.gz
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.
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/PKG-INFO +2 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/README.md +1 -1
- haystack_ai-2.31.0/VERSION.txt +1 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/audio/whisper_local.py +14 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/audio/whisper_remote.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/builders/answer_builder.py +59 -4
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/classifiers/document_language_classifier.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/classifiers/zero_shot_document_classifier.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/connectors/openapi.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/connectors/openapi_service.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/azure.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/file_to_file_content.py +5 -9
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/html.py +16 -3
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/document_to_image.py +9 -6
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/image_utils.py +12 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/markdown.py +60 -3
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/openapi_functions.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/tika.py +9 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/hugging_face_api_document_embedder.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/hugging_face_api_text_embedder.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/image/sentence_transformers_doc_image_embedder.py +11 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/sentence_transformers_document_embedder.py +11 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/sentence_transformers_sparse_document_embedder.py +11 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/sentence_transformers_sparse_text_embedder.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/sentence_transformers_text_embedder.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/context_relevance.py +43 -3
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/document_ndcg.py +70 -10
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/faithfulness.py +48 -4
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/llm_evaluator.py +81 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/named_entity_extractor.py +18 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/azure.py +9 -8
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/fallback.py +6 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/hugging_face_api.py +24 -10
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/hugging_face_local.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/openai_responses.py +51 -3
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/hugging_face_api.py +2 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/hugging_face_local.py +4 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/openai.py +6 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/utils.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/answer_joiner.py +3 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/document_joiner.py +16 -3
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/document_splitter.py +3 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/embedding_based_document_splitter.py +2 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/hierarchical_document_splitter.py +15 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/recursive_splitter.py +18 -10
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/query/query_expander.py +7 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/hugging_face_tei.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/meta_field_grouping_ranker.py +8 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/sentence_transformers_diversity.py +12 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/sentence_transformers_similarity.py +12 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/transformers_similarity.py +1 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/readers/extractive.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/in_memory/embedding_retriever.py +3 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/multi_query_embedding_retriever.py +3 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/multi_retriever.py +66 -19
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/text_embedding_retriever.py +3 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/conditional_router.py +119 -30
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/file_type_router.py +14 -11
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/text_language_router.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/transformers_text_router.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/zero_shot_text_router.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/samplers/top_p.py +5 -4
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/websearch/searchapi.py +10 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/websearch/serper_dev.py +10 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/component/types.py +11 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/base.py +1 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/super_component/super_component.py +4 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/type_utils.py +12 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/__init__.py +0 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/answer.py +1 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/in_memory/document_store.py +17 -5
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/strategies.py +32 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/telemetry/_telemetry.py +3 -2
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/pipeline_tool.py +3 -4
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/datadog.py +12 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/opentelemetry.py +12 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/auth.py +4 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/filters.py +30 -12
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/http_client.py +2 -10
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/jinja2_chat_extension.py +49 -25
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/type_serialization.py +5 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/pyproject.toml +2 -2
- haystack_ai-2.30.2rc1/VERSION.txt +0 -1
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/.gitignore +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/LICENSE +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/agents/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/agents/agent.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/agents/state/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/agents/state/state.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/agents/state/state_utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/audio/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/builders/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/builders/chat_prompt_builder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/builders/prompt_builder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/caching/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/caching/cache_checker.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/classifiers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/connectors/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/csv.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/docx.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/file_to_document.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/file_to_image.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/pdf_to_image.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/json.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/msg.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/multi_file_converter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/output_adapter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/pdfminer.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/pptx.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/pypdf.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/txt.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/xlsx.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/azure_document_embedder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/azure_text_embedder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/backends/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/backends/sentence_transformers_backend.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/backends/sentence_transformers_sparse_backend.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/image/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/openai_document_embedder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/openai_text_embedder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/types/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/embedders/types/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/answer_exact_match.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/document_map.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/document_mrr.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/document_recall.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/evaluators/sas_evaluator.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/image/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/image/llm_document_content_extractor.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/llm_metadata_extractor.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/extractors/regex_text_extractor.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/fetchers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/fetchers/link_content.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/azure.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/azure_responses.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/llm.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/openai.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/types/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/chat/types/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/generators/openai_dalle.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/branch.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/list_joiner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/joiners/string_joiner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/csv_document_cleaner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/csv_document_splitter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/document_cleaner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/document_preprocessor.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/markdown_header_splitter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/python_code_splitter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/sentence_tokenizer.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/preprocessors/text_cleaner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/query/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/llm_ranker.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/lost_in_the_middle.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/rankers/meta_field.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/readers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/auto_merging_retriever.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/filter_retriever.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/in_memory/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/in_memory/bm25_retriever.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/multi_query_text_retriever.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/sentence_window_retriever.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/types/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/retrievers/types/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/document_length_router.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/document_type_router.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/llm_messages_router.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/routers/metadata_router.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/samplers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/tools/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/tools/tool_invoker.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/validators/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/validators/json_schema.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/websearch/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/writers/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/writers/document_writer.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/component/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/component/component.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/component/sockets.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/errors.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/async_pipeline.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/breakpoint.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/component_checks.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/descriptions.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/draw.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/pipeline.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/pipeline/utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/serialization.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/super_component/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/core/super_component/utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/data/abbreviations/de.txt +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/data/abbreviations/en.txt +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/breakpoints.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/byte_stream.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/chat_message.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/document.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/file_content.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/image_content.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/sparse_embedding.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/dataclasses/streaming_chunk.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/errors/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/errors/errors.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/in_memory/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/types/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/types/filter_policy.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/types/policy.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/document_stores/types/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/errors.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/evaluation/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/evaluation/eval_run_result.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/dataclasses.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/policies.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/types/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/types/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/human_in_the_loop/user_interfaces.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/lazy_imports.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/logging.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/marshal/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/marshal/protocol.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/marshal/yaml.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/py.typed +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/telemetry/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/telemetry/_environment.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/callable_serialization/random_callable.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/document_store.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/document_store_async.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/factory.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/accumulate.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/add_value.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/concatenate.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/double.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/fstring.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/future_annotations.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/greet.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/hello.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/joiner.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/parity.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/remainder.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/repeat.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/subtract.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/sum.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/text_splitter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/sample_components/threshold.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/testing/test_utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/component_tool.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/errors.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/from_function.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/parameters_schema_utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/searchable_toolset.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/serde_utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/tool.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/toolset.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tools/utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/logging_tracer.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/tracer.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/tracing/utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/__init__.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/asynchronous.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/azure.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/base_serialization.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/callable_serialization.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/dataclasses.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/deserialization.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/device.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/experimental.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/hf.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/jinja2_extensions.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/jupyter.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/misc.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/requests_utils.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/utils/url_validation.py +0 -0
- {haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: haystack-ai
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.31.0
|
|
4
4
|
Summary: LLM framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data.
|
|
5
5
|
Project-URL: CI: GitHub, https://github.com/deepset-ai/haystack/actions
|
|
6
6
|
Project-URL: Docs: RTD, https://haystack.deepset.ai/overview/intro
|
|
@@ -53,7 +53,7 @@ Description-Content-Type: text/markdown
|
|
|
53
53
|
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
54
54
|
| CI/CD | [](https://github.com/deepset-ai/haystack/actions/workflows/tests.yml) [](https://github.com/python/mypy) [](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack/blob/python-coverage-comment-action-data/htmlcov/index.html) [](https://github.com/astral-sh/ruff) |
|
|
55
55
|
| Docs | [](https://docs.haystack.deepset.ai) |
|
|
56
|
-
| Package | [](https://pypi.org/project/haystack-ai/)   [](https://anaconda.org/conda-forge/haystack-ai) [](LICENSE) [](https://github.com/deepset-ai/haystack/actions/workflows/license_compliance.yml) [](https://www.bestpractices.dev/projects/13067)|
|
|
56
|
+
| Package | [](https://pypi.org/project/haystack-ai/)   [](https://anaconda.org/conda-forge/haystack-ai) [](LICENSE) [](https://github.com/deepset-ai/haystack/actions/workflows/license_compliance.yml) [](https://hvtracker.net/agents/haystack/) [](https://hvtracker.net/agents/haystack/) [](https://www.bestpractices.dev/projects/13067)|
|
|
57
57
|
| Meta | [](https://discord.com/invite/qZxjM4bAHU) [](https://twitter.com/haystack_ai) |
|
|
58
58
|
</div>
|
|
59
59
|
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
6
6
|
| CI/CD | [](https://github.com/deepset-ai/haystack/actions/workflows/tests.yml) [](https://github.com/python/mypy) [](https://htmlpreview.github.io/?https://github.com/deepset-ai/haystack/blob/python-coverage-comment-action-data/htmlcov/index.html) [](https://github.com/astral-sh/ruff) |
|
|
7
7
|
| Docs | [](https://docs.haystack.deepset.ai) |
|
|
8
|
-
| Package | [](https://pypi.org/project/haystack-ai/)   [](https://anaconda.org/conda-forge/haystack-ai) [](LICENSE) [](https://github.com/deepset-ai/haystack/actions/workflows/license_compliance.yml) [](https://www.bestpractices.dev/projects/13067)|
|
|
8
|
+
| Package | [](https://pypi.org/project/haystack-ai/)   [](https://anaconda.org/conda-forge/haystack-ai) [](LICENSE) [](https://github.com/deepset-ai/haystack/actions/workflows/license_compliance.yml) [](https://hvtracker.net/agents/haystack/) [](https://hvtracker.net/agents/haystack/) [](https://www.bestpractices.dev/projects/13067)|
|
|
9
9
|
| Meta | [](https://discord.com/invite/qZxjM4bAHU) [](https://twitter.com/haystack_ai) |
|
|
10
10
|
</div>
|
|
11
11
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2.31.0
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
5
|
import tempfile
|
|
6
|
+
import warnings
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import Any, Literal, get_args
|
|
8
9
|
|
|
@@ -40,12 +41,16 @@ class LocalWhisperTranscriber:
|
|
|
40
41
|
[GitHub repository](https://github.com/openai/whisper).
|
|
41
42
|
|
|
42
43
|
### Usage example
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
```python
|
|
45
46
|
from haystack.components.audio import LocalWhisperTranscriber
|
|
46
47
|
|
|
47
48
|
whisper = LocalWhisperTranscriber(model="small")
|
|
48
49
|
transcription = whisper.run(sources=["test/test_files/audio/answer.wav"])
|
|
50
|
+
print(transcription)
|
|
51
|
+
|
|
52
|
+
# >> {'documents': [Document(id=dae7051417caaf19304a4ef2ec845e981abe1efd4c8e6ee7ffb25867f165c411,
|
|
53
|
+
# >> content: ' Answer.', meta: {'audio_file': PosixPath('test/test_files/audio/answer.wav'), 'language': 'en'})]}
|
|
49
54
|
```
|
|
50
55
|
"""
|
|
51
56
|
|
|
@@ -66,6 +71,14 @@ class LocalWhisperTranscriber:
|
|
|
66
71
|
:param device:
|
|
67
72
|
The device for loading the model. If `None`, automatically selects the default device.
|
|
68
73
|
"""
|
|
74
|
+
warnings.warn(
|
|
75
|
+
"`LocalWhisperTranscriber` will be removed from Haystack in version 3.0, as it is moving to "
|
|
76
|
+
"the `whisper-haystack` package. To continue using it, install that package with "
|
|
77
|
+
"`pip install whisper-haystack` and update your import to "
|
|
78
|
+
"`from haystack_integrations.components.audio.whisper import LocalWhisperTranscriber`.",
|
|
79
|
+
FutureWarning,
|
|
80
|
+
stacklevel=2,
|
|
81
|
+
)
|
|
69
82
|
whisper_import.check()
|
|
70
83
|
if model not in get_args(WhisperLocalModel):
|
|
71
84
|
raise ValueError(
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
5
|
import io
|
|
6
|
+
import warnings
|
|
6
7
|
from pathlib import Path
|
|
7
8
|
from typing import Any
|
|
8
9
|
|
|
@@ -82,6 +83,14 @@ class RemoteWhisperTranscriber:
|
|
|
82
83
|
uses log probability to automatically increase the
|
|
83
84
|
temperature until certain thresholds are hit.
|
|
84
85
|
"""
|
|
86
|
+
warnings.warn(
|
|
87
|
+
"`RemoteWhisperTranscriber` will be removed from Haystack in version 3.0, as it is moving to "
|
|
88
|
+
"the `whisper-haystack` package. To continue using it, install that package with "
|
|
89
|
+
"`pip install whisper-haystack` and update your import to "
|
|
90
|
+
"`from haystack_integrations.components.audio.whisper import RemoteWhisperTranscriber`.",
|
|
91
|
+
FutureWarning,
|
|
92
|
+
stacklevel=2,
|
|
93
|
+
)
|
|
85
94
|
|
|
86
95
|
self.organization = organization
|
|
87
96
|
self.model = model
|
|
@@ -11,6 +11,9 @@ from haystack.dataclasses.chat_message import ChatMessage
|
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
14
|
+
DEFAULT_REFERENCE_PATTERN = r"\[(\d+)\]"
|
|
15
|
+
EXPANDED_REFERENCE_PATTERN = r"\[(\d+(?:[,-]\d+)*)\]"
|
|
16
|
+
|
|
14
17
|
|
|
15
18
|
@component
|
|
16
19
|
class AnswerBuilder:
|
|
@@ -74,6 +77,7 @@ class AnswerBuilder:
|
|
|
74
77
|
last_message_only: bool = False,
|
|
75
78
|
*,
|
|
76
79
|
return_only_referenced_documents: bool = True,
|
|
80
|
+
expand_reference_ranges: bool = False,
|
|
77
81
|
) -> None:
|
|
78
82
|
"""
|
|
79
83
|
Creates an instance of the AnswerBuilder component.
|
|
@@ -104,6 +108,10 @@ class AnswerBuilder:
|
|
|
104
108
|
If True (default value), only the documents that were actually referenced in `replies` are returned.
|
|
105
109
|
If False, all documents are returned.
|
|
106
110
|
If `reference_pattern` is not provided, this parameter has no effect, and all documents are returned.
|
|
111
|
+
:param expand_reference_ranges:
|
|
112
|
+
If True, reference ranges like `[6-10]` are expanded to documents 6 through 10.
|
|
113
|
+
Defaults to False for backwards compatibility.
|
|
114
|
+
When enabled with the default `reference_pattern`, a broader pattern is used automatically.
|
|
107
115
|
"""
|
|
108
116
|
if pattern:
|
|
109
117
|
AnswerBuilder._check_num_groups_in_regex(pattern)
|
|
@@ -112,6 +120,7 @@ class AnswerBuilder:
|
|
|
112
120
|
self.reference_pattern = reference_pattern
|
|
113
121
|
self.last_message_only = last_message_only
|
|
114
122
|
self.return_only_referenced_documents = return_only_referenced_documents
|
|
123
|
+
self.expand_reference_ranges = expand_reference_ranges
|
|
115
124
|
|
|
116
125
|
@component.output_types(answers=list[GeneratedAnswer])
|
|
117
126
|
def run(
|
|
@@ -122,6 +131,7 @@ class AnswerBuilder:
|
|
|
122
131
|
documents: list[Document] | None = None,
|
|
123
132
|
pattern: str | None = None,
|
|
124
133
|
reference_pattern: str | None = None,
|
|
134
|
+
expand_reference_ranges: bool | None = None,
|
|
125
135
|
) -> dict[str, Any]:
|
|
126
136
|
"""
|
|
127
137
|
Turns the output of a Generator into `GeneratedAnswer` objects using regular expressions.
|
|
@@ -158,6 +168,9 @@ class AnswerBuilder:
|
|
|
158
168
|
If not specified, no parsing is done, and all documents are returned.
|
|
159
169
|
References need to be specified as indices of the input documents and start at [1].
|
|
160
170
|
Example: `\\[(\\d+)\\]` finds "1" in a string "this is an answer[1]".
|
|
171
|
+
:param expand_reference_ranges:
|
|
172
|
+
If True, reference ranges like `[6-10]` are expanded to documents 6 through 10.
|
|
173
|
+
If not specified, the value from the component initialization is used.
|
|
161
174
|
|
|
162
175
|
:returns: A dictionary with the following keys:
|
|
163
176
|
- `answers`: The answers received from the output of the Generator.
|
|
@@ -172,6 +185,12 @@ class AnswerBuilder:
|
|
|
172
185
|
|
|
173
186
|
pattern = pattern or self.pattern
|
|
174
187
|
reference_pattern = reference_pattern or self.reference_pattern
|
|
188
|
+
expand_reference_ranges = (
|
|
189
|
+
self.expand_reference_ranges if expand_reference_ranges is None else expand_reference_ranges
|
|
190
|
+
)
|
|
191
|
+
reference_pattern = AnswerBuilder._resolve_reference_pattern(
|
|
192
|
+
reference_pattern=reference_pattern, expand_reference_ranges=expand_reference_ranges
|
|
193
|
+
)
|
|
175
194
|
|
|
176
195
|
replies_to_iterate = replies[-1:] if self.last_message_only and replies else replies
|
|
177
196
|
meta_to_iterate = meta[-1:] if self.last_message_only and meta else meta
|
|
@@ -188,7 +207,12 @@ class AnswerBuilder:
|
|
|
188
207
|
referenced_docs = []
|
|
189
208
|
if documents:
|
|
190
209
|
referenced_idxs = (
|
|
191
|
-
AnswerBuilder._extract_reference_idxs(
|
|
210
|
+
AnswerBuilder._extract_reference_idxs(
|
|
211
|
+
extracted_reply,
|
|
212
|
+
reference_pattern,
|
|
213
|
+
expand_ranges=expand_reference_ranges,
|
|
214
|
+
num_documents=len(documents),
|
|
215
|
+
)
|
|
192
216
|
if reference_pattern
|
|
193
217
|
else set()
|
|
194
218
|
)
|
|
@@ -245,9 +269,40 @@ class AnswerBuilder:
|
|
|
245
269
|
return ""
|
|
246
270
|
|
|
247
271
|
@staticmethod
|
|
248
|
-
def
|
|
249
|
-
|
|
250
|
-
|
|
272
|
+
def _resolve_reference_pattern(reference_pattern: str | None, expand_reference_ranges: bool) -> str | None:
|
|
273
|
+
if not reference_pattern or not expand_reference_ranges:
|
|
274
|
+
return reference_pattern
|
|
275
|
+
if reference_pattern == DEFAULT_REFERENCE_PATTERN:
|
|
276
|
+
return EXPANDED_REFERENCE_PATTERN
|
|
277
|
+
return reference_pattern
|
|
278
|
+
|
|
279
|
+
@staticmethod
|
|
280
|
+
def _extract_reference_idxs(
|
|
281
|
+
reply: str, reference_pattern: str, expand_ranges: bool = False, num_documents: int | None = None
|
|
282
|
+
) -> set[int]:
|
|
283
|
+
matches = re.findall(reference_pattern, reply)
|
|
284
|
+
idxs: set[int] = set()
|
|
285
|
+
for match in matches:
|
|
286
|
+
if expand_ranges:
|
|
287
|
+
for part in match.split(","):
|
|
288
|
+
part = part.strip()
|
|
289
|
+
if not part:
|
|
290
|
+
continue
|
|
291
|
+
if "-" in part:
|
|
292
|
+
start_str, end_str = part.split("-", 1)
|
|
293
|
+
start, end = int(start_str), int(end_str)
|
|
294
|
+
if start > end:
|
|
295
|
+
continue
|
|
296
|
+
# Clamp the range end to the number of documents to avoid materializing a huge
|
|
297
|
+
# set from an out-of-range citation like `[1-999999999]` in the Generator output.
|
|
298
|
+
if num_documents is not None:
|
|
299
|
+
end = min(end, num_documents)
|
|
300
|
+
idxs.update(range(start - 1, end))
|
|
301
|
+
else:
|
|
302
|
+
idxs.add(int(part) - 1)
|
|
303
|
+
else:
|
|
304
|
+
idxs.add(int(match) - 1)
|
|
305
|
+
return idxs
|
|
251
306
|
|
|
252
307
|
@staticmethod
|
|
253
308
|
def _check_num_groups_in_regex(pattern: str) -> None:
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
+
import warnings
|
|
5
6
|
from dataclasses import replace
|
|
6
7
|
|
|
7
8
|
from haystack import Document, component, logging
|
|
@@ -68,6 +69,14 @@ class DocumentLanguageClassifier:
|
|
|
68
69
|
See the supported languages in [`langdetect` documentation](https://github.com/Mimino666/langdetect#languages).
|
|
69
70
|
If not specified, defaults to ["en"].
|
|
70
71
|
"""
|
|
72
|
+
warnings.warn(
|
|
73
|
+
"`DocumentLanguageClassifier` will be removed from Haystack in version 3.0, as it is moving to "
|
|
74
|
+
"the `langdetect-haystack` package. To continue using it, install that package with "
|
|
75
|
+
"`pip install langdetect-haystack` and update your import to "
|
|
76
|
+
"`from haystack_integrations.components.classifiers.langdetect import DocumentLanguageClassifier`.",
|
|
77
|
+
FutureWarning,
|
|
78
|
+
stacklevel=2,
|
|
79
|
+
)
|
|
71
80
|
langdetect_import.check()
|
|
72
81
|
if not languages:
|
|
73
82
|
languages = ["en"]
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
+
import warnings
|
|
5
6
|
from dataclasses import replace
|
|
6
7
|
from typing import Any
|
|
7
8
|
|
|
@@ -112,6 +113,15 @@ class TransformersZeroShotDocumentClassifier:
|
|
|
112
113
|
Dictionary containing keyword arguments used to initialize the
|
|
113
114
|
Hugging Face pipeline for text classification.
|
|
114
115
|
"""
|
|
116
|
+
warnings.warn(
|
|
117
|
+
"`TransformersZeroShotDocumentClassifier` will be removed from Haystack in version 3.0, as it is moving "
|
|
118
|
+
"to the `transformers-haystack` package. To continue using it, install that package with "
|
|
119
|
+
"`pip install transformers-haystack` and update your import to "
|
|
120
|
+
"`from haystack_integrations.components.classifiers.transformers import "
|
|
121
|
+
"TransformersZeroShotDocumentClassifier`.",
|
|
122
|
+
FutureWarning,
|
|
123
|
+
stacklevel=2,
|
|
124
|
+
)
|
|
115
125
|
|
|
116
126
|
torch_and_transformers_import.check()
|
|
117
127
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
+
import warnings
|
|
5
6
|
from typing import Any
|
|
6
7
|
|
|
7
8
|
from haystack import component, default_from_dict, default_to_dict
|
|
@@ -61,6 +62,14 @@ class OpenAPIConnector:
|
|
|
61
62
|
:param service_kwargs: Additional keyword arguments passed to OpenAPIClient.from_spec()
|
|
62
63
|
For example, you can pass a custom config_factory or other configuration options.
|
|
63
64
|
"""
|
|
65
|
+
warnings.warn(
|
|
66
|
+
"`OpenAPIConnector` will be removed from Haystack in version 3.0, as it is moving to "
|
|
67
|
+
"the `openapi-haystack` package. To continue using it, install that package with "
|
|
68
|
+
"`pip install openapi-haystack` and update your import to "
|
|
69
|
+
"`from haystack_integrations.components.connectors.openapi import OpenAPIConnector`.",
|
|
70
|
+
FutureWarning,
|
|
71
|
+
stacklevel=2,
|
|
72
|
+
)
|
|
64
73
|
openapi_llm_imports.check()
|
|
65
74
|
self.openapi_spec = openapi_spec
|
|
66
75
|
self.credentials = credentials
|
{haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/connectors/openapi_service.py
RENAMED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
|
+
import warnings
|
|
6
7
|
from collections import defaultdict
|
|
7
8
|
from copy import copy
|
|
8
9
|
from typing import Any
|
|
@@ -211,6 +212,14 @@ class OpenAPIServiceConnector:
|
|
|
211
212
|
:param ssl_verify: Decide if to use SSL verification to the requests or not,
|
|
212
213
|
in case a string is passed, will be used as the CA.
|
|
213
214
|
"""
|
|
215
|
+
warnings.warn(
|
|
216
|
+
"`OpenAPIServiceConnector` will be removed from Haystack in version 3.0, as it is moving to "
|
|
217
|
+
"the `openapi-haystack` package. To continue using it, install that package with "
|
|
218
|
+
"`pip install openapi-haystack` and update your import to "
|
|
219
|
+
"`from haystack_integrations.components.connectors.openapi import OpenAPIServiceConnector`.",
|
|
220
|
+
FutureWarning,
|
|
221
|
+
stacklevel=2,
|
|
222
|
+
)
|
|
214
223
|
openapi_imports.check()
|
|
215
224
|
self.ssl_verify = ssl_verify
|
|
216
225
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import copy
|
|
6
6
|
import os
|
|
7
|
+
import warnings
|
|
7
8
|
from collections import defaultdict
|
|
8
9
|
from pathlib import Path
|
|
9
10
|
from typing import Any, Literal, Union
|
|
@@ -98,6 +99,15 @@ class AzureOCRDocumentConverter:
|
|
|
98
99
|
If True, the full path of the file is stored in the metadata of the document.
|
|
99
100
|
If False, only the file name is stored.
|
|
100
101
|
"""
|
|
102
|
+
warnings.warn(
|
|
103
|
+
"`AzureOCRDocumentConverter` will be removed from Haystack in version 3.0, as it is moving to "
|
|
104
|
+
"the `azure-form-recognizer-haystack` package. To continue using it, install that package with "
|
|
105
|
+
"`pip install azure-form-recognizer-haystack` and update your import to "
|
|
106
|
+
"`from haystack_integrations.components.converters.azure_form_recognizer import "
|
|
107
|
+
"AzureOCRDocumentConverter`.",
|
|
108
|
+
FutureWarning,
|
|
109
|
+
stacklevel=2,
|
|
110
|
+
)
|
|
101
111
|
azure_import.check()
|
|
102
112
|
pandas_import.check()
|
|
103
113
|
|
{haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/file_to_file_content.py
RENAMED
|
@@ -27,17 +27,13 @@ class FileToFileContent:
|
|
|
27
27
|
from haystack.components.converters import FileToFileContent
|
|
28
28
|
|
|
29
29
|
converter = FileToFileContent()
|
|
30
|
-
|
|
31
|
-
sources = ["document.pdf", "video.mp4"]
|
|
32
|
-
|
|
30
|
+
sources = ["test/test_files/pdf/react_paper.pdf", "test/test_files/images/haystack-logo.png"]
|
|
33
31
|
file_contents = converter.run(sources=sources)["file_contents"]
|
|
34
|
-
print(file_contents)
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
# ...]
|
|
33
|
+
print(file_contents)
|
|
34
|
+
# >> [FileContent(base64_data='...', mime_type='application/pdf', filename='react_paper.pdf', extra={}),
|
|
35
|
+
# >> FileContent(base64_data='...', mime_type='image/png', filename='haystack-logo.png', extra={})
|
|
36
|
+
# >>]
|
|
41
37
|
```
|
|
42
38
|
"""
|
|
43
39
|
|
|
@@ -35,7 +35,9 @@ class HTMLToDocument:
|
|
|
35
35
|
```
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
-
def __init__(
|
|
38
|
+
def __init__(
|
|
39
|
+
self, extraction_kwargs: dict[str, Any] | None = None, store_full_path: bool = False, encoding: str = "utf-8"
|
|
40
|
+
) -> None:
|
|
39
41
|
"""
|
|
40
42
|
Create an HTMLToDocument component.
|
|
41
43
|
|
|
@@ -45,11 +47,15 @@ class HTMLToDocument:
|
|
|
45
47
|
:param store_full_path:
|
|
46
48
|
If True, the full path of the file is stored in the metadata of the document.
|
|
47
49
|
If False, only the file name is stored.
|
|
50
|
+
:param encoding:
|
|
51
|
+
The default encoding to use when converting HTML files. If the encoding is specified in the metadata of a
|
|
52
|
+
source ByteStream, it overrides this value.
|
|
48
53
|
"""
|
|
49
54
|
trafilatura_import.check()
|
|
50
55
|
|
|
51
56
|
self.extraction_kwargs = extraction_kwargs or {}
|
|
52
57
|
self.store_full_path = store_full_path
|
|
58
|
+
self.encoding = encoding
|
|
53
59
|
|
|
54
60
|
def to_dict(self) -> dict[str, Any]:
|
|
55
61
|
"""
|
|
@@ -58,7 +64,9 @@ class HTMLToDocument:
|
|
|
58
64
|
:returns:
|
|
59
65
|
Dictionary with serialized data.
|
|
60
66
|
"""
|
|
61
|
-
return default_to_dict(
|
|
67
|
+
return default_to_dict(
|
|
68
|
+
self, extraction_kwargs=self.extraction_kwargs, store_full_path=self.store_full_path, encoding=self.encoding
|
|
69
|
+
)
|
|
62
70
|
|
|
63
71
|
@classmethod
|
|
64
72
|
def from_dict(cls, data: dict[str, Any]) -> "HTMLToDocument":
|
|
@@ -111,8 +119,13 @@ class HTMLToDocument:
|
|
|
111
119
|
logger.warning("Could not read {source}. Skipping it. Error: {error}", source=source, error=e)
|
|
112
120
|
continue
|
|
113
121
|
|
|
122
|
+
if not bytestream.data:
|
|
123
|
+
logger.warning("Skipping {source} because it is empty.", source=source)
|
|
124
|
+
continue
|
|
125
|
+
|
|
114
126
|
try:
|
|
115
|
-
|
|
127
|
+
encoding = bytestream.meta.get("encoding", self.encoding)
|
|
128
|
+
text = extract(bytestream.data.decode(encoding), **merged_extraction_kwargs)
|
|
116
129
|
except Exception as conversion_e:
|
|
117
130
|
logger.warning(
|
|
118
131
|
"Failed to extract text from {source}. Skipping it. Error: {error}",
|
|
@@ -34,31 +34,34 @@ class DocumentToImageContent:
|
|
|
34
34
|
- For PDF files, a `page_number` key specifying which page to extract
|
|
35
35
|
|
|
36
36
|
### Usage example
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
```python
|
|
39
39
|
from haystack import Document
|
|
40
40
|
from haystack.components.converters.image.document_to_image import DocumentToImageContent
|
|
41
41
|
|
|
42
42
|
converter = DocumentToImageContent(
|
|
43
43
|
file_path_meta_field="file_path",
|
|
44
|
-
root_path="/
|
|
44
|
+
root_path="test/test_files",
|
|
45
45
|
detail="high",
|
|
46
46
|
size=(800, 600)
|
|
47
47
|
)
|
|
48
48
|
|
|
49
49
|
documents = [
|
|
50
|
-
Document(content="Optional description of
|
|
51
|
-
Document(
|
|
50
|
+
Document(content="Optional description of apple.jpg", meta={"file_path": "images/apple.jpg"}),
|
|
51
|
+
Document(
|
|
52
|
+
content="Optional description of sample_pdf_1.pdf",
|
|
53
|
+
meta={"file_path": "pdf/sample_pdf_1.pdf", "page_number": 1}
|
|
54
|
+
)
|
|
52
55
|
]
|
|
53
56
|
|
|
54
57
|
result = converter.run(documents)
|
|
55
58
|
image_contents = result["image_contents"]
|
|
56
59
|
# [ImageContent(
|
|
57
|
-
# base64_image='/9j/4A...', mime_type='image/jpeg', detail='high', meta={'file_path': '
|
|
60
|
+
# base64_image='/9j/4A...', mime_type='image/jpeg', detail='high', meta={'file_path': 'images/apple.jpg'}
|
|
58
61
|
# ),
|
|
59
62
|
# ImageContent(
|
|
60
63
|
# base64_image='/9j/4A...', mime_type='image/jpeg', detail='high',
|
|
61
|
-
# meta={'
|
|
64
|
+
# meta={'file_path': 'pdf/sample_pdf_1.pdf', 'page_number': 1})
|
|
62
65
|
# )]
|
|
63
66
|
```
|
|
64
67
|
"""
|
{haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/image/image_utils.py
RENAMED
|
@@ -248,6 +248,18 @@ def _extract_image_sources_info(
|
|
|
248
248
|
)
|
|
249
249
|
|
|
250
250
|
resolved_file_path = Path(root_path, file_path)
|
|
251
|
+
|
|
252
|
+
# When root_path is set, ensure the resolved path stays within it to block path-traversal
|
|
253
|
+
# payloads (e.g. "../../etc/passwd") coming from document metadata.
|
|
254
|
+
if root_path:
|
|
255
|
+
resolved_file_path = resolved_file_path.resolve()
|
|
256
|
+
resolved_root = Path(root_path).resolve()
|
|
257
|
+
if not resolved_file_path.is_relative_to(resolved_root):
|
|
258
|
+
raise ValueError(
|
|
259
|
+
f"Document with ID '{doc.id}' has a file path '{file_path}' that escapes the "
|
|
260
|
+
f"configured root '{root_path}'. Resolved path: '{resolved_file_path}'."
|
|
261
|
+
)
|
|
262
|
+
|
|
251
263
|
if not resolved_file_path.is_file():
|
|
252
264
|
raise ValueError(
|
|
253
265
|
f"Document with ID '{doc.id}' has an invalid file path '{resolved_file_path}'. "
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
#
|
|
3
3
|
# SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
|
+
import json
|
|
5
6
|
import os
|
|
7
|
+
import re
|
|
6
8
|
from pathlib import Path
|
|
7
9
|
from typing import Any
|
|
8
10
|
|
|
11
|
+
import yaml
|
|
9
12
|
from tqdm import tqdm
|
|
10
13
|
|
|
11
14
|
from haystack import Document, component, logging
|
|
@@ -20,6 +23,8 @@ with LazyImport("Run 'pip install markdown-it-py mdit_plain'") as markdown_conve
|
|
|
20
23
|
|
|
21
24
|
logger = logging.getLogger(__name__)
|
|
22
25
|
|
|
26
|
+
_FRONTMATTER_PATTERN = re.compile(r"\A---[ \t]*\r?\n(?P<frontmatter>.*?)(?:\r?\n)---[ \t]*(?:\r?\n|$)", re.DOTALL)
|
|
27
|
+
|
|
23
28
|
|
|
24
29
|
@component
|
|
25
30
|
class MarkdownToDocument:
|
|
@@ -43,7 +48,13 @@ class MarkdownToDocument:
|
|
|
43
48
|
"""
|
|
44
49
|
|
|
45
50
|
def __init__(
|
|
46
|
-
self,
|
|
51
|
+
self,
|
|
52
|
+
table_to_single_line: bool = False,
|
|
53
|
+
progress_bar: bool = True,
|
|
54
|
+
store_full_path: bool = False,
|
|
55
|
+
encoding: str = "utf-8",
|
|
56
|
+
*,
|
|
57
|
+
extract_frontmatter: bool = False,
|
|
47
58
|
) -> None:
|
|
48
59
|
"""
|
|
49
60
|
Create a MarkdownToDocument component.
|
|
@@ -55,12 +66,20 @@ class MarkdownToDocument:
|
|
|
55
66
|
:param store_full_path:
|
|
56
67
|
If True, the full path of the file is stored in the metadata of the document.
|
|
57
68
|
If False, only the file name is stored.
|
|
69
|
+
:param encoding:
|
|
70
|
+
The default encoding to use when converting Markdown files. If the encoding is specified in the metadata
|
|
71
|
+
of a source ByteStream, it overrides this value.
|
|
72
|
+
:param extract_frontmatter:
|
|
73
|
+
If True, YAML frontmatter at the beginning of the Markdown file is
|
|
74
|
+
removed from the document content and added to the document metadata.
|
|
58
75
|
"""
|
|
59
76
|
markdown_conversion_imports.check()
|
|
60
77
|
|
|
61
78
|
self.table_to_single_line = table_to_single_line
|
|
62
79
|
self.progress_bar = progress_bar
|
|
63
80
|
self.store_full_path = store_full_path
|
|
81
|
+
self.encoding = encoding
|
|
82
|
+
self.extract_frontmatter = extract_frontmatter
|
|
64
83
|
|
|
65
84
|
@component.output_types(documents=list[Document])
|
|
66
85
|
def run(
|
|
@@ -102,7 +121,9 @@ class MarkdownToDocument:
|
|
|
102
121
|
logger.warning("Could not read {source}. Skipping it. Error: {error}", source=source, error=e)
|
|
103
122
|
continue
|
|
104
123
|
try:
|
|
105
|
-
|
|
124
|
+
encoding = bytestream.meta.get("encoding", self.encoding)
|
|
125
|
+
file_content = bytestream.data.decode(encoding)
|
|
126
|
+
file_content, frontmatter = self._extract_frontmatter(file_content, source)
|
|
106
127
|
text = parser.render(file_content)
|
|
107
128
|
except Exception as conversion_e:
|
|
108
129
|
logger.warning(
|
|
@@ -112,7 +133,7 @@ class MarkdownToDocument:
|
|
|
112
133
|
)
|
|
113
134
|
continue
|
|
114
135
|
|
|
115
|
-
merged_metadata = {**bytestream.meta, **metadata}
|
|
136
|
+
merged_metadata = {**bytestream.meta, **frontmatter, **metadata}
|
|
116
137
|
|
|
117
138
|
if not self.store_full_path and (file_path := bytestream.meta.get("file_path")):
|
|
118
139
|
merged_metadata["file_path"] = os.path.basename(file_path)
|
|
@@ -121,3 +142,39 @@ class MarkdownToDocument:
|
|
|
121
142
|
documents.append(document)
|
|
122
143
|
|
|
123
144
|
return {"documents": documents}
|
|
145
|
+
|
|
146
|
+
def _extract_frontmatter(self, file_content: str, source: str | Path | ByteStream) -> tuple[str, dict[str, Any]]:
|
|
147
|
+
if not self.extract_frontmatter:
|
|
148
|
+
return file_content, {}
|
|
149
|
+
|
|
150
|
+
match = _FRONTMATTER_PATTERN.match(file_content)
|
|
151
|
+
if not match:
|
|
152
|
+
return file_content, {}
|
|
153
|
+
|
|
154
|
+
frontmatter_text = match.group("frontmatter")
|
|
155
|
+
try:
|
|
156
|
+
frontmatter = json.loads(json.dumps(yaml.safe_load(frontmatter_text), default=str)) or {}
|
|
157
|
+
except yaml.YAMLError as error:
|
|
158
|
+
logger.warning(
|
|
159
|
+
"Could not parse YAML frontmatter in {source}. Keeping it as content. Error: {error}",
|
|
160
|
+
source=source,
|
|
161
|
+
error=error,
|
|
162
|
+
)
|
|
163
|
+
return file_content, {}
|
|
164
|
+
except (TypeError, ValueError) as error:
|
|
165
|
+
logger.warning(
|
|
166
|
+
"Could not convert YAML frontmatter in {source}. Keeping it as content. Error: {error}",
|
|
167
|
+
source=source,
|
|
168
|
+
error=error,
|
|
169
|
+
)
|
|
170
|
+
return file_content, {}
|
|
171
|
+
|
|
172
|
+
if not isinstance(frontmatter, dict):
|
|
173
|
+
logger.warning(
|
|
174
|
+
"Ignoring YAML frontmatter in {source}: expected a mapping, got {kind}.",
|
|
175
|
+
source=source,
|
|
176
|
+
kind=type(frontmatter).__name__,
|
|
177
|
+
)
|
|
178
|
+
return file_content, {}
|
|
179
|
+
|
|
180
|
+
return file_content[match.end() :], frontmatter
|
{haystack_ai-2.30.2rc1 → haystack_ai-2.31.0}/haystack/components/converters/openapi_functions.py
RENAMED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import os
|
|
7
|
+
import warnings
|
|
7
8
|
from pathlib import Path
|
|
8
9
|
from typing import Any
|
|
9
10
|
|
|
@@ -54,6 +55,14 @@ class OpenAPIServiceToFunctions:
|
|
|
54
55
|
"""
|
|
55
56
|
Create an OpenAPIServiceToFunctions component.
|
|
56
57
|
"""
|
|
58
|
+
warnings.warn(
|
|
59
|
+
"`OpenAPIServiceToFunctions` will be removed from Haystack in version 3.0, as it is moving to "
|
|
60
|
+
"the `openapi-haystack` package. To continue using it, install that package with "
|
|
61
|
+
"`pip install openapi-haystack` and update your import to "
|
|
62
|
+
"`from haystack_integrations.components.converters.openapi import OpenAPIServiceToFunctions`.",
|
|
63
|
+
FutureWarning,
|
|
64
|
+
stacklevel=2,
|
|
65
|
+
)
|
|
57
66
|
openapi_imports.check()
|
|
58
67
|
|
|
59
68
|
@component.output_types(functions=list[dict[str, Any]], openapi_specs=list[dict[str, Any]])
|