├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── breaking-change-proposal.md │ ├── bug_report.md │ ├── feature-request-for-existing-integrations.md │ └── new-integration-proposal.md ├── actions │ └── send_failure │ │ └── action.yml ├── dependabot.yml ├── labeler.yml ├── pull_request_template.md ├── utils │ ├── docstrings_checksum.py │ └── pyproject_to_requirements.py └── workflows │ ├── CI_check_integration_format.yml │ ├── CI_docstring_labeler.yml │ ├── CI_labeler.yml │ ├── CI_license_compliance.yml │ ├── CI_project.yml │ ├── CI_pypi_release.yml │ ├── CI_readme_sync.yml │ ├── CI_stale.yml │ ├── amazon_bedrock.yml │ ├── amazon_sagemaker.yml │ ├── anthropic.yml │ ├── astra.yml │ ├── azure_ai_search.yml │ ├── chroma.yml │ ├── cohere.yml │ ├── deepeval.yml │ ├── elasticsearch.yml │ ├── fastembed.yml │ ├── github.yml │ ├── google_ai.yml │ ├── google_genai.yml │ ├── google_vertex.yml │ ├── instructor_embedders.yml │ ├── jina.yml │ ├── langfuse.yml │ ├── llama_cpp.yml │ ├── mcp.yml │ ├── meta_llama.yml │ ├── mistral.yml │ ├── mongodb_atlas.yml │ ├── nvidia.yml │ ├── ollama.yml │ ├── openrouter.yml │ ├── opensearch.yml │ ├── optimum.yml │ ├── pgvector.yml │ ├── pinecone.yml │ ├── qdrant.yml │ ├── ragas.yml │ ├── snowflake.yml │ ├── stackit.yml │ ├── unstructured.yml │ ├── weaviate.yml │ └── weights_and_biases_weave.yml ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── cliff.toml ├── integrations ├── amazon_bedrock │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── bedrock_ranker_example.py │ │ ├── chatgenerator_example.py │ │ └── embedders_generator_with_rag_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── common │ │ │ └── amazon_bedrock │ │ │ │ ├── __init__.py │ │ │ │ ├── errors.py │ │ │ │ └── utils.py │ │ │ └── components │ │ │ ├── embedders │ │ │ └── amazon_bedrock │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ ├── generators │ │ │ └── amazon_bedrock │ │ │ │ ├── __init__.py │ │ │ │ ├── adapters.py │ │ │ │ ├── chat │ │ │ │ ├── __init__.py │ │ │ │ ├── chat_generator.py │ │ │ │ └── utils.py │ │ │ │ └── generator.py │ │ │ └── rankers │ │ │ └── amazon_bedrock │ │ │ ├── __init__.py │ │ │ └── ranker.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_chat_generator.py │ │ ├── test_chat_generator_utils.py │ │ ├── test_document_embedder.py │ │ ├── test_generator.py │ │ ├── test_ranker.py │ │ └── test_text_embedder.py ├── amazon_sagemaker │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── amazon_sagemaker │ │ │ ├── __init__.py │ │ │ ├── errors.py │ │ │ └── sagemaker.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ └── test_sagemaker.py ├── anthropic │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ │ ├── documentation_rag_with_claude.py │ │ └── prompt_caching.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── anthropic │ │ │ ├── __init__.py │ │ │ ├── chat │ │ │ ├── __init__.py │ │ │ ├── chat_generator.py │ │ │ └── vertex_chat_generator.py │ │ │ └── generator.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_chat_generator.py │ │ ├── test_generator.py │ │ └── test_vertex_chat_generator.py ├── astra │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── examples │ │ ├── data │ │ │ └── usr_01.txt │ │ ├── example.py │ │ ├── pipeline_example.py │ │ └── requirements.txt │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── astra │ │ │ │ ├── __init__.py │ │ │ │ └── retriever.py │ │ │ └── document_stores │ │ │ └── astra │ │ │ ├── __init__.py │ │ │ ├── astra_client.py │ │ │ ├── document_store.py │ │ │ ├── errors.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── test_document_store.py │ │ ├── test_embedding_retrieval.py │ │ └── test_retriever.py ├── azure_ai_search │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── example │ │ ├── document_store.py │ │ └── embedding_retrieval.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── azure_ai_search │ │ │ │ ├── __init__.py │ │ │ │ ├── bm25_retriever.py │ │ │ │ ├── embedding_retriever.py │ │ │ │ └── hybrid_retriever.py │ │ │ └── document_stores │ │ │ └── azure_ai_search │ │ │ ├── __init__.py │ │ │ ├── document_store.py │ │ │ ├── errors.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_bm25_retriever.py │ │ ├── test_document_store.py │ │ ├── test_embedding_retriever.py │ │ └── test_hybrid_retriever.py ├── chroma │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── example │ │ ├── data │ │ │ ├── usr_01.txt │ │ │ ├── usr_02.txt │ │ │ ├── usr_03.txt │ │ │ ├── usr_04.txt │ │ │ ├── usr_05.txt │ │ │ ├── usr_06.txt │ │ │ ├── usr_07.txt │ │ │ ├── usr_08.txt │ │ │ ├── usr_09.txt │ │ │ ├── usr_10.txt │ │ │ ├── usr_11.txt │ │ │ ├── usr_12.txt │ │ │ ├── usr_20.txt │ │ │ ├── usr_21.txt │ │ │ ├── usr_22.txt │ │ │ ├── usr_23.txt │ │ │ ├── usr_24.txt │ │ │ ├── usr_25.txt │ │ │ ├── usr_26.txt │ │ │ ├── usr_27.txt │ │ │ ├── usr_28.txt │ │ │ ├── usr_29.txt │ │ │ ├── usr_30.txt │ │ │ ├── usr_31.txt │ │ │ ├── usr_32.txt │ │ │ ├── usr_40.txt │ │ │ ├── usr_41.txt │ │ │ ├── usr_42.txt │ │ │ ├── usr_43.txt │ │ │ ├── usr_44.txt │ │ │ ├── usr_45.txt │ │ │ ├── usr_46.txt │ │ │ ├── usr_50.txt │ │ │ ├── usr_51.txt │ │ │ ├── usr_52.txt │ │ │ └── usr_90.txt │ │ └── example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── chroma │ │ │ │ ├── __init__.py │ │ │ │ └── retriever.py │ │ │ └── document_stores │ │ │ └── chroma │ │ │ ├── __init__.py │ │ │ ├── document_store.py │ │ │ ├── errors.py │ │ │ ├── filters.py │ │ │ └── utils.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ └── test_retriever.py ├── cohere │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── cohere_embedding.py │ │ ├── cohere_generation.py │ │ └── cohere_ranker.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── cohere │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ ├── embedding_types.py │ │ │ │ ├── text_embedder.py │ │ │ │ └── utils.py │ │ │ ├── generators │ │ │ └── cohere │ │ │ │ ├── __init__.py │ │ │ │ ├── chat │ │ │ │ ├── __init__.py │ │ │ │ └── chat_generator.py │ │ │ │ └── generator.py │ │ │ └── rankers │ │ │ └── cohere │ │ │ ├── __init__.py │ │ │ └── ranker.py │ └── tests │ │ ├── __init__.py │ │ ├── test_chat_generator.py │ │ ├── test_chat_generator_async.py │ │ ├── test_document_embedder.py │ │ ├── test_generator.py │ │ ├── test_ranker.py │ │ └── test_text_embedder.py ├── deepeval │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ │ └── example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── evaluators │ │ │ └── deepeval │ │ │ ├── __init__.py │ │ │ ├── evaluator.py │ │ │ └── metrics.py │ └── tests │ │ ├── __init__.py │ │ ├── test_evaluator.py │ │ └── test_metrics.py ├── elasticsearch │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── docker-compose.yml │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── elasticsearch │ │ │ │ ├── __init__.py │ │ │ │ ├── bm25_retriever.py │ │ │ │ └── embedding_retriever.py │ │ │ └── document_stores │ │ │ └── elasticsearch │ │ │ ├── __init__.py │ │ │ ├── document_store.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── test_bm25_retriever.py │ │ ├── test_document_store.py │ │ ├── test_embedding_retriever.py │ │ └── test_filters.py ├── fastembed │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── example.py │ │ ├── ranker_example.py │ │ └── sparse_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── fastembed │ │ │ │ ├── __init__.py │ │ │ │ ├── embedding_backend │ │ │ │ ├── __init__.py │ │ │ │ └── fastembed_backend.py │ │ │ │ ├── fastembed_document_embedder.py │ │ │ │ ├── fastembed_sparse_document_embedder.py │ │ │ │ ├── fastembed_sparse_text_embedder.py │ │ │ │ └── fastembed_text_embedder.py │ │ │ └── rankers │ │ │ └── fastembed │ │ │ ├── __init__.py │ │ │ └── ranker.py │ └── tests │ │ ├── __init__.py │ │ ├── test_fastembed_backend.py │ │ ├── test_fastembed_document_embedder.py │ │ ├── test_fastembed_ranker.py │ │ ├── test_fastembed_sparse_document_embedder.py │ │ ├── test_fastembed_sparse_text_embedder.py │ │ └── test_fastembed_text_embedder.py ├── github │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── connectors │ │ │ │ └── github │ │ │ │ ├── __init__.py │ │ │ │ ├── file_editor.py │ │ │ │ ├── issue_commenter.py │ │ │ │ ├── issue_viewer.py │ │ │ │ ├── pr_creator.py │ │ │ │ ├── repo_forker.py │ │ │ │ └── repo_viewer.py │ │ │ ├── prompts │ │ │ └── github │ │ │ │ ├── __init__.py │ │ │ │ ├── context_prompt.py │ │ │ │ ├── file_editor_prompt.py │ │ │ │ ├── issue_commenter_prompt.py │ │ │ │ ├── issue_viewer_prompt.py │ │ │ │ ├── pr_creator_prompt.py │ │ │ │ ├── repo_viewer_prompt.py │ │ │ │ └── system_prompt.py │ │ │ └── tools │ │ │ └── github │ │ │ ├── __init__.py │ │ │ ├── file_editor_tool.py │ │ │ ├── issue_commenter_tool.py │ │ │ ├── issue_viewer_tool.py │ │ │ ├── pr_creator_tool.py │ │ │ ├── repo_viewer_tool.py │ │ │ └── utils.py │ └── tests │ │ ├── __init__.py │ │ ├── test_file_editor.py │ │ ├── test_file_editor_tool.py │ │ ├── test_issue_commenter.py │ │ ├── test_issue_commenter_tool.py │ │ ├── test_issue_viewer.py │ │ ├── test_issue_viewer_tool.py │ │ ├── test_pr_creator.py │ │ ├── test_pr_creator_tool.py │ │ ├── test_repo_forker.py │ │ ├── test_repo_viewer.py │ │ └── test_repo_viewer_tool.py ├── google_ai │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example_assets │ │ ├── robot1.jpg │ │ ├── robot2.jpg │ │ ├── robot3.jpg │ │ └── robot4.jpg │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── google_ai │ │ │ ├── __init__.py │ │ │ ├── chat │ │ │ └── gemini.py │ │ │ └── gemini.py │ └── tests │ │ ├── __init__.py │ │ └── generators │ │ ├── chat │ │ └── test_chat_gemini.py │ │ └── test_gemini.py ├── google_genai │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── chatgenerator_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── google_genai │ │ │ ├── __init__.py │ │ │ └── chat │ │ │ ├── chat_generator.py │ │ │ └── utils.py │ └── tests │ │ └── test_chat_generator.py ├── google_vertex │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example_assets │ │ └── robot1.jpg │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── google_vertex │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ └── generators │ │ │ └── google_vertex │ │ │ ├── __init__.py │ │ │ ├── captioner.py │ │ │ ├── chat │ │ │ ├── __init__.py │ │ │ └── gemini.py │ │ │ ├── code_generator.py │ │ │ ├── gemini.py │ │ │ ├── image_generator.py │ │ │ ├── question_answering.py │ │ │ └── text_generator.py │ └── tests │ │ ├── __init__.py │ │ ├── chat │ │ └── test_gemini.py │ │ ├── test_captioner.py │ │ ├── test_code_generator.py │ │ ├── test_document_embedder.py │ │ ├── test_gemini.py │ │ ├── test_image_generator.py │ │ ├── test_question_answering.py │ │ ├── test_text_embedder.py │ │ └── test_text_generator.py ├── hatch.toml ├── instructor_embedders │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── embedders │ │ │ └── instructor_embedders │ │ │ ├── __init__.py │ │ │ ├── embedding_backend │ │ │ ├── __init__.py │ │ │ └── instructor_backend.py │ │ │ ├── instructor_document_embedder.py │ │ │ └── instructor_text_embedder.py │ └── tests │ │ ├── __init__.py │ │ ├── test_instructor_backend.py │ │ ├── test_instructor_document_embedder.py │ │ └── test_instructor_text_embedder.py ├── jina │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── jina_reader_connector.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── connectors │ │ │ └── jina │ │ │ │ ├── __init__.py │ │ │ │ ├── reader.py │ │ │ │ └── reader_mode.py │ │ │ ├── embedders │ │ │ └── jina │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ └── rankers │ │ │ └── jina │ │ │ ├── __init__.py │ │ │ └── ranker.py │ └── tests │ │ ├── __init__.py │ │ ├── test_document_embedder.py │ │ ├── test_ranker.py │ │ ├── test_reader_connector.py │ │ └── test_text_embedder.py ├── langfuse │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ │ ├── basic_rag.py │ │ ├── chat.py │ │ └── requirements.txt │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── connectors │ │ │ │ ├── __init__.py │ │ │ │ └── langfuse │ │ │ │ ├── __init__.py │ │ │ │ └── langfuse_connector.py │ │ │ └── tracing │ │ │ └── langfuse │ │ │ ├── __init__.py │ │ │ └── tracer.py │ └── tests │ │ ├── __init__.py │ │ ├── test_langfuse_connector.py │ │ ├── test_tracer.py │ │ └── test_tracing.py ├── llama_cpp │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── llama_cpp_generator_example.py │ │ └── rag_pipeline_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── llama_cpp │ │ │ ├── __init__.py │ │ │ ├── chat │ │ │ └── chat_generator.py │ │ │ └── generator.py │ └── tests │ │ ├── __init__.py │ │ ├── models │ │ └── .gitignore │ │ ├── test_chat_generator.py │ │ └── test_generator.py ├── mcp │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── mcp_client.py │ │ ├── mcp_filtered_tools.py │ │ ├── mcp_server.py │ │ ├── mcp_sse_toolset.py │ │ ├── mcp_stdio_client.py │ │ ├── mcp_stdio_toolset.py │ │ ├── time_pipeline.py │ │ └── time_pipeline_toolset.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── tools │ │ │ └── mcp │ │ │ ├── __init__.py │ │ │ ├── mcp_tool.py │ │ │ └── mcp_toolset.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── mcp_memory_transport.py │ │ ├── mcp_servers_fixtures.py │ │ ├── test_mcp_integration.py │ │ ├── test_mcp_server_info.py │ │ ├── test_mcp_tool.py │ │ └── test_mcp_toolset.py ├── meta_llama │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── rag_with_llama.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── meta_llama │ │ │ ├── __init__.py │ │ │ └── chat │ │ │ ├── __init__.py │ │ │ └── chat_generator.py │ └── tests │ │ ├── __init__.py │ │ ├── test_llama_chat_generator.py │ │ └── test_llama_chat_generator_async.py ├── mistral │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── indexing_pipeline.py │ │ └── streaming_chat_with_rag.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── mistral │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ └── generators │ │ │ └── mistral │ │ │ ├── __init__.py │ │ │ └── chat │ │ │ ├── __init__.py │ │ │ └── chat_generator.py │ └── tests │ │ ├── __init__.py │ │ ├── test_mistral_chat_generator.py │ │ ├── test_mistral_chat_generator_async.py │ │ ├── test_mistral_document_embedder.py │ │ └── test_mistral_text_embedder.py ├── mongodb_atlas │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── embedding_retrieval.py │ │ └── hybrid_retrieval.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── mongodb_atlas │ │ │ │ ├── __init__.py │ │ │ │ ├── embedding_retriever.py │ │ │ │ └── full_text_retriever.py │ │ │ └── document_stores │ │ │ └── mongodb_atlas │ │ │ ├── __init__.py │ │ │ ├── document_store.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ ├── test_embedding_retrieval.py │ │ ├── test_fulltext_retrieval.py │ │ ├── test_fulltext_retrieval_async.py │ │ └── test_retriever.py ├── nvidia │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ ├── embedders │ │ │ │ └── nvidia │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── document_embedder.py │ │ │ │ │ ├── text_embedder.py │ │ │ │ │ └── truncate.py │ │ │ ├── generators │ │ │ │ └── nvidia │ │ │ │ │ ├── __init__.py │ │ │ │ │ ├── chat │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── chat_generator.py │ │ │ │ │ └── generator.py │ │ │ └── rankers │ │ │ │ └── nvidia │ │ │ │ ├── __init__.py │ │ │ │ ├── ranker.py │ │ │ │ └── truncate.py │ │ │ └── utils │ │ │ └── nvidia │ │ │ ├── __init__.py │ │ │ ├── models.py │ │ │ ├── nim_backend.py │ │ │ └── utils.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_base_url.py │ │ ├── test_document_embedder.py │ │ ├── test_embedding_truncate_mode.py │ │ ├── test_generator.py │ │ ├── test_nim_backend.py │ │ ├── test_nvidia_chat_generator.py │ │ ├── test_ranker.py │ │ ├── test_text_embedder.py │ │ └── test_utils.py ├── ollama │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── chat_generator_example.py │ │ ├── embedders_example.py │ │ └── generator_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── ollama │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ └── generators │ │ │ └── ollama │ │ │ ├── __init__.py │ │ │ ├── chat │ │ │ ├── __init__.py │ │ │ └── chat_generator.py │ │ │ └── generator.py │ └── tests │ │ ├── __init__.py │ │ ├── test_chat_generator.py │ │ ├── test_document_embedder.py │ │ ├── test_generator.py │ │ └── test_text_embedder.py ├── openrouter │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── openrouter_with_tools_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── generators │ │ │ └── openrouter │ │ │ ├── __init__.py │ │ │ └── chat │ │ │ ├── __init__.py │ │ │ └── chat_generator.py │ └── tests │ │ ├── __init__.py │ │ ├── test_openrouter_chat_generator.py │ │ └── test_openrouter_chat_generator_async.py ├── opensearch │ ├── .gitignore │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── docker-compose.yml │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── opensearch │ │ │ │ ├── __init__.py │ │ │ │ ├── bm25_retriever.py │ │ │ │ ├── embedding_retriever.py │ │ │ │ └── open_search_hybrid_retriever.py │ │ │ └── document_stores │ │ │ └── opensearch │ │ │ ├── __init__.py │ │ │ ├── auth.py │ │ │ ├── document_store.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_auth.py │ │ ├── test_bm25_retriever.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ ├── test_embedding_retriever.py │ │ ├── test_filters.py │ │ └── test_open_search_hybrid_retriever.py ├── optimum │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ │ └── example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── embedders │ │ │ └── optimum │ │ │ ├── __init__.py │ │ │ ├── _backend.py │ │ │ ├── optimization.py │ │ │ ├── optimum_document_embedder.py │ │ │ ├── optimum_text_embedder.py │ │ │ ├── pooling.py │ │ │ └── quantization.py │ └── tests │ │ ├── __init__.py │ │ ├── test_optimum_document_embedder.py │ │ └── test_optimum_text_embedder.py ├── pgvector │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── embedding_retrieval.py │ │ └── hybrid_retrieval.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── pgvector │ │ │ │ ├── __init__.py │ │ │ │ ├── embedding_retriever.py │ │ │ │ └── keyword_retriever.py │ │ │ └── document_stores │ │ │ └── pgvector │ │ │ ├── __init__.py │ │ │ ├── converters.py │ │ │ ├── document_store.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_converters.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ ├── test_filters.py │ │ ├── test_retrieval.py │ │ ├── test_retrieval_async.py │ │ └── test_retrievers.py ├── pinecone │ ├── CHANGELOG.md │ ├── README.md │ ├── examples │ │ └── example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── pinecone │ │ │ │ ├── __init__.py │ │ │ │ └── embedding_retriever.py │ │ │ └── document_stores │ │ │ └── pinecone │ │ │ ├── __init__.py │ │ │ ├── document_store.py │ │ │ └── filters.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ ├── test_embedding_retriever.py │ │ └── test_filters.py ├── qdrant │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ └── embedding_retrieval.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── qdrant │ │ │ │ ├── __init__.py │ │ │ │ └── retriever.py │ │ │ └── document_stores │ │ │ └── qdrant │ │ │ ├── __init__.py │ │ │ ├── converters.py │ │ │ ├── document_store.py │ │ │ ├── filters.py │ │ │ └── migrate_to_sparse.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_converters.py │ │ ├── test_dict_converters.py │ │ ├── test_document_store.py │ │ ├── test_document_store_async.py │ │ ├── test_embedding_retriever.py │ │ ├── test_filters.py │ │ ├── test_hybrid_retriever.py │ │ └── test_sparse_embedding_retriever.py ├── ragas │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ │ ├── evaluation_from_pipeline_example.py │ │ └── evaluation_with_components_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── evaluators │ │ │ └── ragas │ │ │ ├── __init__.py │ │ │ └── evaluator.py │ └── tests │ │ ├── __init__.py │ │ └── test_evaluator.py ├── snowflake │ ├── CHANGELOG.md │ ├── README.md │ ├── example │ │ └── text2sql_example.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── retrievers │ │ │ └── snowflake │ │ │ ├── __init__.py │ │ │ └── snowflake_table_retriever.py │ └── tests │ │ ├── __init__.py │ │ └── test_snowflake_table_retriever.py ├── stackit │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── examples │ │ ├── chat_as_component.py │ │ ├── chat_as_pipeline.py │ │ └── streaming_chat_with_rag.py │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ ├── embedders │ │ │ └── stackit │ │ │ │ ├── __init__.py │ │ │ │ ├── document_embedder.py │ │ │ │ └── text_embedder.py │ │ │ └── generators │ │ │ └── stackit │ │ │ ├── __init__.py │ │ │ └── chat │ │ │ ├── __init__.py │ │ │ └── chat_generator.py │ └── tests │ │ ├── __init__.py │ │ ├── test_stackit_chat_generator.py │ │ ├── test_stackit_document_embedder.py │ │ └── test_stackit_text_embedder.py ├── unstructured │ ├── CHANGELOG.md │ ├── LICENSE │ ├── README.md │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ └── components │ │ │ └── converters │ │ │ └── unstructured │ │ │ ├── __init__.py │ │ │ └── converter.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── samples │ │ ├── sample_pdf.pdf │ │ └── sample_pdf2.pdf │ │ └── test_converter.py ├── weaviate │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── docker-compose.yml │ ├── pydoc │ │ └── config.yml │ ├── pyproject.toml │ ├── src │ │ └── haystack_integrations │ │ │ ├── components │ │ │ └── retrievers │ │ │ │ └── weaviate │ │ │ │ ├── __init__.py │ │ │ │ ├── bm25_retriever.py │ │ │ │ └── embedding_retriever.py │ │ │ └── document_stores │ │ │ └── weaviate │ │ │ ├── __init__.py │ │ │ ├── _filters.py │ │ │ ├── auth.py │ │ │ └── document_store.py │ └── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── test_auth.py │ │ ├── test_bm25_retriever.py │ │ ├── test_document_store.py │ │ ├── test_embedding_retriever.py │ │ ├── test_files │ │ └── robot1.jpg │ │ └── test_filters.py └── weights_and_biases_weave │ ├── CHANGELOG.md │ ├── LICENSE.txt │ ├── README.md │ ├── example │ ├── README.md │ └── hybrid_retrieval.py │ ├── pydoc │ └── config.yml │ ├── pyproject.toml │ ├── src │ └── haystack_integrations │ │ ├── components │ │ └── connectors │ │ │ ├── __init__.py │ │ │ └── weave_connector.py │ │ └── tracing │ │ └── weave │ │ ├── __init__.py │ │ └── tracer.py │ └── tests │ ├── test_tracer.py │ └── test_weave_connector.py ├── requirements.txt └── show_unreleased.sh /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/about-codeowners/ for syntax 2 | 3 | # Open Source Engineering will be the default owners for everything 4 | # in the repo. Unless a later match takes precedence, 5 | # @deepset-ai/open-source-engineering will be requested for review 6 | # when someone opens a pull request. 7 | * @deepset-ai/open-source-engineering 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/breaking-change-proposal.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Breaking change proposal 3 | about: Track a breaking change for an existing integration 4 | title: '' 5 | labels: breaking change 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Summary and motivation 11 | 12 | Briefly explain how the change is breaking and why is needed. 13 | 14 | ## Checklist 15 | 16 | ### Tasks 17 | - [ ] The changes are merged in the `main` branch (Code + Docstrings) 18 | - [ ] New package version declares the breaking change 19 | - [ ] The package has been released on PyPI 20 | - [ ] Docs at https://docs.haystack.deepset.ai/ were updated 21 | - [ ] Integration tile on https://github.com/deepset-ai/haystack-integrations was updated 22 | - [ ] Notebooks on https://github.com/deepset-ai/haystack-cookbook were updated (if needed) 23 | - [ ] Tutorials on https://github.com/deepset-ai/haystack-tutorials were updated (if needed) 24 | - [ ] Articles on https://github.com/deepset-ai/haystack-home/tree/main/content were updated (if needed) 25 | 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Report a bug for an integration 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior. Feel free to link a Colab we can run to investigate the issue. 15 | 16 | **Describe your environment (please complete the following information):** 17 | - OS: [e.g. iOS] 18 | - Haystack version: 19 | - Integration version: 20 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request-for-existing-integrations.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request for existing integrations 3 | about: Suggest an idea for an integration 4 | title: '' 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new-integration-proposal.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New Integration Proposal 3 | about: Track the creation process for a new integration 4 | title: '' 5 | labels: new integration 6 | assignees: '' 7 | 8 | --- 9 | 10 | ## Summary and motivation 11 | 12 | Briefly explain the request: why do we need this integration? What use cases does it support? 13 | 14 | ## Detailed design 15 | 16 | Explain the design in enough detail for somebody familiar with Haystack to understand, and for somebody familiar with 17 | the implementation to implement. Get into specifics and corner-cases, and include examples of how the feature is used. 18 | Also, if there's any new terminology involved, define it here. 19 | 20 | ## Checklist 21 | 22 | If the request is accepted, ensure the following checklist is complete before closing this issue. 23 | 24 | ### Tasks 25 | - [ ] The code is documented with docstrings and was merged in the `main` branch 26 | - [ ] Docs are published at https://docs.haystack.deepset.ai/ 27 | - [ ] There is a Github workflow running the tests for the integration nightly and at every PR 28 | - [ ] A new label named like `integration:` has been added to the list of labels for this [repository](https://github.com/deepset-ai/haystack-core-integrations/labels) 29 | - [ ] The [labeler.yml](https://github.com/deepset-ai/haystack-core-integrations/blob/main/.github/labeler.yml) file has been updated 30 | - [ ] The package has been released on PyPI 31 | - [ ] An integration tile has been added to https://github.com/deepset-ai/haystack-integrations 32 | - [ ] The integration has been listed in the [Inventory section](https://github.com/deepset-ai/haystack-core-integrations#inventory) of this repo README 33 | - [ ] There is an example available to demonstrate the feature 34 | - [ ] The feature was announced through social media 35 | -------------------------------------------------------------------------------- /.github/actions/send_failure/action.yml: -------------------------------------------------------------------------------- 1 | name: "Send failure event to Datadog" 2 | inputs: 3 | api-key: 4 | description: "Datadog API key" 5 | required: true 6 | title: 7 | description: "Custom title for the event" 8 | required: true 9 | runs: 10 | using: "composite" 11 | steps: 12 | - uses: masci/datadog@v1 13 | with: 14 | api-key: ${{ inputs.api-key }} 15 | api-url: https://api.datadoghq.eu 16 | events: | 17 | - title: "${{ inputs.title }}" 18 | text: "Job ${{ github.job }} in branch ${{ github.ref_name }}" 19 | alert_type: "error" 20 | source_type_name: "Github" 21 | host: ${{ github.repository_owner }} 22 | tags: 23 | - "project:${{ github.repository }}" 24 | - "job:${{ github.job }}" 25 | - "run_id:${{ github.run_id }}" 26 | - "workflow:${{ github.workflow }}" 27 | - "branch:${{ github.ref_name }}" 28 | - "url:https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'github-actions' 4 | directory: '/' 5 | schedule: 6 | interval: 'daily' 7 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Related Issues 2 | 3 | - fixes #issue-number 4 | 5 | ### Proposed Changes: 6 | 7 | 8 | 9 | 10 | ### How did you test it? 11 | 12 | 13 | 14 | ### Notes for the reviewer 15 | 16 | 17 | 18 | ### Checklist 19 | 20 | - I have read the [contributors guidelines](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CONTRIBUTING.md) and the [code of conduct](https://github.com/deepset-ai/haystack-core-integrations/blob/main/CODE_OF_CONDUCT.md) 21 | - I have updated the related issue with new insights and changes 22 | - I added unit tests and updated the docstrings 23 | - I've used one of the [conventional commit types](https://www.conventionalcommits.org/en/v1.0.0/) for my PR title: `fix:`, `feat:`, `build:`, `chore:`, `ci:`, `docs:`, `style:`, `refactor:`, `perf:`, `test:`. 24 | -------------------------------------------------------------------------------- /.github/utils/docstrings_checksum.py: -------------------------------------------------------------------------------- 1 | import ast 2 | import hashlib 3 | from pathlib import Path 4 | from typing import Iterator 5 | 6 | 7 | def docstrings_checksum(python_files: Iterator[Path]): 8 | files_content = (f.read_text() for f in python_files) 9 | trees = (ast.parse(c) for c in files_content) 10 | 11 | # Get all docstrings from async functions, functions, 12 | # classes and modules definitions 13 | docstrings = [] 14 | for tree in trees: 15 | for node in ast.walk(tree): 16 | if not isinstance( 17 | node, (ast.AsyncFunctionDef, ast.FunctionDef, ast.ClassDef, ast.Module) 18 | ): 19 | # Skip all node types that can't have docstrings to prevent failures 20 | continue 21 | docstring = ast.get_docstring(node) 22 | if docstring: 23 | docstrings.append(docstring) 24 | 25 | # Sort them to be safe, since ast.walk() returns 26 | # nodes in no specified order. 27 | # See https://docs.python.org/3/library/ast.html#ast.walk 28 | docstrings.sort() 29 | 30 | return hashlib.md5(str(docstrings).encode("utf-8")).hexdigest() 31 | 32 | 33 | if __name__ == "__main__": 34 | import argparse 35 | 36 | parser = argparse.ArgumentParser() 37 | parser.add_argument("--root", help="Project root folder", required=True, type=Path) 38 | args = parser.parse_args() 39 | 40 | # Get all Python files 41 | root: Path = args.root.absolute() 42 | python_files = root.glob("integrations/**/*.py") 43 | 44 | md5 = docstrings_checksum(python_files) 45 | print(md5) 46 | -------------------------------------------------------------------------------- /.github/utils/pyproject_to_requirements.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | from pathlib import Path 4 | import toml 5 | 6 | def main(pyproject_path: Path, exclude_optional_dependencies: bool = False): 7 | content = toml.load(pyproject_path) 8 | deps = set(content["project"]["dependencies"]) 9 | 10 | if not exclude_optional_dependencies: 11 | optional_deps = content["project"].get("optional-dependencies", {}) 12 | for dep_list in optional_deps.values(): 13 | deps.update(dep_list) 14 | 15 | print("\n".join(sorted(deps))) 16 | 17 | if __name__ == "__main__": 18 | parser = argparse.ArgumentParser( 19 | prog="pyproject_to_requirements.py", 20 | description="Convert pyproject.toml to requirements.txt" 21 | ) 22 | parser.add_argument("pyproject_path", type=Path, help="Path to pyproject.toml file") 23 | parser.add_argument("--exclude-optional-dependencies", action="store_true", help="Exclude optional dependencies") 24 | 25 | args = parser.parse_args() 26 | main(args.pyproject_path, args.exclude_optional_dependencies) 27 | -------------------------------------------------------------------------------- /.github/workflows/CI_check_integration_format.yml: -------------------------------------------------------------------------------- 1 | name: Core / Check Integration Format 2 | on: 3 | - pull_request 4 | 5 | jobs: 6 | check: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Checkout 10 | uses: actions/checkout@v4 11 | 12 | - name: Ensure no hyphens 13 | run: | 14 | set +e 15 | find -name "*-*" -type d -maxdepth 2 | grep integrations 16 | test "$?" -eq 1 && exit 0 || echo "::error::Names of folders in ./integrations must not contain hyphens" && exit 1 17 | -------------------------------------------------------------------------------- /.github/workflows/CI_labeler.yml: -------------------------------------------------------------------------------- 1 | name: Core / Labeler 2 | on: 3 | - pull_request_target 4 | 5 | permissions: 6 | contents: read 7 | pull-requests: write 8 | 9 | jobs: 10 | triage: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/labeler@v5 14 | with: 15 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 16 | -------------------------------------------------------------------------------- /.github/workflows/CI_project.yml: -------------------------------------------------------------------------------- 1 | name: Core / Add issues to Github project 2 | 3 | on: 4 | issues: 5 | types: 6 | - opened 7 | 8 | jobs: 9 | add-to-project: 10 | name: Add new issues to project for triage 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/add-to-project@v1.0.2 14 | with: 15 | project-url: https://github.com/orgs/deepset-ai/projects/5 16 | github-token: ${{ secrets.GH_PROJECT_PAT }} 17 | -------------------------------------------------------------------------------- /.github/workflows/CI_stale.yml: -------------------------------------------------------------------------------- 1 | name: 'Stalebot' 2 | on: 3 | schedule: 4 | - cron: '30 1 * * *' 5 | 6 | jobs: 7 | makestale: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/stale@v9 11 | with: 12 | any-of-labels: 'information-needed' 13 | stale-pr-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days.' 14 | days-before-stale: 30 15 | days-before-close: 10 -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Report a Vulnerability 4 | 5 | If you found a security vulnerability in Haystack, send a message to 6 | [security@deepset.ai](mailto:security@deepset.ai). 7 | 8 | In your message, please include: 9 | 10 | 1. Reproducible steps to trigger the vulnerability. 11 | 2. An explanation of what makes you think there is a vulnerability. 12 | 3. Any information you may have on active exploitations of the vulnerability (zero-day). 13 | 14 | ## Vulnerability Response 15 | 16 | We'll review your report within 5 business days and we will do a preliminary analysis 17 | to confirm that the vulnerability is plausible. Otherwise, we'll decline the report. 18 | 19 | We won't disclose any information you share with us but we'll use it to get the issue 20 | fixed or to coordinate a vendor response, as needed. 21 | 22 | We'll keep you updated of the status of the issue. 23 | 24 | Our goal is to disclose bugs as soon as possible once a user mitigation is available. 25 | Once we get a good understanding of the vulnerability, we'll set a disclosure date after 26 | consulting the author of the report and Haystack maintainers. 27 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/README.md: -------------------------------------------------------------------------------- 1 | # amazon-bedrock-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/amazon-bedrock-haystack.svg)](https://pypi.org/project/amazon-bedrock-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/amazon-bedrock-haystack.svg)](https://pypi.org/project/amazon-bedrock-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [Contributing](#contributing) 12 | - [License](#license) 13 | 14 | ## Installation 15 | 16 | ```console 17 | pip install amazon-bedrock-haystack 18 | ``` 19 | 20 | ## Contributing 21 | 22 | `hatch` is the best way to interact with this project, to install it: 23 | ```sh 24 | pip install hatch 25 | ``` 26 | 27 | With `hatch` installed, to run all the tests: 28 | ``` 29 | hatch run test 30 | ``` 31 | > Note: there are no integration tests for this project. 32 | 33 | To run the linters `ruff` and `mypy`: 34 | ``` 35 | hatch run lint:all 36 | ``` 37 | 38 | ## License 39 | 40 | `amazon-bedrock-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 41 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/examples/bedrock_ranker_example.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from haystack import Document 4 | from haystack.utils import Secret 5 | 6 | from haystack_integrations.components.rankers.amazon_bedrock import AmazonBedrockRanker 7 | 8 | # Set up AWS credentials 9 | # You can also set these as environment variables 10 | aws_profile_name = os.environ.get("AWS_PROFILE") or "default" 11 | aws_region_name = os.environ.get("AWS_DEFAULT_REGION") or "eu-central-1" 12 | # Initialize the AmazonBedrockRanker with AWS credentials 13 | ranker = AmazonBedrockRanker( 14 | model="cohere.rerank-v3-5:0", 15 | top_k=2, 16 | aws_profile_name=Secret.from_token(aws_profile_name), 17 | aws_region_name=Secret.from_token(aws_region_name), 18 | ) 19 | 20 | # Create some sample documents 21 | docs = [ 22 | Document(content="Paris is the capital of France."), 23 | Document(content="Berlin is the capital of Germany."), 24 | Document(content="London is the capital of the United Kingdom."), 25 | Document(content="Rome is the capital of Italy."), 26 | ] 27 | 28 | # Define a query 29 | query = "What is the capital of Germany?" 30 | 31 | # Run the ranker 32 | output = ranker.run(query=query, documents=docs) 33 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/examples/chatgenerator_example.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need to 2 | # 1) set `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_DEFAULT_REGION` environment variables 3 | # 2) enable access to the selected model in Amazon Bedrock 4 | # Note: if you change the model, update the model-specific inference parameters. 5 | 6 | 7 | from haystack.dataclasses import ChatMessage 8 | 9 | from haystack_integrations.components.generators.amazon_bedrock import AmazonBedrockChatGenerator 10 | 11 | generator = AmazonBedrockChatGenerator( 12 | model="anthropic.claude-3-haiku-20240307-v1:0", 13 | # model-specific inference parameters 14 | generation_kwargs={ 15 | "max_tokens": 500, 16 | "temperature": 0.0, 17 | }, 18 | ) 19 | 20 | system_prompt = """ 21 | You are a helpful assistant that helps users learn more about AWS services. 22 | Your audience is engineers with a decent technical background. 23 | Be very concise and specific in your answers, keeping them short. 24 | You may use technical terms, jargon, and abbreviations that are common among practitioners. 25 | """ 26 | 27 | # Even though Anthropic Claud models support only messages with `user` and `assistant` roles, 28 | # internal handling converts message with `system` role into `system` inference parameter for Claude 29 | # which allows for more portablability of code across generators 30 | messages = [ 31 | ChatMessage.from_system(system_prompt), 32 | ChatMessage.from_user("Which service should I use to train custom Machine Learning models?"), 33 | ] 34 | 35 | results = generator.run(messages) 36 | results["replies"] 37 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.common.amazon_bedrock.errors", 6 | "haystack_integrations.components.embedders.amazon_bedrock.document_embedder", 7 | "haystack_integrations.components.embedders.amazon_bedrock.text_embedder", 8 | "haystack_integrations.components.generators.amazon_bedrock.generator", 9 | "haystack_integrations.components.generators.amazon_bedrock.adapters", 10 | "haystack_integrations.common.amazon_bedrock.errors", 11 | "haystack_integrations.components.generators.amazon_bedrock.chat.chat_generator", 12 | "haystack_integrations.components.rankers.amazon_bedrock.ranker", 13 | ] 14 | ignore_when_discovered: ["__init__"] 15 | processors: 16 | - type: filter 17 | expression: 18 | documented_only: true 19 | do_not_filter_modules: false 20 | skip_empty_modules: true 21 | - type: filter 22 | expression: "name not in ['BedrockRanker']" 23 | - type: smart 24 | - type: crossref 25 | renderer: 26 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 27 | excerpt: Amazon Bedrock integration for Haystack 28 | category_slug: integrations-api 29 | title: Amazon Bedrock 30 | slug: integrations-amazon-bedrock 31 | order: 9 32 | markdown: 33 | descriptive_class_title: false 34 | classdef_code_block: false 35 | descriptive_module_title: true 36 | add_method_class_prefix: true 37 | add_member_class_prefix: false 38 | filename: _readme_amazon_bedrock.md 39 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/common/amazon_bedrock/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/common/amazon_bedrock/errors.py: -------------------------------------------------------------------------------- 1 | class AmazonBedrockError(Exception): 2 | """ 3 | Any error generated by the Amazon Bedrock integration. 4 | 5 | This error wraps its source transparently in such a way that its attributes 6 | can be accessed directly: for example, if the original error has a `message` attribute, 7 | `AmazonBedrockError.message` will exist and have the expected content. 8 | """ 9 | 10 | 11 | class AWSConfigurationError(AmazonBedrockError): 12 | """Exception raised when AWS is not configured correctly""" 13 | 14 | 15 | class AmazonBedrockConfigurationError(AmazonBedrockError): 16 | """Exception raised when AmazonBedrock node is not configured correctly""" 17 | 18 | 19 | class AmazonBedrockInferenceError(AmazonBedrockError): 20 | """Exception for issues that occur in the Bedrock inference node""" 21 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/components/embedders/amazon_bedrock/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import AmazonBedrockDocumentEmbedder 5 | from .text_embedder import AmazonBedrockTextEmbedder 6 | 7 | __all__ = ["AmazonBedrockDocumentEmbedder", "AmazonBedrockTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .chat.chat_generator import AmazonBedrockChatGenerator 5 | from .generator import AmazonBedrockGenerator 6 | 7 | __all__ = ["AmazonBedrockChatGenerator", "AmazonBedrockGenerator"] 8 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/src/haystack_integrations/components/rankers/amazon_bedrock/__init__.py: -------------------------------------------------------------------------------- 1 | from .ranker import AmazonBedrockRanker, BedrockRanker 2 | 3 | __all__ = ["AmazonBedrockRanker", "BedrockRanker"] 4 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/amazon_bedrock/tests/conftest.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | import pytest 4 | 5 | 6 | @pytest.fixture 7 | def set_env_variables(monkeypatch): 8 | monkeypatch.setenv("AWS_ACCESS_KEY_ID", "some_fake_id") 9 | monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "some_fake_key") 10 | monkeypatch.setenv("AWS_SESSION_TOKEN", "some_fake_token") 11 | monkeypatch.setenv("AWS_DEFAULT_REGION", "fake_region") 12 | monkeypatch.setenv("AWS_PROFILE", "some_fake_profile") 13 | 14 | 15 | # create a fixture with mocked boto3 client and session 16 | @pytest.fixture 17 | def mock_boto3_session(): 18 | with patch("boto3.Session") as mock_client: 19 | yield mock_client 20 | 21 | 22 | # create a fixture with mocked aioboto3 client and session 23 | @pytest.fixture 24 | def mock_aioboto3_session(): 25 | with patch("aioboto3.Session") as mock_client: 26 | yield mock_client 27 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [unreleased] 4 | 5 | ### 🚀 Features 6 | 7 | - Sagemaker integration: `SagemakerGenerator` (#276) 8 | 9 | ### 🐛 Bug Fixes 10 | 11 | - Fix order of API docs (#447) 12 | 13 | This PR will also push the docs to Readme 14 | 15 | ### 📚 Documentation 16 | 17 | - Update category slug (#442) 18 | - Small consistency improvements (#536) 19 | - Review integrations sagemaker (#544) 20 | - Disable-class-def (#556) 21 | 22 | ### ⚙️ Miscellaneous Tasks 23 | 24 | - Retry tests to reduce flakyness (#836) 25 | - Update ruff invocation to include check parameter (#853) 26 | 27 | 28 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/README.md: -------------------------------------------------------------------------------- 1 | # amazon-sagemaker-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/amazon-sagemaker-haystack.svg)](https://pypi.org/project/amazon-sagemaker-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/amazon-sagemaker-haystack.svg)](https://pypi.org/project/amazon-sagemaker-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [Contributing](#contributing) 12 | - [License](#license) 13 | 14 | ## Installation 15 | 16 | ```console 17 | pip install amazon-sagemaker-haystack 18 | ``` 19 | 20 | ## Contributing 21 | 22 | `hatch` is the best way to interact with this project, to install it: 23 | ```sh 24 | pip install hatch 25 | ``` 26 | 27 | With `hatch` installed, to run all the tests: 28 | ``` 29 | hatch run test 30 | ``` 31 | 32 | > Note: You need to export your AWS credentials for Sagemaker integration tests to run (`AWS_ACCESS_KEY_ID` and 33 | `AWS_SECRET_SECRET_KEY`). If those are missing, the integration tests will be skipped. 34 | 35 | To only run unit tests: 36 | ``` 37 | hatch run test:unit 38 | ``` 39 | 40 | To only run integration tests: 41 | ``` 42 | hatch run test -m "integration" 43 | ``` 44 | 45 | To run the linters `ruff` and `mypy`: 46 | ``` 47 | hatch run lint:all 48 | ``` 49 | 50 | ## License 51 | 52 | `amazon-sagemaker-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 53 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.amazon_sagemaker.sagemaker", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: Amazon Sagemaker integration for Haystack 19 | category_slug: integrations-api 20 | title: Amazon Sagemaker 21 | slug: integrations-amazon-sagemaker 22 | order: 20 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_amazon_sagemaker.md 30 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/src/haystack_integrations/components/generators/amazon_sagemaker/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from haystack_integrations.components.generators.amazon_sagemaker.sagemaker import SagemakerGenerator 5 | 6 | __all__ = ["SagemakerGenerator"] 7 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/src/haystack_integrations/components/generators/amazon_sagemaker/errors.py: -------------------------------------------------------------------------------- 1 | class SagemakerError(Exception): 2 | """ 3 | Parent class for all exceptions raised by the Sagemaker component 4 | """ 5 | 6 | 7 | class AWSConfigurationError(SagemakerError): 8 | """Exception raised when AWS is not configured correctly""" 9 | 10 | 11 | class SagemakerNotReadyError(SagemakerError): 12 | """Exception for issues that occur during Sagemaker inference""" 13 | 14 | 15 | class SagemakerInferenceError(SagemakerError): 16 | """Exception for issues that occur during Sagemaker inference""" 17 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/amazon_sagemaker/tests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from unittest.mock import patch 4 | 5 | 6 | @pytest.fixture 7 | def set_env_variables(monkeypatch): 8 | monkeypatch.setenv("AWS_ACCESS_KEY_ID", "some_fake_id") 9 | monkeypatch.setenv("AWS_SECRET_ACCESS_KEY", "some_fake_key") 10 | monkeypatch.setenv("AWS_SESSION_TOKEN", "some_fake_token") 11 | monkeypatch.setenv("AWS_DEFAULT_REGION", "fake_region") 12 | monkeypatch.setenv("AWS_PROFILE", "some_fake_profile") 13 | 14 | 15 | @pytest.fixture 16 | def mock_boto3_session(): 17 | with patch("boto3.Session") as mock_client: 18 | yield mock_client 19 | -------------------------------------------------------------------------------- /integrations/anthropic/README.md: -------------------------------------------------------------------------------- 1 | # anthropic-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/anthropic-haystack.svg)](https://pypi.org/project/anthropic-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/anthropic-haystack.svg)](https://pypi.org/project/anthropic-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [Contributing](#contributing) 12 | - [Examples](#examples) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install anthropic-haystack 19 | ``` 20 | 21 | ## Contributing 22 | 23 | `hatch` is the best way to interact with this project, to install it: 24 | ```sh 25 | pip install hatch 26 | ``` 27 | 28 | With `hatch` installed, to run all the tests: 29 | ``` 30 | hatch run test 31 | ``` 32 | > Note: there are no integration tests for this project. 33 | 34 | To run the linters `ruff` and `mypy`: 35 | ``` 36 | hatch run lint:all 37 | ``` 38 | 39 | ## Examples 40 | You can find an example of how to do a simple RAG with Claude using online documentation in the `example/` folder of this repo. 41 | 42 | ## License 43 | 44 | `anthropic-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 45 | -------------------------------------------------------------------------------- /integrations/anthropic/example/documentation_rag_with_claude.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need to set a `ANTHROPIC_API_KEY` environment variable. 2 | 3 | from haystack import Pipeline 4 | from haystack.components.builders import ChatPromptBuilder 5 | from haystack.components.converters import HTMLToDocument 6 | from haystack.components.fetchers import LinkContentFetcher 7 | from haystack.components.generators.utils import print_streaming_chunk 8 | from haystack.dataclasses import ChatMessage 9 | from haystack.utils import Secret 10 | 11 | from haystack_integrations.components.generators.anthropic import AnthropicChatGenerator 12 | 13 | messages = [ 14 | ChatMessage.from_system("You are a prompt expert who answers questions based on the given documents."), 15 | ChatMessage.from_user( 16 | "Here are the documents:\n{% for d in documents %} \n {{d.content}} \n{% endfor %}\nAnswer: {{query}}" 17 | ), 18 | ] 19 | 20 | rag_pipeline = Pipeline() 21 | rag_pipeline.add_component("fetcher", LinkContentFetcher()) 22 | rag_pipeline.add_component("converter", HTMLToDocument()) 23 | rag_pipeline.add_component("prompt_builder", ChatPromptBuilder(variables=["documents"])) 24 | rag_pipeline.add_component( 25 | "llm", 26 | AnthropicChatGenerator( 27 | api_key=Secret.from_env_var("ANTHROPIC_API_KEY"), 28 | streaming_callback=print_streaming_chunk, 29 | ), 30 | ) 31 | 32 | 33 | rag_pipeline.connect("fetcher", "converter") 34 | rag_pipeline.connect("converter", "prompt_builder") 35 | rag_pipeline.connect("prompt_builder.prompt", "llm.messages") 36 | 37 | question = "When should we use prompt engineering and when should we fine-tune?" 38 | rag_pipeline.run( 39 | data={ 40 | "fetcher": {"urls": ["https://docs.anthropic.com/en/docs/build-with-claude/prompt-engineering/overview"]}, 41 | "prompt_builder": {"template_variables": {"query": question}, "template": messages}, 42 | } 43 | ) 44 | -------------------------------------------------------------------------------- /integrations/anthropic/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.anthropic.generator", 6 | "haystack_integrations.components.generators.anthropic.chat.chat_generator", 7 | "haystack_integrations.components.generators.anthropic.chat.vertex_chat_generator", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Anthropic integration for Haystack 21 | category_slug: integrations-api 22 | title: Anthropic 23 | slug: integrations-anthropic 24 | order: 23 25 | markdown: 26 | descriptive_class_title: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_anthropic.md 31 | -------------------------------------------------------------------------------- /integrations/anthropic/src/haystack_integrations/components/generators/anthropic/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .chat.chat_generator import AnthropicChatGenerator 5 | from .chat.vertex_chat_generator import AnthropicVertexChatGenerator 6 | from .generator import AnthropicGenerator 7 | 8 | __all__ = ["AnthropicChatGenerator", "AnthropicGenerator", "AnthropicVertexChatGenerator"] 9 | -------------------------------------------------------------------------------- /integrations/anthropic/src/haystack_integrations/components/generators/anthropic/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/anthropic/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/anthropic/tests/conftest.py: -------------------------------------------------------------------------------- 1 | from unittest.mock import patch 2 | 3 | import pytest 4 | from anthropic.types import Message 5 | 6 | 7 | @pytest.fixture 8 | def mock_chat_completion(): 9 | """ 10 | Mock the OpenAI API completion response and reuse it for tests 11 | """ 12 | with patch("anthropic.resources.messages.Messages.create") as mock_chat_completion_create: 13 | completion = Message( 14 | id="foo", 15 | content=[{"type": "text", "text": "Hello, world!"}], 16 | model="claude-3-sonnet-20240229", 17 | role="assistant", 18 | type="message", 19 | usage={"input_tokens": 57, "output_tokens": 40}, 20 | ) 21 | 22 | mock_chat_completion_create.return_value = completion 23 | yield mock_chat_completion_create 24 | 25 | 26 | @pytest.fixture 27 | def mock_chat_completion_extended_thinking(): 28 | """ 29 | Mock the OpenAI API completion response and reuse it for tests 30 | """ 31 | with patch("anthropic.resources.messages.Messages.create") as mock_chat_completion_create: 32 | completion = Message( 33 | id="foo", 34 | content=[ 35 | {"type": "thinking", "thinking": "This is a thinking part!", "signature": ""}, 36 | {"type": "text", "text": "Hello, world!"}, 37 | ], 38 | model="claude-3-sonnet-20240229", 39 | role="assistant", 40 | type="message", 41 | usage={"input_tokens": 57, "output_tokens": 40}, 42 | ) 43 | 44 | mock_chat_completion_create.return_value = completion 45 | yield mock_chat_completion_create 46 | -------------------------------------------------------------------------------- /integrations/astra/examples/requirements.txt: -------------------------------------------------------------------------------- 1 | haystack-ai 2 | sentence_transformers==2.2.2 3 | openai==1.6.1 4 | astrapy>=1.5.0,<2.0 5 | -------------------------------------------------------------------------------- /integrations/astra/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.astra.retriever", 6 | "haystack_integrations.document_stores.astra.document_store", 7 | "haystack_integrations.document_stores.astra.errors", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Astra integration for Haystack 21 | category_slug: integrations-api 22 | title: Astra 23 | slug: integrations-astra 24 | order: 30 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_astra.md -------------------------------------------------------------------------------- /integrations/astra/src/haystack_integrations/components/retrievers/astra/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Anant Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .retriever import AstraEmbeddingRetriever 5 | 6 | __all__ = ["AstraEmbeddingRetriever"] 7 | -------------------------------------------------------------------------------- /integrations/astra/src/haystack_integrations/document_stores/astra/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Anant Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import AstraDocumentStore 5 | 6 | __all__ = ["AstraDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/astra/src/haystack_integrations/document_stores/astra/errors.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Anant Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from haystack.document_stores.errors import DocumentStoreError 5 | from haystack.errors import FilterError 6 | 7 | 8 | class AstraDocumentStoreError(DocumentStoreError): 9 | """Parent class for all AstraDocumentStore errors.""" 10 | 11 | pass 12 | 13 | 14 | class AstraDocumentStoreFilterError(FilterError): 15 | """Raised when an invalid filter is passed to AstraDocumentStore.""" 16 | 17 | pass 18 | 19 | 20 | class AstraDocumentStoreConfigError(AstraDocumentStoreError): 21 | """Raised when an invalid configuration is passed to AstraDocumentStore.""" 22 | 23 | pass 24 | -------------------------------------------------------------------------------- /integrations/astra/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present Anant Corporation 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/astra/tests/test_embedding_retrieval.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import pytest 4 | from haystack import Document 5 | from haystack.document_stores.types import DuplicatePolicy 6 | 7 | from haystack_integrations.document_stores.astra import AstraDocumentStore 8 | 9 | 10 | @pytest.mark.integration 11 | @pytest.mark.skipif( 12 | os.environ.get("ASTRA_DB_APPLICATION_TOKEN", "") == "", reason="ASTRA_DB_APPLICATION_TOKEN env var not set" 13 | ) 14 | @pytest.mark.skipif(os.environ.get("ASTRA_DB_API_ENDPOINT", "") == "", reason="ASTRA_DB_API_ENDPOINT env var not set") 15 | class TestEmbeddingRetrieval: 16 | @pytest.fixture 17 | def document_store(self) -> AstraDocumentStore: 18 | return AstraDocumentStore( 19 | collection_name="haystack_integration", 20 | duplicates_policy=DuplicatePolicy.OVERWRITE, 21 | embedding_dimension=768, 22 | ) 23 | 24 | @pytest.fixture(autouse=True) 25 | def run_before_and_after_tests(self, document_store: AstraDocumentStore): 26 | """ 27 | Cleaning up document store 28 | """ 29 | document_store.delete_documents(delete_all=True) 30 | assert document_store.count_documents() == 0 31 | 32 | def test_search_with_top_k(self, document_store): 33 | query_embedding = [0.1] * 768 34 | common_embedding = [0.8] * 768 35 | 36 | documents = [Document(content=f"This is document number {i}", embedding=common_embedding) for i in range(0, 3)] 37 | 38 | document_store.write_documents(documents) 39 | 40 | top_k = 2 41 | 42 | result = document_store.search(query_embedding, top_k) 43 | 44 | assert top_k == len(result) 45 | 46 | for document in result: 47 | assert document.score is not None 48 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/README.md: -------------------------------------------------------------------------------- 1 | # Azure AI Search Document Store for Haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/azure-ai-search-haystack.svg)](https://pypi.org/project/azure-ai-search-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/azure-ai-search-haystack.svg)](https://pypi.org/project/azure-ai-search-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Azure AI Search Document Store for Haystack](#azure-ai-search-document-store-for-haystack) 11 | - [Installation](#installation) 12 | - [Examples](#examples) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install azure-ai-search-haystack 19 | ``` 20 | 21 | ## Examples 22 | Refer to the documentation for code examples on utilizing the Document Store and its associated Retrievers. For more usage scenarios, check out the [examples](https://github.com/deepset-ai/haystack-core-integrations/tree/main/integrations/azure_ai_search/example). 23 | 24 | ## License 25 | 26 | `azure-ai-search-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 27 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/example/document_store.py: -------------------------------------------------------------------------------- 1 | from haystack import Document 2 | 3 | from haystack_integrations.document_stores.azure_ai_search import AzureAISearchDocumentStore 4 | 5 | """ 6 | This example demonstrates how to use the AzureAISearchDocumentStore to write and filter documents. 7 | To run this example, you'll need an Azure Search service endpoint and API key, which can either be 8 | set as environment variables (AZURE_AI_SEARCH_ENDPOINT and AZURE_AI_SEARCH_API_KEY) or 9 | provided directly to AzureAISearchDocumentStore(as params "api_key", "azure_endpoint"). 10 | Otherwise you can use DefaultAzureCredential to authenticate with Azure services. 11 | See more details at https://learn.microsoft.com/en-us/azure/search/keyless-connections?tabs=python%2Cazure-cli 12 | """ 13 | document_store = AzureAISearchDocumentStore( 14 | metadata_fields={"version": float, "label": str}, 15 | index_name="document-store-example", 16 | ) 17 | 18 | documents = [ 19 | Document( 20 | content="This is an introduction to using Python for data analysis.", 21 | meta={"version": 1.0, "label": "chapter_one"}, 22 | ), 23 | Document( 24 | content="Learn how to use Python libraries for machine learning.", 25 | meta={"version": 1.5, "label": "chapter_two"}, 26 | ), 27 | Document( 28 | content="Advanced Python techniques for data visualization.", 29 | meta={"version": 2.0, "label": "chapter_three"}, 30 | ), 31 | ] 32 | document_store.write_documents(documents) 33 | 34 | filters = { 35 | "operator": "AND", 36 | "conditions": [ 37 | {"field": "meta.version", "operator": ">", "value": 1.2}, 38 | {"field": "meta.label", "operator": "in", "value": ["chapter_one", "chapter_three"]}, 39 | ], 40 | } 41 | 42 | results = document_store.filter_documents(filters) 43 | print(results) 44 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.azure_ai_search.embedding_retriever", 6 | "haystack_integrations.document_stores.azure_ai_search.document_store", 7 | "haystack_integrations.document_stores.azure_ai_search.filters", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Azure AI Search integration for Haystack 21 | category_slug: integrations-api 22 | title: Azure AI Search 23 | slug: integrations-azure_ai_search 24 | order: 180 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_azure_ai_search.md 32 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/src/haystack_integrations/components/retrievers/azure_ai_search/__init__.py: -------------------------------------------------------------------------------- 1 | from .bm25_retriever import AzureAISearchBM25Retriever 2 | from .embedding_retriever import AzureAISearchEmbeddingRetriever 3 | from .hybrid_retriever import AzureAISearchHybridRetriever 4 | 5 | __all__ = ["AzureAISearchBM25Retriever", "AzureAISearchEmbeddingRetriever", "AzureAISearchHybridRetriever"] 6 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import DEFAULT_VECTOR_SEARCH, AzureAISearchDocumentStore 5 | from .filters import _normalize_filters 6 | 7 | __all__ = ["DEFAULT_VECTOR_SEARCH", "AzureAISearchDocumentStore", "_normalize_filters"] 8 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/src/haystack_integrations/document_stores/azure_ai_search/errors.py: -------------------------------------------------------------------------------- 1 | from haystack.document_stores.errors import DocumentStoreError 2 | from haystack.errors import FilterError 3 | 4 | 5 | class AzureAISearchDocumentStoreError(DocumentStoreError): 6 | """Parent class for all AzureAISearchDocumentStore exceptions.""" 7 | 8 | pass 9 | 10 | 11 | class AzureAISearchDocumentStoreConfigError(AzureAISearchDocumentStoreError): 12 | """Raised when a configuration is not valid for a AzureAISearchDocumentStore.""" 13 | 14 | pass 15 | 16 | 17 | class AzureAISearchDocumentStoreFilterError(FilterError): 18 | """Raised when filter is not valid for AzureAISearchDocumentStore.""" 19 | 20 | pass 21 | -------------------------------------------------------------------------------- /integrations/azure_ai_search/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/chroma/README.md: -------------------------------------------------------------------------------- 1 | # Chroma Document Store for Haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/chroma-haystack.svg)](https://pypi.org/project/chroma-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chroma-haystack.svg)](https://pypi.org/project/chroma-haystack) 5 | [![test](https://github.com/masci/chroma-haystack/actions/workflows/test.yml/badge.svg)](https://github.com/masci/chroma-haystack/actions/workflows/test.yml) 6 | 7 | ----- 8 | 9 | **Table of Contents** 10 | 11 | - [Chroma Document Store for Haystack](#chroma-document-store-for-haystack) 12 | - [Installation](#installation) 13 | - [Examples](#examples) 14 | - [License](#license) 15 | 16 | ## Installation 17 | 18 | ```console 19 | pip install chroma-haystack 20 | ``` 21 | 22 | ## Examples 23 | You can find a code example showing how to use the Document Store and the Retriever under the `example/` folder of this repo or in [this Colab](https://colab.research.google.com/drive/1YpDetI8BRbObPDEVdfqUcwhEX9UUXP-m?usp=sharing). 24 | 25 | ## License 26 | 27 | `chroma-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 28 | -------------------------------------------------------------------------------- /integrations/chroma/example/example.py: -------------------------------------------------------------------------------- 1 | # Colab: https://colab.research.google.com/drive/1YpDetI8BRbObPDEVdfqUcwhEX9UUXP-m?usp=sharing 2 | 3 | import os 4 | from pathlib import Path 5 | 6 | from haystack import Pipeline 7 | from haystack.components.converters import TextFileToDocument 8 | from haystack.components.writers import DocumentWriter 9 | 10 | from haystack_integrations.components.retrievers.chroma import ChromaQueryTextRetriever 11 | from haystack_integrations.document_stores.chroma import ChromaDocumentStore 12 | 13 | # Chroma is used in-memory so we use the same instances in the two pipelines below 14 | document_store = ChromaDocumentStore() 15 | 16 | HERE = Path(__file__).resolve().parent 17 | file_paths = [HERE / "data" / Path(name) for name in os.listdir("data")] 18 | 19 | 20 | indexing = Pipeline() 21 | indexing.add_component("converter", TextFileToDocument()) 22 | indexing.add_component("writer", DocumentWriter(document_store)) 23 | indexing.connect("converter", "writer") 24 | indexing.run({"converter": {"sources": file_paths}}) 25 | 26 | querying = Pipeline() 27 | querying.add_component("retriever", ChromaQueryTextRetriever(document_store)) 28 | results = querying.run({"retriever": {"query": "Variable declarations", "top_k": 3}}) 29 | 30 | for d in results["retriever"]["documents"]: 31 | print(d.meta, d.score) 32 | -------------------------------------------------------------------------------- /integrations/chroma/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.chroma.retriever", 6 | "haystack_integrations.document_stores.chroma.document_store", 7 | "haystack_integrations.document_stores.chroma.errors", 8 | "haystack_integrations.document_stores.chroma.utils", 9 | ] 10 | ignore_when_discovered: ["__init__"] 11 | processors: 12 | - type: filter 13 | expression: 14 | documented_only: true 15 | do_not_filter_modules: false 16 | skip_empty_modules: true 17 | - type: smart 18 | - type: crossref 19 | renderer: 20 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 21 | excerpt: Chroma integration for Haystack 22 | category_slug: integrations-api 23 | title: Chroma 24 | slug: integrations-chroma 25 | order: 40 26 | markdown: 27 | descriptive_class_title: false 28 | classdef_code_block: false 29 | descriptive_module_title: true 30 | add_method_class_prefix: true 31 | add_member_class_prefix: false 32 | filename: _readme_chroma.md 33 | -------------------------------------------------------------------------------- /integrations/chroma/src/haystack_integrations/components/retrievers/chroma/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .retriever import ChromaEmbeddingRetriever, ChromaQueryTextRetriever 6 | 7 | __all__ = ["ChromaEmbeddingRetriever", "ChromaQueryTextRetriever"] 8 | -------------------------------------------------------------------------------- /integrations/chroma/src/haystack_integrations/document_stores/chroma/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .document_store import ChromaDocumentStore 6 | 7 | __all__ = ["ChromaDocumentStore"] 8 | -------------------------------------------------------------------------------- /integrations/chroma/src/haystack_integrations/document_stores/chroma/errors.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from haystack.document_stores.errors import DocumentStoreError 6 | from haystack.errors import FilterError 7 | 8 | 9 | class ChromaDocumentStoreError(DocumentStoreError): 10 | """Parent class for all ChromaDocumentStore exceptions.""" 11 | 12 | pass 13 | 14 | 15 | class ChromaDocumentStoreFilterError(FilterError, ValueError): 16 | """Raised when a filter is not valid for a ChromaDocumentStore.""" 17 | 18 | pass 19 | 20 | 21 | class ChromaDocumentStoreConfigError(ChromaDocumentStoreError): 22 | """Raised when a configuration is not valid for a ChromaDocumentStore.""" 23 | 24 | pass 25 | -------------------------------------------------------------------------------- /integrations/chroma/src/haystack_integrations/document_stores/chroma/utils.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from chromadb.api.types import EmbeddingFunction 6 | from chromadb.utils.embedding_functions import ( 7 | CohereEmbeddingFunction, 8 | DefaultEmbeddingFunction, 9 | GooglePalmEmbeddingFunction, 10 | GoogleVertexEmbeddingFunction, 11 | HuggingFaceEmbeddingFunction, 12 | InstructorEmbeddingFunction, 13 | OllamaEmbeddingFunction, 14 | ONNXMiniLM_L6_V2, 15 | OpenAIEmbeddingFunction, 16 | SentenceTransformerEmbeddingFunction, 17 | Text2VecEmbeddingFunction, 18 | ) 19 | 20 | from .errors import ChromaDocumentStoreConfigError 21 | 22 | FUNCTION_REGISTRY = { 23 | "default": DefaultEmbeddingFunction, 24 | "SentenceTransformerEmbeddingFunction": SentenceTransformerEmbeddingFunction, 25 | "CohereEmbeddingFunction": CohereEmbeddingFunction, 26 | "GooglePalmEmbeddingFunction": GooglePalmEmbeddingFunction, 27 | "GoogleVertexEmbeddingFunction": GoogleVertexEmbeddingFunction, 28 | "HuggingFaceEmbeddingFunction": HuggingFaceEmbeddingFunction, 29 | "InstructorEmbeddingFunction": InstructorEmbeddingFunction, 30 | "OllamaEmbeddingFunction": OllamaEmbeddingFunction, 31 | "ONNXMiniLM_L6_V2": ONNXMiniLM_L6_V2, 32 | "OpenAIEmbeddingFunction": OpenAIEmbeddingFunction, 33 | "Text2VecEmbeddingFunction": Text2VecEmbeddingFunction, 34 | } 35 | 36 | 37 | def get_embedding_function(function_name: str, **kwargs) -> EmbeddingFunction: 38 | """Load an embedding function by name. 39 | 40 | :param function_name: the name of the embedding function. 41 | :param kwargs: additional arguments to pass to the embedding function. 42 | :returns: the loaded embedding function. 43 | :raises ChromaDocumentStoreConfigError: if the function name is invalid. 44 | """ 45 | try: 46 | return FUNCTION_REGISTRY[function_name](**kwargs) 47 | except KeyError: 48 | msg = f"Invalid function name: {function_name}" 49 | raise ChromaDocumentStoreConfigError(msg) from KeyError 50 | -------------------------------------------------------------------------------- /integrations/chroma/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/cohere/README.md: -------------------------------------------------------------------------------- 1 | # cohere-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/cohere-haystack.svg)](https://pypi.org/project/cohere-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/cohere-haystack.svg)](https://pypi.org/project/cohere-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [cohere-haystack](#cohere-haystack) 11 | - [Installation](#installation) 12 | - [Contributing](#contributing) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install cohere-haystack 19 | ``` 20 | 21 | ## Contributing 22 | 23 | `hatch` is the best way to interact with this project, to install it: 24 | ```sh 25 | pip install hatch 26 | ``` 27 | 28 | With `hatch` installed, to run all the tests: 29 | ``` 30 | hatch run test 31 | ``` 32 | > Note: integration tests will be skipped unless the env var COHERE_API_KEY is set. The api key needs to be valid 33 | > in order to pass the tests. 34 | 35 | To only run unit tests: 36 | ``` 37 | hatch run test -m"not integration" 38 | ``` 39 | 40 | To only run embedders tests: 41 | ``` 42 | hatch run test -m"embedders" 43 | ``` 44 | 45 | To only run generators tests: 46 | ``` 47 | hatch run test -m"generators" 48 | ``` 49 | 50 | To only run ranker tests: 51 | ``` 52 | hatch run test -m"ranker" 53 | ``` 54 | 55 | Markers can be combined, for example you can run only integration tests for embedders with: 56 | ``` 57 | hatch run test -m"integrations and embedders" 58 | ``` 59 | 60 | To run the linters `ruff` and `mypy`: 61 | ``` 62 | hatch run lint:all 63 | ``` 64 | 65 | ## License 66 | 67 | `cohere-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 68 | -------------------------------------------------------------------------------- /integrations/cohere/examples/cohere_embedding.py: -------------------------------------------------------------------------------- 1 | from haystack import Document, Pipeline 2 | from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever 3 | from haystack.document_stores.in_memory import InMemoryDocumentStore 4 | 5 | from haystack_integrations.components.embedders.cohere.document_embedder import CohereDocumentEmbedder 6 | from haystack_integrations.components.embedders.cohere.text_embedder import CohereTextEmbedder 7 | 8 | document_store = InMemoryDocumentStore(embedding_similarity_function="cosine") 9 | 10 | documents = [ 11 | Document(content="My name is Wolfgang and I live in Berlin"), 12 | Document(content="I saw a black horse running"), 13 | Document(content="Germany has many big cities"), 14 | ] 15 | 16 | document_embedder = CohereDocumentEmbedder() 17 | documents_with_embeddings = document_embedder.run(documents)["documents"] 18 | document_store.write_documents(documents_with_embeddings) 19 | 20 | query_pipeline = Pipeline() 21 | query_pipeline.add_component("text_embedder", CohereTextEmbedder()) 22 | query_pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store)) 23 | query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding") 24 | 25 | query = "Who lives in Berlin?" 26 | 27 | result = query_pipeline.run({"text_embedder": {"text": query}}) 28 | 29 | print(result["retriever"]["documents"][0]) # noqa: T201 30 | -------------------------------------------------------------------------------- /integrations/cohere/examples/cohere_ranker.py: -------------------------------------------------------------------------------- 1 | from haystack import Document, Pipeline 2 | from haystack.components.retrievers.in_memory import InMemoryBM25Retriever 3 | from haystack.document_stores.in_memory import InMemoryDocumentStore 4 | 5 | from haystack_integrations.components.rankers.cohere import CohereRanker 6 | 7 | # Note set your API key by running the below command in your terminal 8 | # export CO_API_KEY="" 9 | 10 | docs = [ 11 | Document(content="Paris is in France"), 12 | Document(content="Berlin is in Germany"), 13 | Document(content="Lyon is in France"), 14 | ] 15 | document_store = InMemoryDocumentStore() 16 | document_store.write_documents(docs) 17 | 18 | retriever = InMemoryBM25Retriever(document_store=document_store) 19 | ranker = CohereRanker(model="rerank-english-v2.0") 20 | 21 | document_ranker_pipeline = Pipeline() 22 | document_ranker_pipeline.add_component(instance=retriever, name="retriever") 23 | document_ranker_pipeline.add_component(instance=ranker, name="ranker") 24 | 25 | document_ranker_pipeline.connect("retriever.documents", "ranker.documents") 26 | 27 | query = "Cities in France" 28 | res = document_ranker_pipeline.run(data={"retriever": {"query": query}, "ranker": {"query": query, "top_k": 2}}) 29 | print(res["ranker"]["documents"]) # noqa: T201 30 | -------------------------------------------------------------------------------- /integrations/cohere/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.embedders.cohere.document_embedder", 6 | "haystack_integrations.components.embedders.cohere.text_embedder", 7 | "haystack_integrations.components.embedders.cohere.utils", 8 | "haystack_integrations.components.generators.cohere.generator", 9 | "haystack_integrations.components.generators.cohere.chat.chat_generator", 10 | "haystack_integrations.components.rankers.cohere.ranker", 11 | ] 12 | ignore_when_discovered: ["__init__"] 13 | processors: 14 | - type: filter 15 | expression: 16 | documented_only: true 17 | do_not_filter_modules: false 18 | skip_empty_modules: true 19 | - type: smart 20 | - type: crossref 21 | renderer: 22 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 23 | excerpt: Cohere integration for Haystack 24 | category_slug: integrations-api 25 | title: Cohere 26 | slug: integrations-cohere 27 | order: 50 28 | markdown: 29 | descriptive_class_title: false 30 | classdef_code_block: false 31 | descriptive_module_title: true 32 | add_method_class_prefix: true 33 | add_member_class_prefix: false 34 | filename: _readme_cohere.md 35 | -------------------------------------------------------------------------------- /integrations/cohere/src/haystack_integrations/components/embedders/cohere/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import CohereDocumentEmbedder 5 | from .text_embedder import CohereTextEmbedder 6 | 7 | __all__ = ["CohereDocumentEmbedder", "CohereTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/cohere/src/haystack_integrations/components/embedders/cohere/embedding_types.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from enum import Enum 5 | 6 | 7 | class EmbeddingTypes(Enum): 8 | """ 9 | Supported types for Cohere embeddings. 10 | 11 | FLOAT: Default float embeddings. Valid for all models. 12 | INT8: Signed int8 embeddings. Valid for only v3 models. 13 | UINT8: Unsigned int8 embeddings. Valid for only v3 models. 14 | BINARY: Signed binary embeddings. Valid for only v3 models. 15 | UBINARY: Unsigned binary embeddings. Valid for only v3 models. 16 | """ 17 | 18 | FLOAT = "float" 19 | INT8 = "int8" 20 | UINT8 = "uint8" 21 | BINARY = "binary" 22 | UBINARY = "ubinary" 23 | 24 | def __str__(self): 25 | return self.value 26 | 27 | @staticmethod 28 | def from_str(string: str) -> "EmbeddingTypes": 29 | """ 30 | Convert a string to an EmbeddingTypes enum. 31 | """ 32 | enum_map = {e.value: e for e in EmbeddingTypes} 33 | embedding_type = enum_map.get(string.lower()) 34 | if embedding_type is None: 35 | msg = f"Unknown embedding type '{string}'. Supported types are: {list(enum_map.keys())}" 36 | raise ValueError(msg) 37 | return embedding_type 38 | -------------------------------------------------------------------------------- /integrations/cohere/src/haystack_integrations/components/generators/cohere/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .chat.chat_generator import CohereChatGenerator 5 | from .generator import CohereGenerator 6 | 7 | __all__ = ["CohereChatGenerator", "CohereGenerator"] 8 | -------------------------------------------------------------------------------- /integrations/cohere/src/haystack_integrations/components/generators/cohere/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/cohere/src/haystack_integrations/components/rankers/cohere/__init__.py: -------------------------------------------------------------------------------- 1 | from .ranker import CohereRanker 2 | 3 | __all__ = ["CohereRanker"] 4 | -------------------------------------------------------------------------------- /integrations/cohere/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/deepeval/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/deepeval-v0.1.3] - 2025-05-27 4 | 5 | ### 🧪 Testing 6 | 7 | - Skip tests that require credentials on PRs from forks for some integrations (#1485) 8 | 9 | ### ⚙️ CI 10 | 11 | - Review testing workflows (#1541) 12 | 13 | ### 🧹 Chores 14 | 15 | - Remove Python 3.8 support (#1421) 16 | 17 | ### 🌀 Miscellaneous 18 | 19 | - Remove pin for Deepeval (#1826) 20 | 21 | ## [integrations/deepeval-v0.1.2] - 2024-11-14 22 | 23 | ### 🚀 Features 24 | 25 | - Implement `DeepEvalEvaluator` (#346) 26 | 27 | ### 🐛 Bug Fixes 28 | 29 | - Fix order of API docs (#447) 30 | - Deepeval - pin indirect dependencies based on python version (#1187) 31 | 32 | ### 📚 Documentation 33 | 34 | - Update paths and titles (#397) 35 | - Update category slug (#442) 36 | - Update `deepeval-haystack` docstrings (#527) 37 | - Disable-class-def (#556) 38 | 39 | ### 🧪 Testing 40 | 41 | - Do not retry tests in `hatch run test` command (#954) 42 | 43 | ### ⚙️ CI 44 | 45 | - Retry tests to reduce flakyness (#836) 46 | - Adopt uv as installer (#1142) 47 | 48 | ### 🧹 Chores 49 | 50 | - Exculde evaluator private classes in API docs (#392) 51 | - Update ruff invocation to include check parameter (#853) 52 | - Update ruff linting scripts and settings (#1105) 53 | 54 | ### 🌀 Miscellaneous 55 | 56 | - Pin deepeval version (#473) 57 | - Make tests show coverage (#566) 58 | - Refactor tests (#574) 59 | - Remove references to Python 3.7 (#601) 60 | - Chore: add license classifiers (#680) 61 | - Chore: change the pydoc renderer class (#718) 62 | - Ci: install `pytest-rerunfailures` where needed; add retry config to `test-cov` script (#845) 63 | 64 | 65 | -------------------------------------------------------------------------------- /integrations/deepeval/README.md: -------------------------------------------------------------------------------- 1 | # deepeval-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/deepeval-haystack.svg)](https://pypi.org/project/deepeval-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/deepeval-haystack.svg)](https://pypi.org/project/deepeval-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [deepeval-haystack](#deepeval-haystack) 11 | - [Installation](#installation) 12 | - [Testing](#testing) 13 | - [Examples](#examples) 14 | - [License](#license) 15 | 16 | ## Installation 17 | 18 | ```console 19 | pip install deepeval-haystack 20 | ``` 21 | 22 | For more information about the deepeval evaluation framework, please refer to their [documentation](https://docs.confident-ai.com/docs/evaluation-introduction). 23 | 24 | ## Testing 25 | 26 | ```console 27 | hatch run test 28 | ``` 29 | 30 | ## Examples 31 | 32 | You can find a code example showing how to use the Evaluator under the `example/` folder of this repo. 33 | 34 | ## License 35 | 36 | `deepeval-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 37 | -------------------------------------------------------------------------------- /integrations/deepeval/example/example.py: -------------------------------------------------------------------------------- 1 | # A valid OpenAI API key is required to run this example. 2 | 3 | from haystack import Pipeline 4 | 5 | from haystack_integrations.components.evaluators.deepeval import DeepEvalEvaluator, DeepEvalMetric 6 | 7 | QUESTIONS = [ 8 | "Which is the most popular global sport?", 9 | "Who created the Python language?", 10 | ] 11 | CONTEXTS = [ 12 | [ 13 | "The popularity of sports can be measured in various ways, including TV viewership, social media presence, number of participants, and economic impact.", 14 | "Football is undoubtedly the world's most popular sport with major events like the FIFA World Cup and sports personalities like Ronaldo and Messi, drawing a followership of more than 4 billion people.", 15 | ], 16 | [ 17 | "Python, created by Guido van Rossum in the late 1980s, is a high-level general-purpose programming language.", 18 | "Its design philosophy emphasizes code readability, and its language constructs aim to help programmers write clear, logical code for both small and large-scale software projects.", 19 | ], 20 | ] 21 | RESPONSES = [ 22 | "Football is the most popular sport with around 4 billion followers worldwide", 23 | "Python language was created by Guido van Rossum.", 24 | ] 25 | 26 | pipeline = Pipeline() 27 | evaluator = DeepEvalEvaluator( 28 | metric=DeepEvalMetric.FAITHFULNESS, 29 | metric_params={"model": "gpt-4"}, 30 | ) 31 | pipeline.add_component("evaluator", evaluator) 32 | 33 | # Each metric expects a specific set of parameters as input. Refer to the 34 | # DeepEvalMetric class' documentation for more details. 35 | results = pipeline.run({"evaluator": {"questions": QUESTIONS, "contexts": CONTEXTS, "responses": RESPONSES}}) 36 | 37 | for output in results["evaluator"]["results"]: 38 | print(output) 39 | -------------------------------------------------------------------------------- /integrations/deepeval/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.evaluators.deepeval.evaluator", 7 | "haystack_integrations.components.evaluators.deepeval.metrics", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: filter 17 | expression: "name not in ['MetricResult', 'MetricDescriptor', 'OutputConverters', 'InputConverters', 'METRIC_DESCRIPTORS']" 18 | - type: smart 19 | - type: crossref 20 | renderer: 21 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 22 | excerpt: DeepEval integration for Haystack 23 | category_slug: integrations-api 24 | title: DeepEval 25 | slug: integrations-deepeval 26 | order: 60 27 | markdown: 28 | descriptive_class_title: false 29 | classdef_code_block: false 30 | descriptive_module_title: true 31 | add_method_class_prefix: true 32 | add_member_class_prefix: false 33 | filename: _readme_deepeval.md 34 | -------------------------------------------------------------------------------- /integrations/deepeval/src/haystack_integrations/components/evaluators/deepeval/__init__.py: -------------------------------------------------------------------------------- 1 | from .evaluator import DeepEvalEvaluator 2 | from .metrics import DeepEvalMetric 3 | 4 | __all__ = ( 5 | "DeepEvalEvaluator", 6 | "DeepEvalMetric", 7 | ) 8 | -------------------------------------------------------------------------------- /integrations/deepeval/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/deepeval/tests/__init__.py -------------------------------------------------------------------------------- /integrations/deepeval/tests/test_metrics.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from haystack_integrations.components.evaluators.deepeval import DeepEvalMetric 4 | 5 | 6 | def test_deepeval_metric(): 7 | for e in DeepEvalMetric: 8 | assert e == DeepEvalMetric.from_str(e.value) 9 | 10 | with pytest.raises(ValueError, match="Unknown DeepEval metric"): 11 | DeepEvalMetric.from_str("smugness") 12 | -------------------------------------------------------------------------------- /integrations/elasticsearch/README.md: -------------------------------------------------------------------------------- 1 | [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/elasticsearch.yml) 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/elasticsearch-haystack.svg)](https://pypi.org/project/elasticsearch-haystack) 5 | 6 | # Elasticsearch Document Store 7 | 8 | Document Store for Haystack 2.x, supports ElasticSearch 8. 9 | 10 | ## Installation 11 | 12 | ```console 13 | pip install elasticsearch-haystack 14 | ``` 15 | 16 | ## Testing 17 | 18 | To run tests first start a Docker container running ElasticSearch. We provide a utility `docker-compose.yml` for that: 19 | 20 | ```console 21 | docker-compose up 22 | ``` 23 | 24 | Then run tests: 25 | 26 | ```console 27 | hatch run test 28 | ``` 29 | 30 | ## License 31 | 32 | `elasticsearch-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 33 | -------------------------------------------------------------------------------- /integrations/elasticsearch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | elasticsearch: 3 | image: "docker.elastic.co/elasticsearch/elasticsearch:8.11.1" 4 | ports: 5 | - 9200:9200 6 | restart: on-failure 7 | environment: 8 | - discovery.type=single-node 9 | - xpack.security.enabled=false 10 | - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m" 11 | healthcheck: 12 | test: curl --fail http://localhost:9200/_cat/health || exit 1 13 | interval: 10s 14 | timeout: 1s 15 | retries: 10 -------------------------------------------------------------------------------- /integrations/elasticsearch/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.elasticsearch.bm25_retriever", 6 | "haystack_integrations.components.retrievers.elasticsearch.embedding_retriever", 7 | "haystack_integrations.document_stores.elasticsearch.document_store", 8 | "haystack_integrations.document_stores.elasticsearch.filters", 9 | ] 10 | ignore_when_discovered: ["__init__"] 11 | processors: 12 | - type: filter 13 | expression: 14 | documented_only: true 15 | do_not_filter_modules: false 16 | skip_empty_modules: true 17 | - type: smart 18 | - type: crossref 19 | renderer: 20 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 21 | excerpt: Elasticsearch integration for Haystack 22 | category_slug: integrations-api 23 | title: Elasticsearch 24 | slug: integrations-elasticsearch 25 | order: 70 26 | markdown: 27 | descriptive_class_title: false 28 | classdef_code_block: false 29 | descriptive_module_title: true 30 | add_method_class_prefix: true 31 | add_member_class_prefix: false 32 | filename: _readme_elasticsearch.md -------------------------------------------------------------------------------- /integrations/elasticsearch/src/haystack_integrations/components/retrievers/elasticsearch/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .bm25_retriever import ElasticsearchBM25Retriever 5 | from .embedding_retriever import ElasticsearchEmbeddingRetriever 6 | 7 | __all__ = ["ElasticsearchBM25Retriever", "ElasticsearchEmbeddingRetriever"] 8 | -------------------------------------------------------------------------------- /integrations/elasticsearch/src/haystack_integrations/document_stores/elasticsearch/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import ElasticsearchDocumentStore 5 | 6 | __all__ = ["ElasticsearchDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/elasticsearch/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/fastembed/examples/example.py: -------------------------------------------------------------------------------- 1 | from haystack import Document, Pipeline 2 | from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever 3 | from haystack.document_stores.in_memory import InMemoryDocumentStore 4 | 5 | from haystack_integrations.components.embedders.fastembed import FastembedDocumentEmbedder, FastembedTextEmbedder 6 | 7 | document_store = InMemoryDocumentStore(embedding_similarity_function="cosine") 8 | 9 | documents = [ 10 | Document(content="My name is Wolfgang and I live in Berlin"), 11 | Document(content="I saw a black horse running"), 12 | Document(content="Germany has many big cities"), 13 | Document(content="fastembed is supported by and maintained by Qdrant."), 14 | ] 15 | 16 | document_embedder = FastembedDocumentEmbedder() 17 | document_embedder.warm_up() 18 | documents_with_embeddings = document_embedder.run(documents)["documents"] 19 | document_store.write_documents(documents_with_embeddings) 20 | 21 | query_pipeline = Pipeline() 22 | query_pipeline.add_component("text_embedder", FastembedTextEmbedder()) 23 | query_pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store)) 24 | query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding") 25 | 26 | query = "Who supports fastembed?" 27 | 28 | result = query_pipeline.run({"text_embedder": {"text": query}}) 29 | 30 | print(result["retriever"]["documents"][0]) 31 | 32 | # Document(id=..., 33 | # content: 'fastembed is supported by and maintained by Qdrant.', 34 | # score: 0.758..) 35 | -------------------------------------------------------------------------------- /integrations/fastembed/examples/ranker_example.py: -------------------------------------------------------------------------------- 1 | from haystack import Document 2 | 3 | from haystack_integrations.components.rankers.fastembed import FastembedRanker 4 | 5 | query = "Who is maintaining Qdrant?" 6 | documents = [ 7 | Document( 8 | content="This is built to be faster and lighter than other embedding libraries e.g. Transformers, Sentence-Transformers, etc." 9 | ), 10 | Document(content="fastembed is supported by and maintained by Qdrant."), 11 | ] 12 | 13 | ranker = FastembedRanker(model_name="Xenova/ms-marco-MiniLM-L-6-v2") 14 | ranker.warm_up() 15 | reranked_documents = ranker.run(query=query, documents=documents)["documents"] 16 | 17 | 18 | print(reranked_documents[0]) 19 | 20 | # Document(id=..., 21 | # content: 'fastembed is supported by and maintained by Qdrant.', 22 | # score: 5.472434997558594..) 23 | -------------------------------------------------------------------------------- /integrations/fastembed/examples/sparse_example.py: -------------------------------------------------------------------------------- 1 | # Currently, this example shows how to use the FastembedSparseDocumentEmbedder component to embed a list of documents. 2 | 3 | # TODO: Once we have a proper SparseEmbeddingRetriever, we should replace this naive example with a more realistic one, 4 | # involving indexing and retrieval of documents. 5 | 6 | from haystack import Document 7 | 8 | from haystack_integrations.components.embedders.fastembed import FastembedSparseDocumentEmbedder 9 | 10 | document_list = [ 11 | Document( 12 | content="Oxidative stress generated within inflammatory joints can produce autoimmune phenomena and joint destruction. Radical species with oxidative activity, including reactive nitrogen species, represent mediators of inflammation and cartilage damage.", 13 | meta={ 14 | "pubid": "25,445,628", 15 | "long_answer": "yes", 16 | }, 17 | ), 18 | Document( 19 | content="Plasma levels of pancreatic polypeptide (PP) rise upon food intake. Although other pancreatic islet hormones, such as insulin and glucagon, have been extensively investigated, PP secretion and actions are still poorly understood.", 20 | meta={ 21 | "pubid": "25,445,712", 22 | "long_answer": "yes", 23 | }, 24 | ), 25 | ] 26 | 27 | document_embedder = FastembedSparseDocumentEmbedder() 28 | document_embedder.warm_up() 29 | documents_with_embeddings = document_embedder.run(document_list)["documents"] 30 | 31 | for doc in documents_with_embeddings: 32 | print(f"Document Text: {doc.content}") 33 | print(f"Document Sparse Embedding: {doc.sparse_embedding.to_dict()}") 34 | -------------------------------------------------------------------------------- /integrations/fastembed/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.embedders.fastembed.fastembed_document_embedder", 7 | "haystack_integrations.components.embedders.fastembed.fastembed_text_embedder", 8 | "haystack_integrations.components.embedders.fastembed.fastembed_sparse_document_embedder", 9 | "haystack_integrations.components.embedders.fastembed.fastembed_sparse_text_embedder", 10 | "haystack_integrations.components.rankers.fastembed.ranker" 11 | ] 12 | ignore_when_discovered: ["__init__"] 13 | processors: 14 | - type: filter 15 | expression: 16 | documented_only: true 17 | do_not_filter_modules: false 18 | skip_empty_modules: true 19 | - type: smart 20 | - type: crossref 21 | renderer: 22 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 23 | excerpt: FastEmbed integration for Haystack 24 | category_slug: integrations-api 25 | title: FastEmbed 26 | slug: fastembed-embedders 27 | order: 80 28 | markdown: 29 | descriptive_class_title: false 30 | classdef_code_block: false 31 | descriptive_module_title: true 32 | add_method_class_prefix: true 33 | add_member_class_prefix: false 34 | filename: _readme_fastembed.md 35 | -------------------------------------------------------------------------------- /integrations/fastembed/src/haystack_integrations/components/embedders/fastembed/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .fastembed_document_embedder import FastembedDocumentEmbedder 5 | from .fastembed_sparse_document_embedder import FastembedSparseDocumentEmbedder 6 | from .fastembed_sparse_text_embedder import FastembedSparseTextEmbedder 7 | from .fastembed_text_embedder import FastembedTextEmbedder 8 | 9 | __all__ = [ 10 | "FastembedDocumentEmbedder", 11 | "FastembedSparseDocumentEmbedder", 12 | "FastembedSparseTextEmbedder", 13 | "FastembedTextEmbedder", 14 | ] 15 | -------------------------------------------------------------------------------- /integrations/fastembed/src/haystack_integrations/components/embedders/fastembed/embedding_backend/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/fastembed/src/haystack_integrations/components/rankers/fastembed/__init__.py: -------------------------------------------------------------------------------- 1 | from .ranker import FastembedRanker 2 | 3 | __all__ = ["FastembedRanker"] 4 | -------------------------------------------------------------------------------- /integrations/fastembed/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/github/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/github-v1.0.0] - 2025-05-28 4 | 5 | ### 🚀 Features 6 | 7 | - Add GitHub integration with components, tools, and prompts (#1637) 8 | 9 | 10 | -------------------------------------------------------------------------------- /integrations/github/README.md: -------------------------------------------------------------------------------- 1 | # github-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/github-haystack.svg)](https://pypi.org/project/github-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/github-haystack.svg)](https://pypi.org/project/github-haystack) 5 | 6 | ----- 7 | 8 | ## Table of Contents 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install github-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `github-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | -------------------------------------------------------------------------------- /integrations/github/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.connectors.github.file_editor", 6 | "haystack_integrations.components.connectors.github.issue_commenter", 7 | "haystack_integrations.components.connectors.github.issue_viewer", 8 | "haystack_integrations.components.connectors.github.pr_creator", 9 | "haystack_integrations.components.connectors.github.repo_viewer", 10 | "haystack_integrations.components.connectors.github.repo_forker", 11 | ] 12 | ignore_when_discovered: ["__init__"] 13 | processors: 14 | - type: filter 15 | expression: 16 | documented_only: true 17 | do_not_filter_modules: false 18 | skip_empty_modules: true 19 | - type: smart 20 | - type: crossref 21 | renderer: 22 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 23 | excerpt: GitHub integration for Haystack 24 | category_slug: integrations-api 25 | title: GitHub 26 | slug: integrations-github 27 | order: 100 28 | markdown: 29 | descriptive_class_title: false 30 | classdef_code_block: false 31 | descriptive_module_title: true 32 | add_method_class_prefix: true 33 | add_member_class_prefix: false 34 | filename: _readme_github.md -------------------------------------------------------------------------------- /integrations/github/src/haystack_integrations/components/connectors/github/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .file_editor import Command, GitHubFileEditor 5 | from .issue_commenter import GitHubIssueCommenter 6 | from .issue_viewer import GitHubIssueViewer 7 | from .pr_creator import GitHubPRCreator 8 | from .repo_forker import GitHubRepoForker 9 | from .repo_viewer import GitHubRepoViewer 10 | 11 | __all__ = [ 12 | "Command", 13 | "GitHubFileEditor", 14 | "GitHubIssueCommenter", 15 | "GitHubIssueViewer", 16 | "GitHubPRCreator", 17 | "GitHubRepoForker", 18 | "GitHubRepoViewer", 19 | ] 20 | -------------------------------------------------------------------------------- /integrations/github/src/haystack_integrations/prompts/github/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .context_prompt import CONTEXT_PROMPT 5 | from .file_editor_prompt import FILE_EDITOR_PROMPT, FILE_EDITOR_SCHEMA 6 | from .issue_commenter_prompt import ISSUE_COMMENTER_PROMPT, ISSUE_COMMENTER_SCHEMA 7 | from .pr_creator_prompt import PR_CREATOR_PROMPT, PR_CREATOR_SCHEMA 8 | from .repo_viewer_prompt import REPO_VIEWER_PROMPT, REPO_VIEWER_SCHEMA 9 | from .system_prompt import SYSTEM_PROMPT 10 | 11 | __all__ = [ 12 | "CONTEXT_PROMPT", 13 | "FILE_EDITOR_PROMPT", 14 | "FILE_EDITOR_SCHEMA", 15 | "ISSUE_COMMENTER_PROMPT", 16 | "ISSUE_COMMENTER_SCHEMA", 17 | "PR_CREATOR_PROMPT", 18 | "PR_CREATOR_SCHEMA", 19 | "REPO_VIEWER_PROMPT", 20 | "REPO_VIEWER_SCHEMA", 21 | "SYSTEM_PROMPT", 22 | ] 23 | -------------------------------------------------------------------------------- /integrations/github/src/haystack_integrations/prompts/github/issue_commenter_prompt.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | ISSUE_COMMENTER_PROMPT = """Haystack-Agent uses this tool to post a comment to a GitHub-issue discussion. 5 | 6 | 7 | Pass a `comment` string to post a comment. 8 | 9 | 10 | IMPORTANT 11 | Haystack-Agent MUST pass "comment" to this tool. Otherwise, comment creation fails. 12 | Haystack-Agent always passes the contents of the comment to the "comment" parameter when calling this tool. 13 | """ 14 | 15 | ISSUE_COMMENTER_SCHEMA = { 16 | "properties": { 17 | "comment": {"type": "string", "description": "The contents of the comment that you want to create."} 18 | }, 19 | "required": ["comment"], 20 | "type": "object", 21 | } 22 | -------------------------------------------------------------------------------- /integrations/github/src/haystack_integrations/prompts/github/issue_viewer_prompt.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | ISSUE_VIEWER_PROMPT = """Haystack-Agent uses this tool to view a GitHub issue. 5 | Haystack-Agent can view one issue at a time. 6 | 7 | 8 | Pass an `issue_url` string for the GitHub issue that you want to view. 9 | It is required to pass `issue_url` to use this tool. 10 | The structure is "https://github.com/repo-owner/repo-name/issues/issue-number". 11 | 12 | Examples: 13 | 14 | - {"issue_url": "https://github.com/deepset-ai/haystack/issues/9343"} 15 | - will show you the issue 9343 of the haystack repository 16 | - {"issue_url": "https://github.com/deepset-ai/haystack-core-integrations/issues/1685"} 17 | - will show you the issue 1685 of the haystack-core-integrations repository 18 | 19 | """ 20 | 21 | ISSUE_VIEWER_SCHEMA = { 22 | "properties": {"issue_url": {"type": "string", "description": "URL of the GitHub issue to link the PR to."}}, 23 | "required": ["issue_url"], 24 | "type": "object", 25 | } 26 | -------------------------------------------------------------------------------- /integrations/github/src/haystack_integrations/tools/github/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .file_editor_tool import GitHubFileEditorTool 5 | from .issue_commenter_tool import GitHubIssueCommenterTool 6 | from .issue_viewer_tool import GitHubIssueViewerTool 7 | from .pr_creator_tool import GitHubPRCreatorTool 8 | from .repo_viewer_tool import GitHubRepoViewerTool 9 | 10 | __all__ = [ 11 | "GitHubFileEditorTool", 12 | "GitHubIssueCommenterTool", 13 | "GitHubIssueViewerTool", 14 | "GitHubPRCreatorTool", 15 | "GitHubRepoViewerTool", 16 | ] 17 | -------------------------------------------------------------------------------- /integrations/github/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/google_ai/README.md: -------------------------------------------------------------------------------- 1 | # google-ai-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/google-ai-haystack.svg)](https://pypi.org/project/google-ai-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/google-ai-haystack.svg)](https://pypi.org/project/google-ai-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install google-ai-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `google-ai-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | -------------------------------------------------------------------------------- /integrations/google_ai/example_assets/robot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_ai/example_assets/robot1.jpg -------------------------------------------------------------------------------- /integrations/google_ai/example_assets/robot2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_ai/example_assets/robot2.jpg -------------------------------------------------------------------------------- /integrations/google_ai/example_assets/robot3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_ai/example_assets/robot3.jpg -------------------------------------------------------------------------------- /integrations/google_ai/example_assets/robot4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_ai/example_assets/robot4.jpg -------------------------------------------------------------------------------- /integrations/google_ai/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.google_ai.gemini", 6 | "haystack_integrations.components.generators.google_ai.chat.gemini", 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: Google AI integration for Haystack 20 | category_slug: integrations-api 21 | title: Google AI 22 | slug: integrations-google-ai 23 | order: 90 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_google_ai.md -------------------------------------------------------------------------------- /integrations/google_ai/src/haystack_integrations/components/generators/google_ai/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .chat.gemini import GoogleAIGeminiChatGenerator 5 | from .gemini import GoogleAIGeminiGenerator 6 | 7 | __all__ = ["GoogleAIGeminiChatGenerator", "GoogleAIGeminiGenerator"] 8 | -------------------------------------------------------------------------------- /integrations/google_ai/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/google_genai/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/google_genai-v1.0.1] - 2025-06-05 4 | 5 | ### 🌀 Miscellaneous 6 | 7 | - Style: Update to linting to allow function calls in default arguments (#1899) 8 | - Add examples, set safety_settings 9 | - Add print in examples 10 | 11 | ## [integrations/google_genai-v1.0.0] - 2025-06-02 12 | 13 | ### 🚀 Features 14 | 15 | - Add Google GenAI GoogleGenAIChatGenerator (#1875) 16 | 17 | 18 | -------------------------------------------------------------------------------- /integrations/google_genai/examples/chatgenerator_example.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need to 2 | # 1) set `GOOGLE_API_KEY` environment variable 3 | # 2) install the google_genai_haystack integration: pip install google-genai-haystack 4 | # Note: if you change the model, update the model-specific inference parameters. 5 | 6 | 7 | from haystack.dataclasses import ChatMessage 8 | 9 | from haystack_integrations.components.generators.google_genai import GoogleGenAIChatGenerator 10 | 11 | generator = GoogleGenAIChatGenerator( 12 | model="gemini-2.0-flash", 13 | # model-specific inference parameters 14 | generation_kwargs={ 15 | "temperature": 0.7, 16 | }, 17 | ) 18 | 19 | system_prompt = """ 20 | You are a helpful assistant that helps users learn more about Google Cloud services. 21 | Your audience is engineers with a decent technical background. 22 | Be very concise and specific in your answers, keeping them short. 23 | You may use technical terms, jargon, and abbreviations that are common among practitioners. 24 | """ 25 | 26 | messages = [ 27 | ChatMessage.from_system(system_prompt), 28 | ChatMessage.from_user("Which service should I use to train custom Machine Learning models?"), 29 | ] 30 | 31 | results = generator.run(messages) 32 | print(results["replies"][0].text) 33 | -------------------------------------------------------------------------------- /integrations/google_genai/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.google_genai.chat.chat_generator", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: Google GenAI integration for Haystack 19 | category_slug: integrations-api 20 | title: Google GenAI 21 | slug: integrations-google-genai 22 | order: 91 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_google_genai.md -------------------------------------------------------------------------------- /integrations/google_genai/src/haystack_integrations/components/generators/google_genai/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .chat.chat_generator import GoogleGenAIChatGenerator 6 | 7 | __all__ = ["GoogleGenAIChatGenerator"] 8 | -------------------------------------------------------------------------------- /integrations/google_genai/src/haystack_integrations/components/generators/google_genai/chat/utils.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List, Union 2 | 3 | 4 | def remove_key_from_schema( 5 | schema: Union[Dict[str, Any], List[Any]], target_key: str 6 | ) -> Union[Dict[str, Any], List[Any], Any]: 7 | """ 8 | Recursively traverse a schema and remove all occurrences of the target key. 9 | 10 | 11 | :param schema: The schema dictionary/list/value to process 12 | :param target_key: The key to remove from all dictionaries in the schema 13 | 14 | :returns: The schema with the target key removed from all nested dictionaries 15 | """ 16 | if isinstance(schema, dict): 17 | # Create a new dict without the target key 18 | result = {} 19 | for k, v in schema.items(): 20 | if k != target_key: 21 | result[k] = remove_key_from_schema(v, target_key) 22 | return result 23 | 24 | elif isinstance(schema, list): 25 | return [remove_key_from_schema(item, target_key) for item in schema] 26 | 27 | else: 28 | return schema 29 | -------------------------------------------------------------------------------- /integrations/google_vertex/README.md: -------------------------------------------------------------------------------- 1 | # google-vertex-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/google-vertex-haystack.svg)](https://pypi.org/project/google-vertex-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/google-vertex-haystack.svg)](https://pypi.org/project/google-vertex-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [google-vertex-haystack](#google-vertex-haystack) 11 | - [Installation](#installation) 12 | - [Contributing](#contributing) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install google-vertex-haystack 19 | ``` 20 | 21 | ## Contributing 22 | 23 | `hatch` is the best way to interact with this project, to install it: 24 | 25 | ```sh 26 | pip install hatch 27 | ``` 28 | 29 | With `hatch` installed, to run all the tests: 30 | 31 | ``` 32 | hatch run test 33 | ``` 34 | 35 | To run the linters `ruff` and `mypy`: 36 | 37 | ``` 38 | hatch run lint:all 39 | ``` 40 | 41 | ## License 42 | 43 | `google-vertex-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 44 | -------------------------------------------------------------------------------- /integrations/google_vertex/example_assets/robot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_vertex/example_assets/robot1.jpg -------------------------------------------------------------------------------- /integrations/google_vertex/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.google_vertex.gemini", 6 | "haystack_integrations.components.generators.google_vertex.captioner", 7 | "haystack_integrations.components.generators.google_vertex.code_generator", 8 | "haystack_integrations.components.generators.google_vertex.image_generator", 9 | "haystack_integrations.components.generators.google_vertex.question_answering", 10 | "haystack_integrations.components.generators.google_vertex.text_generator", 11 | "haystack_integrations.components.generators.google_vertex.chat.gemini", 12 | "haystack_integrations.components.embedders.google_vertex.document_embedder", 13 | "haystack_integrations.components.embedders.google_vertex.text_embedder", 14 | ] 15 | ignore_when_discovered: ["__init__"] 16 | processors: 17 | - type: filter 18 | expression: 19 | documented_only: true 20 | do_not_filter_modules: false 21 | skip_empty_modules: true 22 | - type: smart 23 | - type: crossref 24 | renderer: 25 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 26 | excerpt: Google Vertex integration for Haystack 27 | category_slug: integrations-api 28 | title: Google Vertex 29 | slug: integrations-google-vertex 30 | order: 100 31 | markdown: 32 | descriptive_class_title: false 33 | classdef_code_block: false 34 | descriptive_module_title: true 35 | add_method_class_prefix: true 36 | add_member_class_prefix: false 37 | filename: _readme_google_vertex.md -------------------------------------------------------------------------------- /integrations/google_vertex/src/haystack_integrations/components/embedders/google_vertex/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import VertexAIDocumentEmbedder 5 | from .text_embedder import VertexAITextEmbedder 6 | 7 | __all__ = ["VertexAIDocumentEmbedder", "VertexAITextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/google_vertex/src/haystack_integrations/components/generators/google_vertex/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .captioner import VertexAIImageCaptioner 5 | from .chat.gemini import VertexAIGeminiChatGenerator 6 | from .code_generator import VertexAICodeGenerator 7 | from .gemini import VertexAIGeminiGenerator 8 | from .image_generator import VertexAIImageGenerator 9 | from .question_answering import VertexAIImageQA 10 | from .text_generator import VertexAITextGenerator 11 | 12 | __all__ = [ 13 | "VertexAICodeGenerator", 14 | "VertexAIGeminiChatGenerator", 15 | "VertexAIGeminiGenerator", 16 | "VertexAIImageCaptioner", 17 | "VertexAIImageGenerator", 18 | "VertexAIImageQA", 19 | "VertexAITextGenerator", 20 | ] 21 | -------------------------------------------------------------------------------- /integrations/google_vertex/src/haystack_integrations/components/generators/google_vertex/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/google_vertex/src/haystack_integrations/components/generators/google_vertex/chat/__init__.py -------------------------------------------------------------------------------- /integrations/google_vertex/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/hatch.toml: -------------------------------------------------------------------------------- 1 | [template] 2 | name = "deepset GmbH" 3 | email = "info@deepset.ai" 4 | 5 | [template.licenses] 6 | headers = true 7 | default = [ 8 | "Apache-2.0", 9 | ] 10 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/instructor_embedders-v0.4.1] - 2024-10-18 4 | 5 | ### 📚 Documentation 6 | 7 | - Disable-class-def (#556) 8 | 9 | ### 🧪 Testing 10 | 11 | - Do not retry tests in `hatch run test` command (#954) 12 | 13 | ### ⚙️ Miscellaneous Tasks 14 | 15 | - Retry tests to reduce flakyness (#836) 16 | - Update ruff invocation to include check parameter (#853) 17 | - Update ruff linting scripts and settings (#1105) 18 | - Adopt uv as installer (#1142) 19 | 20 | ## [integrations/instructor_embedders-v0.4.0] - 2024-02-21 21 | 22 | ### 🐛 Bug Fixes 23 | 24 | - Fix order of API docs (#447) 25 | 26 | This PR will also push the docs to Readme 27 | 28 | ### 📚 Documentation 29 | 30 | - Update category slug (#442) 31 | 32 | ## [integrations/instructor_embedders-v0.3.0] - 2024-02-15 33 | 34 | ### 🚀 Features 35 | 36 | - Generate API docs (#380) 37 | 38 | ### 📚 Documentation 39 | 40 | - Update paths and titles (#397) 41 | 42 | ## [integrations/instructor_embedders-v0.2.1] - 2024-01-30 43 | 44 | ## [integrations/instructor_embedders-v0.2.0] - 2024-01-22 45 | 46 | ### ⚙️ Miscellaneous Tasks 47 | 48 | - Replace - with _ (#114) 49 | - chore!: Rename `model_name_or_path` to `model` in the Instructor integration (#229) 50 | 51 | * rename model_name_or_path in doc embedder 52 | 53 | * fix tests for doc embedder 54 | 55 | * rename model_name_or_path to model in text embedder 56 | 57 | * fix tests for text embedder 58 | 59 | * feedback 60 | 61 | 62 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/README.md: -------------------------------------------------------------------------------- 1 | # instructor_embedders 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/instructor-embedders-haystack.svg)](https://pypi.org/project/instructor-embedders-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/instructor-embedders-haystack.svg)](https://pypi.org/project/instructor-embedders-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [instructor\_embedders](#instructor_embedders) 11 | - [Installation](#installation) 12 | - [License](#license) 13 | 14 | ## Installation 15 | 16 | ```console 17 | pip install instructor-embedders-haystack 18 | ``` 19 | 20 | ## License 21 | 22 | `instructor-embedders` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 23 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.embedders.instructor_embedders.instructor_document_embedder", 7 | "haystack_integrations.components.embedders.instructor_embedders.instructor_text_embedder", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Instructor embedders integration for Haystack 21 | category_slug: integrations-api 22 | title: Instructor Embedders 23 | slug: integrations-instructor-embedders 24 | order: 120 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_instructor_embedders.md 32 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/src/haystack_integrations/components/embedders/instructor_embedders/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .instructor_document_embedder import InstructorDocumentEmbedder 5 | from .instructor_text_embedder import InstructorTextEmbedder 6 | 7 | __all__ = ["InstructorDocumentEmbedder", "InstructorTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/src/haystack_integrations/components/embedders/instructor_embedders/embedding_backend/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/src/haystack_integrations/components/embedders/instructor_embedders/embedding_backend/instructor_backend.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from typing import ClassVar, Dict, List, Optional 5 | 6 | from haystack.utils.auth import Secret 7 | from InstructorEmbedding import INSTRUCTOR 8 | 9 | 10 | class _InstructorEmbeddingBackendFactory: 11 | """ 12 | Factory class to create instances of INSTRUCTOR embedding backends. 13 | """ 14 | 15 | _instances: ClassVar[Dict[str, "_InstructorEmbeddingBackend"]] = {} 16 | 17 | @staticmethod 18 | def get_embedding_backend(model: str, device: Optional[str] = None, token: Optional[Secret] = None): 19 | embedding_backend_id = f"{model}{device}{token}" 20 | 21 | if embedding_backend_id in _InstructorEmbeddingBackendFactory._instances: 22 | return _InstructorEmbeddingBackendFactory._instances[embedding_backend_id] 23 | 24 | embedding_backend = _InstructorEmbeddingBackend(model=model, device=device, token=token) 25 | _InstructorEmbeddingBackendFactory._instances[embedding_backend_id] = embedding_backend 26 | return embedding_backend 27 | 28 | 29 | class _InstructorEmbeddingBackend: 30 | """ 31 | Class to manage INSTRUCTOR embeddings. 32 | """ 33 | 34 | def __init__(self, model: str, device: Optional[str] = None, token: Optional[Secret] = None): 35 | self.model = INSTRUCTOR( 36 | model_name_or_path=model, 37 | device=device, 38 | use_auth_token=token.resolve_value() if token else None, 39 | ) 40 | 41 | def embed(self, data: List[List[str]], **kwargs) -> List[List[float]]: 42 | embeddings = self.model.encode(data, **kwargs).tolist() 43 | return embeddings 44 | -------------------------------------------------------------------------------- /integrations/instructor_embedders/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/jina/README.md: -------------------------------------------------------------------------------- 1 | # jina-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/jina-haystack.svg)](https://pypi.org/project/jina-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/jina-haystack.svg)](https://pypi.org/project/jina-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [jina-haystack](#jina-haystack) 11 | - [Installation](#installation) 12 | - [Usage](#usage) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install jina-haystack 19 | ``` 20 | 21 | ## Usage 22 | 23 | You can use `JinaTextEmbedder` and `JinaDocumentEmbedder` by importing as: 24 | 25 | ```python 26 | from jina_haystack.document_embedder import JinaDocumentEmbedder 27 | from jina_haystack.text_embedder import JinaTextEmbedder 28 | ``` 29 | 30 | ## License 31 | 32 | `jina-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 33 | -------------------------------------------------------------------------------- /integrations/jina/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.embedders.jina.document_embedder", 7 | "haystack_integrations.components.embedders.jina.text_embedder", 8 | "haystack_integrations.components.rankers.jina.ranker", 9 | "haystack_integrations.components.connectors.jina.reader", 10 | ] 11 | ignore_when_discovered: ["__init__"] 12 | processors: 13 | - type: filter 14 | expression: 15 | documented_only: true 16 | do_not_filter_modules: false 17 | skip_empty_modules: true 18 | - type: smart 19 | - type: crossref 20 | renderer: 21 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 22 | excerpt: Jina integration for Haystack 23 | category_slug: integrations-api 24 | title: Jina 25 | slug: integrations-jina 26 | order: 130 27 | markdown: 28 | descriptive_class_title: false 29 | classdef_code_block: false 30 | descriptive_module_title: true 31 | add_method_class_prefix: true 32 | add_member_class_prefix: false 33 | filename: _readme_jina.md 34 | -------------------------------------------------------------------------------- /integrations/jina/src/haystack_integrations/components/connectors/jina/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .reader import JinaReaderConnector 5 | from .reader_mode import JinaReaderMode 6 | 7 | __all__ = ["JinaReaderConnector", "JinaReaderMode"] 8 | -------------------------------------------------------------------------------- /integrations/jina/src/haystack_integrations/components/connectors/jina/reader_mode.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from enum import Enum 5 | 6 | 7 | class JinaReaderMode(Enum): 8 | """ 9 | Enum representing modes for the Jina Reader. 10 | 11 | Modes: 12 | READ: Process a URL and return the textual content of the page. 13 | SEARCH: Search the web and return the textual content of the most relevant pages. 14 | GROUND: Call the grounding engine to perform fact checking. 15 | 16 | """ 17 | 18 | READ = "read" 19 | SEARCH = "search" 20 | GROUND = "ground" 21 | 22 | def __str__(self): 23 | return self.value 24 | 25 | @classmethod 26 | def from_str(cls, string: str) -> "JinaReaderMode": 27 | """ 28 | Create the reader mode from a string. 29 | 30 | :param string: 31 | String to convert. 32 | :returns: 33 | Reader mode. 34 | """ 35 | enum_map = {e.value: e for e in JinaReaderMode} 36 | reader_mode = enum_map.get(string) 37 | if reader_mode is None: 38 | msg = f"Unknown reader mode '{string}'. Supported modes are: {list(enum_map.keys())}" 39 | raise ValueError(msg) 40 | return reader_mode 41 | -------------------------------------------------------------------------------- /integrations/jina/src/haystack_integrations/components/embedders/jina/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import JinaDocumentEmbedder 5 | from .text_embedder import JinaTextEmbedder 6 | 7 | __all__ = ["JinaDocumentEmbedder", "JinaTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/jina/src/haystack_integrations/components/rankers/jina/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .ranker import JinaRanker 5 | 6 | __all__ = ["JinaRanker"] 7 | -------------------------------------------------------------------------------- /integrations/jina/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/langfuse/example/requirements.txt: -------------------------------------------------------------------------------- 1 | langfuse-haystack 2 | datasets 3 | sentence-transformers -------------------------------------------------------------------------------- /integrations/langfuse/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.connectors.langfuse.langfuse_connector", 6 | "haystack_integrations.tracing.langfuse.tracer", 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: Langfuse integration for Haystack 20 | category_slug: integrations-api 21 | title: langfuse 22 | slug: integrations-langfuse 23 | order: 136 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_langfuse.md 31 | -------------------------------------------------------------------------------- /integrations/langfuse/src/haystack_integrations/components/connectors/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/langfuse/src/haystack_integrations/components/connectors/langfuse/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .langfuse_connector import LangfuseConnector 6 | 7 | __all__ = ["LangfuseConnector"] 8 | -------------------------------------------------------------------------------- /integrations/langfuse/src/haystack_integrations/tracing/langfuse/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .tracer import DefaultSpanHandler, LangfuseSpan, LangfuseTracer, SpanContext, SpanHandler 6 | 7 | __all__ = ["DefaultSpanHandler", "LangfuseSpan", "LangfuseTracer", "SpanContext", "SpanHandler"] 8 | -------------------------------------------------------------------------------- /integrations/langfuse/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/llama_cpp/examples/llama_cpp_generator_example.py: -------------------------------------------------------------------------------- 1 | from haystack_integrations.components.generators.llama_cpp import LlamaCppGenerator 2 | 3 | generator = LlamaCppGenerator(model="openchat-3.5-1210.Q3_K_S.gguf", n_ctx=512, n_batch=128) 4 | generator.warm_up() 5 | 6 | question = "Who is the best American actor?" 7 | prompt = f"GPT4 Correct User: {question} <|end_of_turn|> GPT4 Correct Assistant:" 8 | 9 | result = generator.run(prompt, generation_kwargs={"max_tokens": 128}) 10 | generated_text = result["replies"][0] 11 | 12 | print(generated_text) 13 | -------------------------------------------------------------------------------- /integrations/llama_cpp/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.llama_cpp.generator", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: Llama.cpp integration for Haystack 19 | category_slug: integrations-api 20 | title: Llama.cpp 21 | slug: integrations-llama-cpp 22 | order: 140 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_llama_cpp.md -------------------------------------------------------------------------------- /integrations/llama_cpp/src/haystack_integrations/components/generators/llama_cpp/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .chat.chat_generator import LlamaCppChatGenerator 6 | from .generator import LlamaCppGenerator 7 | 8 | __all__ = ["LlamaCppChatGenerator", "LlamaCppGenerator"] 9 | -------------------------------------------------------------------------------- /integrations/llama_cpp/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/llama_cpp/tests/models/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /integrations/mcp/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/mcp-v0.3.1] - 2025-05-28 4 | 5 | ### 🌀 Miscellaneous 6 | 7 | - App pins for MCP (#1845) 8 | 9 | ## [integrations/mcp-v0.3.0] - 2025-05-27 10 | 11 | ### 🚀 Features 12 | 13 | - MCPTool and MCPToolset async resource management improvements (#1758) 14 | - Add streamable-http transport MCP support (#1777) 15 | 16 | 17 | ## [integrations/mcp-v0.2.0] - 2025-05-06 18 | 19 | ### 🚀 Features 20 | 21 | - [**breaking**] Deprecate SSEServerInfo base_url in favour of url (#1662) 22 | 23 | ### 📚 Documentation 24 | 25 | - Add_mcptoolset_docs (#1668) 26 | 27 | ## [integrations/mcp-v0.1.0] - 2025-04-22 28 | 29 | ### 🚀 Features 30 | 31 | - Add MCPToolset (#1626) 32 | 33 | 34 | ## [integrations/mcp-v0.0.2] - 2025-04-11 35 | 36 | ### 📚 Documentation 37 | 38 | - Fix MCPTool import in code example (#1578) 39 | 40 | ### ⚙️ CI 41 | 42 | - Review testing workflows (#1541) 43 | 44 | ### 🌀 Miscellaneous 45 | 46 | - Feat: Add AsyncExecutor in MCPTool, ensure MCPTool works in hayhooks (#1643) 47 | 48 | ## [integrations/mcp-v0.0.1] - 2025-03-12 49 | 50 | ### 🚀 Features 51 | 52 | - Add MCP tooling integration (#1487) 53 | 54 | 55 | -------------------------------------------------------------------------------- /integrations/mcp/examples/mcp_server.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import argparse 6 | 7 | from mcp.server.fastmcp import FastMCP 8 | 9 | # run this server first before running the client mcp_filtered_tools.py or mcp_client.py 10 | # it shows how easy it is to create a MCP server in just a few lines of code 11 | # then we'll use the MCPTool to invoke the server 12 | 13 | 14 | mcp = FastMCP("MCP Calculator") 15 | 16 | 17 | @mcp.tool() 18 | def add(a: int, b: int) -> int: 19 | """Add two numbers""" 20 | return a + b 21 | 22 | 23 | @mcp.tool() 24 | def subtract(a: int, b: int) -> int: 25 | """Subtract two numbers""" 26 | return a - b 27 | 28 | 29 | if __name__ == "__main__": 30 | # Parse command line arguments 31 | parser = argparse.ArgumentParser( 32 | description="Run an MCP server with different transport options (sse or streamable-http)" 33 | ) 34 | parser.add_argument( 35 | "--transport", 36 | type=str, 37 | default="sse", 38 | choices=["sse", "streamable-http"], 39 | help="Transport mechanism for the MCP server (default: sse)", 40 | ) 41 | args = parser.parse_args() 42 | mcp.run(transport=args.transport) 43 | -------------------------------------------------------------------------------- /integrations/mcp/examples/mcp_stdio_client.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import logging 6 | 7 | from haystack_integrations.tools.mcp import MCPTool, StdioServerInfo 8 | 9 | # Setup logging 10 | logging.basicConfig(level=logging.DEBUG) 11 | logger = logging.getLogger("haystack_integrations.tools.mcp") 12 | logger.setLevel(logging.DEBUG) 13 | 14 | # For stdio MCPTool we don't need to run a server, we can just use the MCPTool directly 15 | # Here we use the mcp-server-time server 16 | # See https://github.com/modelcontextprotocol/servers/tree/main/src/time for more details 17 | # prior to running this script, pip install mcp-server-time 18 | 19 | 20 | def main(): 21 | """Example of using the MCPTool implementation with stdio transport.""" 22 | 23 | stdio_tool = None 24 | try: 25 | stdio_tool = MCPTool( 26 | name="get_current_time", 27 | server_info=StdioServerInfo(command="uvx", args=["mcp-server-time", "--local-timezone=Europe/Berlin"]), 28 | ) 29 | 30 | print(f"Tool spec: {stdio_tool.tool_spec}") 31 | 32 | result = stdio_tool.invoke(timezone="America/New_York") 33 | print(f"Current time in New York: {result}") 34 | 35 | result = stdio_tool.invoke(timezone="America/Los_Angeles") 36 | print(f"Current time in Los Angeles: {result}") 37 | except Exception as e: 38 | print(f"Error in stdio example: {e}") 39 | finally: 40 | if stdio_tool: 41 | stdio_tool.close() 42 | 43 | 44 | if __name__ == "__main__": 45 | main() 46 | -------------------------------------------------------------------------------- /integrations/mcp/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.tools.mcp.mcp_tool", 6 | "haystack_integrations.tools.mcp.mcp_toolset", 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: MCP integration for Haystack 20 | category_slug: integrations-api 21 | title: MCP 22 | slug: integrations-mcp 23 | order: 145 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_mcp.md 31 | -------------------------------------------------------------------------------- /integrations/mcp/src/haystack_integrations/tools/mcp/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2022-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .mcp_tool import ( 6 | MCPClient, 7 | MCPConnectionError, 8 | MCPError, 9 | MCPInvocationError, 10 | MCPServerInfo, 11 | MCPTool, 12 | MCPToolNotFoundError, 13 | SSEClient, 14 | SSEServerInfo, 15 | StdioClient, 16 | StdioServerInfo, 17 | StreamableHttpClient, 18 | StreamableHttpServerInfo, 19 | ) 20 | from .mcp_toolset import MCPToolset 21 | 22 | __all__ = [ 23 | "MCPClient", 24 | "MCPConnectionError", 25 | "MCPError", 26 | "MCPInvocationError", 27 | "MCPServerInfo", 28 | "MCPTool", 29 | "MCPToolNotFoundError", 30 | "MCPToolset", 31 | "SSEClient", 32 | "SSEServerInfo", 33 | "StdioClient", 34 | "StdioServerInfo", 35 | "StreamableHttpClient", 36 | "StreamableHttpServerInfo", 37 | ] 38 | -------------------------------------------------------------------------------- /integrations/mcp/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/mcp/tests/conftest.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from haystack_integrations.tools.mcp import MCPTool, MCPToolset 4 | 5 | 6 | @pytest.fixture 7 | def mcp_tool_cleanup(): 8 | """Fixture to ensure all MCPTool and MCPToolset instances are properly closed after tests.""" 9 | tools = [] 10 | toolsets = [] 11 | 12 | def _register(item): 13 | """Register an MCP component for cleanup.""" 14 | if isinstance(item, MCPTool): 15 | tools.append(item) 16 | elif isinstance(item, MCPToolset): 17 | toolsets.append(item) 18 | return item 19 | 20 | yield _register 21 | 22 | # Finalizer to close all tools and toolsets 23 | for tool in tools: 24 | tool.close() 25 | 26 | for toolset in toolsets: 27 | toolset.close() 28 | -------------------------------------------------------------------------------- /integrations/mcp/tests/mcp_servers_fixtures.py: -------------------------------------------------------------------------------- 1 | from mcp.server.fastmcp import FastMCP 2 | 3 | ################################################ 4 | # Calculator MCP Server 5 | ################################################ 6 | 7 | calculator_mcp = FastMCP("Calculator") 8 | 9 | 10 | @calculator_mcp.tool() 11 | def add(a: int, b: int) -> int: 12 | """Add two integers.""" 13 | return a + b 14 | 15 | 16 | @calculator_mcp.tool() 17 | def subtract(a: int, b: int) -> int: 18 | """Subtract integer b from integer a.""" 19 | return a - b 20 | 21 | 22 | @calculator_mcp.tool() 23 | def divide_by_zero(a: int) -> float: 24 | """Intentionally cause a division by zero error.""" 25 | return a / 0 26 | 27 | 28 | ################################################ 29 | # Echo MCP Server 30 | ################################################ 31 | 32 | echo_mcp = FastMCP("Echo") 33 | 34 | 35 | @echo_mcp.tool() 36 | def echo(text: str) -> str: 37 | """Echo the input text.""" 38 | return text 39 | -------------------------------------------------------------------------------- /integrations/meta_llama/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/meta_llama-v1.0.0] - 2025-05-15 4 | 5 | ### 🚀 Features 6 | 7 | - Support Llama API as a Chat Generator (#1742) 8 | 9 | 10 | -------------------------------------------------------------------------------- /integrations/meta_llama/README.md: -------------------------------------------------------------------------------- 1 | # meta-llama-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/meta-llama-haystack.svg)](https://pypi.org/project/meta-llama-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/meta-llama-haystack.svg)](https://pypi.org/project/meta-llama-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Llama API](#llama-api) 11 | - [Installation](#installation) 12 | - [License](#license) 13 | 14 | ## Llama API 15 | 16 | Llama API is a Meta-hosted API service that helps you integrate Llama models into your applications quickly and efficiently. 17 | 18 | Get started with Llama API key [here](https://llama.developer.meta.com?utm_source=partner-haystack&utm_medium=readme). 19 | 20 | ## Installation 21 | 22 | ```console 23 | pip install meta-llama-haystack 24 | ``` 25 | 26 | ## License 27 | 28 | `meta-llama-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 29 | -------------------------------------------------------------------------------- /integrations/meta_llama/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.meta_llama.chat.chat_generator", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: Meta Llama API integration for Haystack 19 | category_slug: integrations-api 20 | title: Meta Llama API 21 | slug: integrations-meta-llama 22 | order: 150 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_meta_llama.md 30 | -------------------------------------------------------------------------------- /integrations/meta_llama/src/haystack_integrations/components/generators/meta_llama/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates 2 | 3 | from .chat.chat_generator import MetaLlamaChatGenerator 4 | 5 | __all__ = ["MetaLlamaChatGenerator"] 6 | -------------------------------------------------------------------------------- /integrations/meta_llama/src/haystack_integrations/components/generators/meta_llama/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates 2 | -------------------------------------------------------------------------------- /integrations/meta_llama/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates 2 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 3 | # 4 | # SPDX-License-Identifier: Apache-2.0 5 | -------------------------------------------------------------------------------- /integrations/mistral/README.md: -------------------------------------------------------------------------------- 1 | # mistral-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/mistral-haystack.svg)](https://pypi.org/project/mistral-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mistral-haystack.svg)](https://pypi.org/project/mistral-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install mistral-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `mistral-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | -------------------------------------------------------------------------------- /integrations/mistral/examples/indexing_pipeline.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need an to set a `MISTRAL_API_KEY` environment variable. 2 | # This example streams chat replies to the console. 3 | 4 | from haystack import Pipeline 5 | from haystack.components.converters import HTMLToDocument 6 | from haystack.components.fetchers import LinkContentFetcher 7 | from haystack.components.preprocessors import DocumentSplitter 8 | from haystack.components.writers import DocumentWriter 9 | from haystack.document_stores.in_memory import InMemoryDocumentStore 10 | 11 | from haystack_integrations.components.embedders.mistral.document_embedder import MistralDocumentEmbedder 12 | 13 | document_store = InMemoryDocumentStore() 14 | fetcher = LinkContentFetcher() 15 | converter = HTMLToDocument() 16 | chunker = DocumentSplitter() 17 | embedder = MistralDocumentEmbedder() 18 | writer = DocumentWriter(document_store=document_store) 19 | 20 | indexing = Pipeline() 21 | 22 | indexing.add_component(name="fetcher", instance=fetcher) 23 | indexing.add_component(name="converter", instance=converter) 24 | indexing.add_component(name="chunker", instance=chunker) 25 | indexing.add_component(name="embedder", instance=embedder) 26 | indexing.add_component(name="writer", instance=writer) 27 | 28 | indexing.connect("fetcher", "converter") 29 | indexing.connect("converter", "chunker") 30 | indexing.connect("chunker", "embedder") 31 | indexing.connect("embedder", "writer") 32 | 33 | indexing.run(data={"fetcher": {"urls": ["https://mistral.ai/news/la-plateforme/"]}}) 34 | -------------------------------------------------------------------------------- /integrations/mistral/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.embedders.mistral.document_embedder", 6 | "haystack_integrations.components.embedders.mistral.text_embedder", 7 | "haystack_integrations.components.generators.mistral.chat.chat_generator", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Mistral integration for Haystack 21 | category_slug: integrations-api 22 | title: Mistral 23 | slug: integrations-mistral 24 | order: 150 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_mistral.md -------------------------------------------------------------------------------- /integrations/mistral/src/haystack_integrations/components/embedders/mistral/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import MistralDocumentEmbedder 5 | from .text_embedder import MistralTextEmbedder 6 | 7 | __all__ = ["MistralDocumentEmbedder", "MistralTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/mistral/src/haystack_integrations/components/generators/mistral/__init__.py: -------------------------------------------------------------------------------- 1 | from .chat.chat_generator import MistralChatGenerator 2 | 3 | __all__ = ["MistralChatGenerator"] 4 | -------------------------------------------------------------------------------- /integrations/mistral/src/haystack_integrations/components/generators/mistral/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/mistral/src/haystack_integrations/components/generators/mistral/chat/__init__.py -------------------------------------------------------------------------------- /integrations/mistral/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/mongodb_atlas/README.md: -------------------------------------------------------------------------------- 1 | # mongodb-atlas-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/mongodb-atlas-haystack.svg)](https://pypi.org/project/mongodb-atlas-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mongodb-atlas-haystack.svg)](https://pypi.org/project/mongodb-atlas-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [Contributing](#contributing) 12 | - [License](#license) 13 | 14 | ## Installation 15 | 16 | ```console 17 | pip install mongodb-atlas-haystack 18 | ``` 19 | 20 | ## Contributing 21 | 22 | `hatch` is the best way to interact with this project, to install it: 23 | ```sh 24 | pip install hatch 25 | ``` 26 | 27 | To run the linters `ruff` and `mypy`: 28 | ``` 29 | hatch run lint:all 30 | ``` 31 | 32 | To run all the tests: 33 | ``` 34 | hatch run test 35 | ``` 36 | 37 | Note: you need your own MongoDB Atlas account to run the tests: you can make one here: 38 | https://www.mongodb.com/cloud/atlas/register. Once you have it, export the connection string 39 | to the env var `MONGO_CONNECTION_STRING`. If you forget to do so, all the tests will be skipped. 40 | 41 | ## License 42 | 43 | `mongodb-atlas-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 44 | -------------------------------------------------------------------------------- /integrations/mongodb_atlas/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.document_stores.mongodb_atlas.document_store", 6 | "haystack_integrations.document_stores.mongodb_atlas.filters", 7 | "haystack_integrations.components.retrievers.mongodb_atlas.embedding_retriever", 8 | "haystack_integrations.components.retrievers.mongodb_atlas.full_text_retriever", 9 | ] 10 | ignore_when_discovered: ["__init__"] 11 | processors: 12 | - type: filter 13 | expression: 14 | documented_only: true 15 | do_not_filter_modules: false 16 | skip_empty_modules: true 17 | - type: smart 18 | - type: crossref 19 | renderer: 20 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 21 | excerpt: MongoDB Atlas integration for Haystack 22 | category_slug: integrations-api 23 | title: MongoDB Atlas 24 | slug: integrations-mongodb-atlas 25 | order: 160 26 | markdown: 27 | descriptive_class_title: false 28 | classdef_code_block: false 29 | descriptive_module_title: true 30 | add_method_class_prefix: true 31 | add_member_class_prefix: false 32 | filename: _readme_mongodb_atlas.md 33 | -------------------------------------------------------------------------------- /integrations/mongodb_atlas/src/haystack_integrations/components/retrievers/mongodb_atlas/__init__.py: -------------------------------------------------------------------------------- 1 | from haystack_integrations.components.retrievers.mongodb_atlas.embedding_retriever import MongoDBAtlasEmbeddingRetriever 2 | from haystack_integrations.components.retrievers.mongodb_atlas.full_text_retriever import MongoDBAtlasFullTextRetriever 3 | 4 | __all__ = ["MongoDBAtlasEmbeddingRetriever", "MongoDBAtlasFullTextRetriever"] 5 | -------------------------------------------------------------------------------- /integrations/mongodb_atlas/src/haystack_integrations/document_stores/mongodb_atlas/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import MongoDBAtlasDocumentStore 5 | 6 | __all__ = ["MongoDBAtlasDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/mongodb_atlas/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/nvidia/README.md: -------------------------------------------------------------------------------- 1 | # nvidia-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/nvidia-haystack.svg)](https://pypi.org/project/nvidia-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nvidia-haystack.svg)](https://pypi.org/project/nvidia-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [nvidia-haystack](#nvidia-haystack) 11 | - [Installation](#installation) 12 | - [Contributing](#contributing) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install nvidia-haystack 19 | ``` 20 | 21 | ## Contributing 22 | 23 | `hatch` is the best way to interact with this project, to install it: 24 | 25 | ```sh 26 | pip install hatch 27 | ``` 28 | 29 | With `hatch` installed, to run all the tests: 30 | 31 | ``` 32 | hatch run test 33 | ``` 34 | 35 | > Note: integration tests will be skipped unless the env var NVIDIA_API_KEY is set. The api key needs to be valid 36 | > in order to pass the tests. 37 | 38 | To only run unit tests: 39 | 40 | ``` 41 | hatch run test:unit 42 | ``` 43 | 44 | To run the linters `ruff` and `mypy`: 45 | 46 | ``` 47 | hatch run lint:all 48 | ``` 49 | 50 | ## License 51 | 52 | `nvidia-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 53 | -------------------------------------------------------------------------------- /integrations/nvidia/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.embedders.nvidia.document_embedder", 7 | "haystack_integrations.components.embedders.nvidia.text_embedder", 8 | "haystack_integrations.components.embedders.nvidia.truncate", 9 | "haystack_integrations.components.generators.nvidia.generator", 10 | "haystack_integrations.components.rankers.nvidia.ranker", 11 | "haystack_integrations.components.rankers.nvidia.truncate", 12 | ] 13 | ignore_when_discovered: ["__init__"] 14 | processors: 15 | - type: filter 16 | expression: 17 | documented_only: true 18 | do_not_filter_modules: false 19 | skip_empty_modules: true 20 | - type: smart 21 | - type: crossref 22 | renderer: 23 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 24 | excerpt: Nvidia integration for Haystack 25 | category_slug: integrations-api 26 | title: Nvidia 27 | slug: integrations-nvidia 28 | order: 165 29 | markdown: 30 | descriptive_class_title: false 31 | classdef_code_block: false 32 | descriptive_module_title: true 33 | add_method_class_prefix: true 34 | add_member_class_prefix: false 35 | filename: _readme_nvidia.md 36 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .document_embedder import NvidiaDocumentEmbedder 6 | from .text_embedder import NvidiaTextEmbedder 7 | from .truncate import EmbeddingTruncateMode 8 | 9 | __all__ = ["EmbeddingTruncateMode", "NvidiaDocumentEmbedder", "NvidiaTextEmbedder"] 10 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/embedders/nvidia/truncate.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from enum import Enum 6 | 7 | 8 | class EmbeddingTruncateMode(Enum): 9 | """ 10 | Specifies how inputs to the NVIDIA embedding components are truncated. 11 | If START, the input will be truncated from the start. 12 | If END, the input will be truncated from the end. 13 | If NONE, an error will be returned (if the input is too long). 14 | """ 15 | 16 | START = "START" 17 | END = "END" 18 | NONE = "NONE" 19 | 20 | def __str__(self): 21 | return self.value 22 | 23 | @classmethod 24 | def from_str(cls, string: str) -> "EmbeddingTruncateMode": 25 | """ 26 | Create an truncate mode from a string. 27 | 28 | :param string: 29 | String to convert. 30 | :returns: 31 | Truncate mode. 32 | """ 33 | enum_map = {e.value: e for e in EmbeddingTruncateMode} 34 | opt_mode = enum_map.get(string) 35 | if opt_mode is None: 36 | msg = f"Unknown truncate mode '{string}'. Supported modes are: {list(enum_map.keys())}" 37 | raise ValueError(msg) 38 | return opt_mode 39 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/generators/nvidia/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .chat.chat_generator import NvidiaChatGenerator 6 | from .generator import NvidiaGenerator 7 | 8 | __all__ = ["NvidiaChatGenerator", "NvidiaGenerator"] 9 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/generators/nvidia/chat/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/rankers/nvidia/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .ranker import NvidiaRanker 6 | 7 | __all__ = ["NvidiaRanker"] 8 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/components/rankers/nvidia/truncate.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from enum import Enum 6 | 7 | 8 | class RankerTruncateMode(str, Enum): 9 | """ 10 | Specifies how inputs to the NVIDIA ranker components are truncated. 11 | If NONE, the input will not be truncated and an error returned instead. 12 | If END, the input will be truncated from the end. 13 | """ 14 | 15 | NONE = "NONE" 16 | END = "END" 17 | 18 | def __str__(self): 19 | return self.value 20 | 21 | @classmethod 22 | def from_str(cls, string: str) -> "RankerTruncateMode": 23 | """ 24 | Create an truncate mode from a string. 25 | 26 | :param string: 27 | String to convert. 28 | :returns: 29 | Truncate mode. 30 | """ 31 | return cls(string) 32 | -------------------------------------------------------------------------------- /integrations/nvidia/src/haystack_integrations/utils/nvidia/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .models import DEFAULT_API_URL, Model 6 | from .nim_backend import NimBackend 7 | from .utils import is_hosted, url_validation 8 | 9 | __all__ = ["DEFAULT_API_URL", "Model", "NimBackend", "is_hosted", "url_validation", "validate_hosted_model"] 10 | -------------------------------------------------------------------------------- /integrations/nvidia/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .conftest import MockBackend 6 | 7 | __all__ = ["MockBackend"] 8 | -------------------------------------------------------------------------------- /integrations/nvidia/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from typing import Any, Dict, List, Optional, Tuple 6 | 7 | import pytest 8 | from haystack.utils import Secret 9 | from requests_mock import Mocker 10 | 11 | from haystack_integrations.utils.nvidia import Model, NimBackend 12 | 13 | 14 | class MockBackend(NimBackend): 15 | def __init__(self, model: str, api_key: Optional[Secret] = None, model_kwargs: Optional[Dict[str, Any]] = None): 16 | api_key = api_key or Secret.from_env_var("NVIDIA_API_KEY") 17 | super().__init__(model, api_url="", api_key=api_key, model_kwargs=model_kwargs or {}) 18 | 19 | def embed(self, texts): 20 | inputs = texts 21 | data = [[0.1, 0.2, 0.3] for i in range(len(inputs))] 22 | return data, {"usage": {"total_tokens": 4, "prompt_tokens": 4}} 23 | 24 | def models(self): 25 | return [Model(id="aa")] 26 | 27 | def generate(self) -> Tuple[List[str], List[Dict[str, Any]]]: 28 | return ( 29 | ["This is a mocked response."], 30 | [{"role": "assistant", "usage": {"prompt_tokens": 5, "total_tokens": 10, "completion_tokens": 5}}], 31 | ) 32 | 33 | 34 | @pytest.fixture 35 | def mock_local_models(requests_mock: Mocker) -> None: 36 | requests_mock.get( 37 | "http://localhost:8080/v1/models", 38 | json={ 39 | "data": [ 40 | { 41 | "id": "model1", 42 | "object": "model", 43 | "created": 1234567890, 44 | "owned_by": "OWNER", 45 | "root": "model1", 46 | }, 47 | ] 48 | }, 49 | ) 50 | -------------------------------------------------------------------------------- /integrations/nvidia/tests/test_embedding_truncate_mode.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | 7 | from haystack_integrations.components.embedders.nvidia import EmbeddingTruncateMode 8 | 9 | 10 | class TestEmbeddingTruncateMode: 11 | @pytest.mark.parametrize( 12 | "mode, expected", 13 | [ 14 | ("START", EmbeddingTruncateMode.START), 15 | ("END", EmbeddingTruncateMode.END), 16 | ("NONE", EmbeddingTruncateMode.NONE), 17 | (EmbeddingTruncateMode.START, EmbeddingTruncateMode.START), 18 | (EmbeddingTruncateMode.END, EmbeddingTruncateMode.END), 19 | (EmbeddingTruncateMode.NONE, EmbeddingTruncateMode.NONE), 20 | ], 21 | ) 22 | def test_init_with_valid_mode(self, mode, expected): 23 | assert EmbeddingTruncateMode(mode) == expected 24 | 25 | def test_init_with_invalid_mode_raises_value_error(self): 26 | with pytest.raises(ValueError): 27 | invalid_mode = "INVALID" 28 | EmbeddingTruncateMode(invalid_mode) 29 | 30 | @pytest.mark.parametrize( 31 | "mode, expected", 32 | [ 33 | ("START", EmbeddingTruncateMode.START), 34 | ("END", EmbeddingTruncateMode.END), 35 | ("NONE", EmbeddingTruncateMode.NONE), 36 | ], 37 | ) 38 | def test_from_str_with_valid_mode(self, mode, expected): 39 | assert EmbeddingTruncateMode.from_str(mode) == expected 40 | 41 | def test_from_str_with_invalid_mode_raises_value_error(self): 42 | with pytest.raises(ValueError): 43 | invalid_mode = "INVALID" 44 | EmbeddingTruncateMode.from_str(invalid_mode) 45 | -------------------------------------------------------------------------------- /integrations/ollama/README.md: -------------------------------------------------------------------------------- 1 | # ollama-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/ollama-haystack.svg)](https://pypi.org/project/ollama-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ollama-haystack.svg)](https://pypi.org/project/ollama-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install ollama-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `ollama-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | 23 | ## Testing 24 | 25 | To run tests first start a Docker container running Ollama and pull a model for integration testing 26 | It's recommended to use the smallest model possible for testing purposes - see https://ollama.ai/library for a list that Ollama supportd 27 | 28 | ```console 29 | docker run -d -p 11434:11434 --name ollama ollama/ollama:latest 30 | docker exec ollama ollama pull 31 | ``` 32 | 33 | Then run tests: 34 | 35 | ```console 36 | hatch run test 37 | ``` 38 | 39 | The default model used here is ``orca-mini`` for generation and ``nomic-embed-text`` for embeddings -------------------------------------------------------------------------------- /integrations/ollama/examples/embedders_example.py: -------------------------------------------------------------------------------- 1 | # In order to run this example, you will need to have an instance of Ollama running with 2 | # an embedding model downloaded. Use the following commands to serve the nomic-embed-text model with Ollama 3 | # 4 | # docker run -d -p 11434:11434 --name ollama ollama/ollama:latest 5 | # docker exec ollama ollama pull nomic-embed-text 6 | 7 | from haystack import Document, Pipeline 8 | from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever 9 | from haystack.document_stores.in_memory import InMemoryDocumentStore 10 | 11 | from haystack_integrations.components.embedders.ollama.document_embedder import OllamaDocumentEmbedder 12 | from haystack_integrations.components.embedders.ollama.text_embedder import OllamaTextEmbedder 13 | 14 | document_store = InMemoryDocumentStore(embedding_similarity_function="cosine") 15 | 16 | documents = [ 17 | Document(content="I saw a black horse running"), 18 | Document(content="Germany has many big cities"), 19 | Document(content="My name is Wolfgang and I live in Berlin"), 20 | ] 21 | 22 | document_embedder = OllamaDocumentEmbedder() 23 | documents_with_embeddings = document_embedder.run(documents)["documents"] 24 | document_store.write_documents(documents_with_embeddings) 25 | 26 | query_pipeline = Pipeline() 27 | query_pipeline.add_component("text_embedder", OllamaTextEmbedder()) 28 | query_pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store)) 29 | query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding") 30 | 31 | query = "Who lives in Berlin?" 32 | 33 | result = query_pipeline.run({"text_embedder": {"text": query}}) 34 | 35 | print(result["retriever"]["documents"][0]) 36 | -------------------------------------------------------------------------------- /integrations/ollama/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.ollama.generator", 6 | "haystack_integrations.components.generators.ollama.chat.chat_generator", 7 | "haystack_integrations.components.embedders.ollama.document_embedder", 8 | "haystack_integrations.components.embedders.ollama.text_embedder", 9 | ] 10 | ignore_when_discovered: ["__init__"] 11 | processors: 12 | - type: filter 13 | expression: 14 | documented_only: true 15 | do_not_filter_modules: false 16 | skip_empty_modules: true 17 | - type: smart 18 | - type: crossref 19 | renderer: 20 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 21 | excerpt: Ollama integration for Haystack 22 | category_slug: integrations-api 23 | title: Ollama 24 | slug: integrations-ollama 25 | order: 170 26 | markdown: 27 | descriptive_class_title: false 28 | classdef_code_block: false 29 | descriptive_module_title: true 30 | add_method_class_prefix: true 31 | add_member_class_prefix: false 32 | filename: _readme_ollama.md 33 | -------------------------------------------------------------------------------- /integrations/ollama/src/haystack_integrations/components/embedders/ollama/__init__.py: -------------------------------------------------------------------------------- 1 | from .document_embedder import OllamaDocumentEmbedder 2 | from .text_embedder import OllamaTextEmbedder 3 | 4 | __all__ = ["OllamaDocumentEmbedder", "OllamaTextEmbedder"] 5 | -------------------------------------------------------------------------------- /integrations/ollama/src/haystack_integrations/components/generators/ollama/__init__.py: -------------------------------------------------------------------------------- 1 | from .chat.chat_generator import OllamaChatGenerator 2 | from .generator import OllamaGenerator 3 | 4 | __all__ = ["OllamaChatGenerator", "OllamaGenerator"] 5 | -------------------------------------------------------------------------------- /integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/ollama/src/haystack_integrations/components/generators/ollama/chat/__init__.py -------------------------------------------------------------------------------- /integrations/ollama/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/ollama/tests/test_text_embedder.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | from ollama._types import ResponseError 3 | 4 | from haystack_integrations.components.embedders.ollama import OllamaTextEmbedder 5 | 6 | 7 | class TestOllamaTextEmbedder: 8 | def test_init_defaults(self): 9 | embedder = OllamaTextEmbedder() 10 | 11 | assert embedder.timeout == 120 12 | assert embedder.generation_kwargs == {} 13 | assert embedder.url == "http://localhost:11434" 14 | assert embedder.model == "nomic-embed-text" 15 | 16 | def test_init(self): 17 | embedder = OllamaTextEmbedder( 18 | model="llama2", 19 | url="http://my-custom-endpoint:11434", 20 | generation_kwargs={"temperature": 0.5}, 21 | timeout=3000, 22 | ) 23 | 24 | assert embedder.timeout == 3000 25 | assert embedder.generation_kwargs == {"temperature": 0.5} 26 | assert embedder.url == "http://my-custom-endpoint:11434" 27 | assert embedder.model == "llama2" 28 | 29 | @pytest.mark.integration 30 | def test_model_not_found(self): 31 | embedder = OllamaTextEmbedder(model="cheese") 32 | 33 | with pytest.raises(ResponseError): 34 | embedder.run("hello") 35 | 36 | @pytest.mark.integration 37 | def test_run(self): 38 | embedder = OllamaTextEmbedder(model="nomic-embed-text") 39 | 40 | text = "hello" 41 | reply = embedder.run(text=text) 42 | 43 | assert isinstance(reply, dict) 44 | assert all(isinstance(element, float) for element in reply["embedding"]) 45 | assert reply["meta"]["model"] == "nomic-embed-text" 46 | 47 | @pytest.mark.asyncio 48 | @pytest.mark.integration 49 | async def test_run_async(self): 50 | embedder = OllamaTextEmbedder(model="nomic-embed-text") 51 | 52 | text = "hello" 53 | reply = await embedder.run_async(text=text) 54 | 55 | assert isinstance(reply, dict) 56 | assert all(isinstance(element, float) for element in reply["embedding"]) 57 | assert reply["meta"]["model"] == "nomic-embed-text" 58 | -------------------------------------------------------------------------------- /integrations/openrouter/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/openrouter-v1.0.0] - 2025-05-19 4 | 5 | ### 🚀 Features 6 | 7 | - Support OpenRouter API as a Chat Generator (#1723) 8 | 9 | 10 | -------------------------------------------------------------------------------- /integrations/openrouter/README.md: -------------------------------------------------------------------------------- 1 | # openrouter-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/openrouter-haystack.svg)](https://pypi.org/project/openrouter-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/openrouter-haystack.svg)](https://pypi.org/project/openrouterhaystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install openrouter-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `openrouter-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | -------------------------------------------------------------------------------- /integrations/openrouter/examples/openrouter_with_tools_example.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | # This example demonstrates how to use the OpenRouterChatGenerator component 6 | # with tools and model routing. 7 | # To run this example, you will need to 8 | # set `OPENROUTER_API_KEY` environment variable 9 | 10 | from haystack.components.tools import ToolInvoker 11 | from haystack.dataclasses import ChatMessage 12 | from haystack.tools import Tool 13 | 14 | from haystack_integrations.components.generators.openrouter import OpenRouterChatGenerator 15 | 16 | 17 | # Define a tool that models can call 18 | def weather(city: str): 19 | """Return mock weather info for the given city.""" 20 | return f"The weather in {city} is sunny and 32°C" 21 | 22 | 23 | tool_parameters = {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]} 24 | 25 | weather_tool = Tool( 26 | name="weather", 27 | description="Useful for getting the weather in a specific city", 28 | parameters=tool_parameters, 29 | function=weather, 30 | ) 31 | 32 | # Create a tool invoker with the weather tool 33 | tool_invoker = ToolInvoker(tools=[weather_tool]) 34 | 35 | # We can setup model routing by setting the `model` parameter to `openrouter/auto` 36 | # and providing a list of models to route to. 37 | client = OpenRouterChatGenerator( 38 | model="openrouter/auto", 39 | generation_kwargs={ 40 | "models": ["openai/gpt-4o-mini", "anthropic/claude-3-haiku"], 41 | }, 42 | ) 43 | messages = [ChatMessage.from_user("What's the weather in Tokyo?")] 44 | 45 | response = client.run(messages=messages, tools=[weather_tool])["replies"] 46 | 47 | print(f"assistant messages: {response[0]}\n") # noqa: T201 48 | 49 | # If the assistant message contains a tool call, run the tool invoker 50 | if response[0].tool_calls: 51 | tool_messages = tool_invoker.run(messages=response)["tool_messages"] 52 | print(f"tool messages: {tool_messages}") # noqa: T201 53 | -------------------------------------------------------------------------------- /integrations/openrouter/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.openrouter.chat.chat_generator", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: OpenRouter integration for Haystack 19 | category_slug: integrations-api 20 | title: OpenRouter 21 | slug: integrations-openrouter 22 | order: 200 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_openrouter.md -------------------------------------------------------------------------------- /integrations/openrouter/src/haystack_integrations/components/generators/openrouter/__init__.py: -------------------------------------------------------------------------------- 1 | from .chat.chat_generator import OpenRouterChatGenerator 2 | 3 | __all__ = ["OpenRouterChatGenerator"] 4 | -------------------------------------------------------------------------------- /integrations/openrouter/src/haystack_integrations/components/generators/openrouter/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/openrouter/src/haystack_integrations/components/generators/openrouter/chat/__init__.py -------------------------------------------------------------------------------- /integrations/openrouter/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/opensearch/README.md: -------------------------------------------------------------------------------- 1 | [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/opensearch.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/opensearch.yml) 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/opensearch-haystack.svg)](https://pypi.org/project/opensearch-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/opensearch-haystack.svg)](https://pypi.org/project/opensearch-haystack) 5 | 6 | # OpenSearch Document Store 7 | 8 | Document Store for Haystack 2.x, supports OpenSearch. 9 | 10 | ## Installation 11 | 12 | ```console 13 | pip install opensearch-haystack 14 | ``` 15 | 16 | ## Testing 17 | 18 | To run tests first start a Docker container running OpenSearch. We provide a utility `docker-compose.yml` for that: 19 | 20 | ```console 21 | docker-compose up 22 | ``` 23 | 24 | Then run tests: 25 | 26 | ```console 27 | hatch run test 28 | ``` 29 | 30 | ## License 31 | 32 | `opensearch-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 33 | -------------------------------------------------------------------------------- /integrations/opensearch/docker-compose.yml: -------------------------------------------------------------------------------- 1 | services: 2 | opensearch: 3 | image: "opensearchproject/opensearch:2.11.0" 4 | ports: 5 | - 9200:9200 6 | - 9600:9600 7 | restart: on-failure 8 | environment: 9 | - discovery.type=single-node 10 | - "ES_JAVA_OPTS=-Xms1024m -Xmx1024m" 11 | healthcheck: 12 | test: curl --fail https://localhost:9200/_cat/health -ku admin:admin || exit 1 13 | interval: 10s 14 | timeout: 1s 15 | retries: 10 -------------------------------------------------------------------------------- /integrations/opensearch/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.opensearch.bm25_retriever", 6 | "haystack_integrations.components.retrievers.opensearch.embedding_retriever", 7 | "haystack_integrations.components.retrievers.opensearch.open_search_hybrid_retriever", 8 | "haystack_integrations.document_stores.opensearch.document_store", 9 | "haystack_integrations.document_stores.opensearch.filters", 10 | ] 11 | ignore_when_discovered: ["__init__"] 12 | processors: 13 | - type: filter 14 | expression: 15 | documented_only: true 16 | do_not_filter_modules: false 17 | skip_empty_modules: true 18 | - type: smart 19 | - type: crossref 20 | renderer: 21 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 22 | excerpt: OpenSearch integration for Haystack 23 | category_slug: integrations-api 24 | title: OpenSearch 25 | slug: integrations-opensearch 26 | order: 180 27 | markdown: 28 | descriptive_class_title: false 29 | classdef_code_block: false 30 | descriptive_module_title: true 31 | add_method_class_prefix: true 32 | add_member_class_prefix: false 33 | filename: _readme_opensearch.md 34 | -------------------------------------------------------------------------------- /integrations/opensearch/src/haystack_integrations/components/retrievers/opensearch/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .bm25_retriever import OpenSearchBM25Retriever 6 | from .embedding_retriever import OpenSearchEmbeddingRetriever 7 | from .open_search_hybrid_retriever import OpenSearchHybridRetriever 8 | 9 | __all__ = ["OpenSearchBM25Retriever", "OpenSearchEmbeddingRetriever", "OpenSearchHybridRetriever"] 10 | -------------------------------------------------------------------------------- /integrations/opensearch/src/haystack_integrations/document_stores/opensearch/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import OpenSearchDocumentStore 5 | 6 | __all__ = ["OpenSearchDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/opensearch/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/optimum/README.md: -------------------------------------------------------------------------------- 1 | # optimum 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/optimum-haystack.svg)](https://pypi.org/project/optimum-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/optimum-haystack.svg)](https://pypi.org/project/optimum-haystack) 5 | 6 | --- 7 | 8 | Component to embed strings and Documents using models loaded with the HuggingFace Optimum library. This component is designed to seamlessly inference models using the high speed ONNX runtime. 9 | 10 | **Table of Contents** 11 | 12 | - [optimum](#optimum) 13 | - [Installation](#installation) 14 | - [License](#license) 15 | 16 | ## Installation 17 | 18 | ```console 19 | pip install optimum-haystack 20 | ``` 21 | 22 | ## License 23 | 24 | `optimum-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 25 | -------------------------------------------------------------------------------- /integrations/optimum/example/example.py: -------------------------------------------------------------------------------- 1 | # This example requires GPU support to execute. 2 | 3 | from haystack import Pipeline 4 | 5 | from haystack_integrations.components.embedders.optimum import ( 6 | OptimumEmbedderOptimizationConfig, 7 | OptimumEmbedderOptimizationMode, 8 | OptimumEmbedderPooling, 9 | OptimumTextEmbedder, 10 | ) 11 | 12 | pipeline = Pipeline() 13 | embedder = OptimumTextEmbedder( 14 | model="intfloat/e5-base-v2", 15 | normalize_embeddings=True, 16 | onnx_execution_provider="CUDAExecutionProvider", 17 | optimizer_settings=OptimumEmbedderOptimizationConfig( 18 | mode=OptimumEmbedderOptimizationMode.O4, 19 | for_gpu=True, 20 | ), 21 | working_dir="/tmp/optimum", 22 | pooling_mode=OptimumEmbedderPooling.MEAN, 23 | ) 24 | pipeline.add_component("embedder", embedder) 25 | 26 | results = pipeline.run( 27 | { 28 | "embedder": { 29 | "text": "Ex profunditate antiquae doctrinae, Ad caelos supra semper, Hoc incantamentum evoco, draco apparet, Incantamentum iam transactum est" 30 | }, 31 | } 32 | ) 33 | 34 | print(results["embedder"]["embedding"]) 35 | -------------------------------------------------------------------------------- /integrations/optimum/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.embedders.optimum.optimum_document_embedder", 7 | "haystack_integrations.components.embedders.optimum.optimum_text_embedder", 8 | "haystack_integrations.components.embedders.optimum.pooling", 9 | "haystack_integrations.components.embedders.optimum.optimization", 10 | "haystack_integrations.components.embedders.optimum.quantization", 11 | ] 12 | ignore_when_discovered: ["__init__"] 13 | processors: 14 | - type: filter 15 | expression: 16 | documented_only: true 17 | do_not_filter_modules: false 18 | skip_empty_modules: true 19 | - type: smart 20 | - type: crossref 21 | renderer: 22 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 23 | excerpt: Optimum integration for Haystack 24 | category_slug: integrations-api 25 | title: Optimum 26 | slug: integrations-optimum 27 | order: 185 28 | markdown: 29 | descriptive_class_title: false 30 | classdef_code_block: false 31 | descriptive_module_title: true 32 | add_method_class_prefix: true 33 | add_member_class_prefix: false 34 | filename: _readme_optimum.md 35 | -------------------------------------------------------------------------------- /integrations/optimum/src/haystack_integrations/components/embedders/optimum/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .optimization import OptimumEmbedderOptimizationConfig, OptimumEmbedderOptimizationMode 6 | from .optimum_document_embedder import OptimumDocumentEmbedder 7 | from .optimum_text_embedder import OptimumTextEmbedder 8 | from .pooling import OptimumEmbedderPooling 9 | from .quantization import OptimumEmbedderQuantizationConfig, OptimumEmbedderQuantizationMode 10 | 11 | __all__ = [ 12 | "OptimumDocumentEmbedder", 13 | "OptimumEmbedderOptimizationConfig", 14 | "OptimumEmbedderOptimizationMode", 15 | "OptimumEmbedderPooling", 16 | "OptimumEmbedderQuantizationConfig", 17 | "OptimumEmbedderQuantizationMode", 18 | "OptimumTextEmbedder", 19 | ] 20 | -------------------------------------------------------------------------------- /integrations/optimum/src/haystack_integrations/components/embedders/optimum/pooling.py: -------------------------------------------------------------------------------- 1 | from enum import Enum 2 | 3 | 4 | class OptimumEmbedderPooling(Enum): 5 | """ 6 | Pooling modes support by the Optimum Embedders. 7 | """ 8 | 9 | #: Perform CLS Pooling on the output of the embedding model 10 | #: using the first token (CLS token). 11 | CLS = "cls" 12 | 13 | #: Perform Mean Pooling on the output of the embedding model. 14 | MEAN = "mean" 15 | 16 | #: Perform Max Pooling on the output of the embedding model 17 | #: using the maximum value in each dimension over all the tokens. 18 | MAX = "max" 19 | 20 | #: Perform mean-pooling on the output of the embedding model but 21 | #: divide by the square root of the sequence length. 22 | MEAN_SQRT_LEN = "mean_sqrt_len" 23 | 24 | #: Perform weighted (position) mean pooling on the output of the 25 | #: embedding model. 26 | WEIGHTED_MEAN = "weighted_mean" 27 | 28 | #: Perform Last Token Pooling on the output of the embedding model. 29 | LAST_TOKEN = "last_token" 30 | 31 | def __str__(self): 32 | return self.value 33 | 34 | @classmethod 35 | def from_str(cls, string: str) -> "OptimumEmbedderPooling": 36 | """ 37 | Create a pooling mode from a string. 38 | 39 | :param string: 40 | String to convert. 41 | :returns: 42 | Pooling mode. 43 | """ 44 | enum_map = {e.value: e for e in OptimumEmbedderPooling} 45 | pooling_mode = enum_map.get(string) 46 | if pooling_mode is None: 47 | msg = f"Unknown Pooling mode '{string}'. Supported modes are: {list(enum_map.keys())}" 48 | raise ValueError(msg) 49 | return pooling_mode 50 | -------------------------------------------------------------------------------- /integrations/optimum/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/pgvector/README.md: -------------------------------------------------------------------------------- 1 | # pgvector-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pgvector-haystack.svg)](https://pypi.org/project/pgvector-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [pgvector-haystack](#pgvector-haystack) 11 | - [Installation](#installation) 12 | - [Testing](#testing) 13 | - [License](#license) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install pgvector-haystack 19 | ``` 20 | 21 | ## Testing 22 | 23 | Ensure that you have a PostgreSQL running with the `pgvector` extension. For a quick setup using Docker, run: 24 | ``` 25 | docker run -d -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=postgres pgvector/pgvector:pg17 26 | ``` 27 | 28 | then run the tests: 29 | 30 | ```console 31 | hatch run test 32 | ``` 33 | 34 | To run the coverage report: 35 | 36 | ```console 37 | hatch run cov 38 | ``` 39 | 40 | ## License 41 | 42 | `pgvector-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 43 | -------------------------------------------------------------------------------- /integrations/pgvector/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.retrievers.pgvector.embedding_retriever", 6 | "haystack_integrations.components.retrievers.pgvector.keyword_retriever", 7 | "haystack_integrations.document_stores.pgvector.document_store", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Pgvector integration for Haystack 21 | category_slug: integrations-api 22 | title: Pgvector 23 | slug: integrations-pgvector 24 | order: 190 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_pgvector.md 32 | -------------------------------------------------------------------------------- /integrations/pgvector/src/haystack_integrations/components/retrievers/pgvector/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .embedding_retriever import PgvectorEmbeddingRetriever 5 | from .keyword_retriever import PgvectorKeywordRetriever 6 | 7 | __all__ = ["PgvectorEmbeddingRetriever", "PgvectorKeywordRetriever"] 8 | -------------------------------------------------------------------------------- /integrations/pgvector/src/haystack_integrations/document_stores/pgvector/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import PgvectorDocumentStore 5 | 6 | __all__ = ["PgvectorDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/pgvector/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/pinecone/README.md: -------------------------------------------------------------------------------- 1 | [![test](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/pinecone.yml/badge.svg)](https://github.com/deepset-ai/haystack-core-integrations/actions/workflows/pinecone.yml) 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/pinecone-haystack.svg)](https://pypi.org/project/pinecone-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pinecone-haystack.svg)](https://pypi.org/project/pinecone-haystack) 5 | 6 | # Pinecone Document Store 7 | 8 | Document Store for Haystack 2.x, supports Pinecone. 9 | 10 | ## Installation 11 | 12 | ```console 13 | pip install pinecone-haystack 14 | ``` 15 | 16 | ## Testing 17 | 18 | ```console 19 | hatch run test 20 | ``` 21 | 22 | ## License 23 | 24 | `pinecone-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 25 | -------------------------------------------------------------------------------- /integrations/pinecone/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.retrievers.pinecone.embedding_retriever", 7 | "haystack_integrations.document_stores.pinecone.document_store" 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: Pinecone integration for Haystack 21 | category_slug: integrations-api 22 | title: Pinecone 23 | slug: integrations-pinecone 24 | order: 200 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_pinecone.md 32 | -------------------------------------------------------------------------------- /integrations/pinecone/src/haystack_integrations/components/retrievers/pinecone/__init__.py: -------------------------------------------------------------------------------- 1 | from .embedding_retriever import PineconeEmbeddingRetriever 2 | 3 | __all__ = ["PineconeEmbeddingRetriever"] 4 | -------------------------------------------------------------------------------- /integrations/pinecone/src/haystack_integrations/document_stores/pinecone/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_store import PineconeDocumentStore 5 | 6 | __all__ = ["PineconeDocumentStore"] 7 | -------------------------------------------------------------------------------- /integrations/pinecone/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/qdrant/README.md: -------------------------------------------------------------------------------- 1 | # qdrant-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/qdrant-haystack.svg)](https://pypi.org/project/qdrant-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/qdrant-haystack.svg)](https://pypi.org/project/qdrant-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install qdrant-haystack 17 | ``` 18 | 19 | ## Testing 20 | The test suites use Qdrant's in-memory instance. No additional steps required. 21 | 22 | ```console 23 | hatch run test 24 | ``` 25 | 26 | ## License 27 | 28 | `qdrant-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 29 | -------------------------------------------------------------------------------- /integrations/qdrant/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.retrievers.qdrant.retriever", 7 | "haystack_integrations.document_stores.qdrant.document_store", 8 | "haystack_integrations.document_stores.qdrant.migrate_to_sparse", 9 | ] 10 | ignore_when_discovered: ["__init__"] 11 | processors: 12 | - type: filter 13 | expression: 14 | documented_only: true 15 | do_not_filter_modules: false 16 | skip_empty_modules: true 17 | - type: smart 18 | - type: crossref 19 | renderer: 20 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 21 | excerpt: Qdrant integration for Haystack 22 | category_slug: integrations-api 23 | title: Qdrant 24 | slug: integrations-qdrant 25 | order: 210 26 | markdown: 27 | descriptive_class_title: false 28 | classdef_code_block: false 29 | descriptive_module_title: true 30 | add_method_class_prefix: true 31 | add_member_class_prefix: false 32 | filename: _readme_qdrant.md 33 | -------------------------------------------------------------------------------- /integrations/qdrant/src/haystack_integrations/components/retrievers/qdrant/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .retriever import QdrantEmbeddingRetriever, QdrantHybridRetriever, QdrantSparseEmbeddingRetriever 6 | 7 | __all__ = ("QdrantEmbeddingRetriever", "QdrantHybridRetriever", "QdrantSparseEmbeddingRetriever") 8 | -------------------------------------------------------------------------------- /integrations/qdrant/src/haystack_integrations/document_stores/qdrant/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .document_store import QdrantDocumentStore 6 | from .migrate_to_sparse import migrate_to_sparse_embeddings_support 7 | 8 | __all__ = ("QdrantDocumentStore", "migrate_to_sparse_embeddings_support") 9 | -------------------------------------------------------------------------------- /integrations/qdrant/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/qdrant/tests/conftest.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pytest 3 | from haystack.dataclasses import SparseEmbedding 4 | 5 | 6 | @pytest.fixture(scope="session") 7 | def generate_sparse_embedding(): 8 | """ 9 | This fixture returns a function that generates a random SparseEmbedding each time it is called. 10 | """ 11 | 12 | def _generate_random_sparse_embedding(): 13 | random_indice_length = np.random.randint(3, 15) 14 | indices = list(range(random_indice_length)) 15 | values = [np.random.random_sample() for _ in range(random_indice_length)] 16 | return SparseEmbedding(indices=indices, values=values) 17 | 18 | return _generate_random_sparse_embedding 19 | -------------------------------------------------------------------------------- /integrations/ragas/README.md: -------------------------------------------------------------------------------- 1 | # ragas-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/ragas-haystack.svg)](https://pypi.org/project/ragas-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/ragas-haystack.svg)](https://pypi.org/project/ragas-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [ragas-haystack](#ragas-haystack) 11 | - [Installation](#installation) 12 | - [Testing](#testing) 13 | - [Examples](#examples) 14 | - [License](#license) 15 | 16 | ## Installation 17 | 18 | ```console 19 | pip install ragas-haystack 20 | ``` 21 | 22 | For more information about the Ragas evaluation framework, please refer to their [documentation](https://docs.ragas.io/). 23 | 24 | ## Testing 25 | 26 | ```console 27 | hatch run test 28 | ``` 29 | 30 | ## Examples 31 | 32 | You can find code examples showing how to use the Evaluator under the `example/` folder of this repo. 33 | 34 | ## License 35 | 36 | `ragas-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 37 | -------------------------------------------------------------------------------- /integrations/ragas/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.evaluators.ragas.evaluator" 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: Ragas integration for Haystack 20 | category_slug: integrations-api 21 | title: Ragas 22 | slug: integrations-ragas 23 | order: 220 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_ragas.md 31 | -------------------------------------------------------------------------------- /integrations/ragas/src/haystack_integrations/components/evaluators/ragas/__init__.py: -------------------------------------------------------------------------------- 1 | from .evaluator import RagasEvaluator 2 | 3 | __all__ = ["RagasEvaluator"] 4 | -------------------------------------------------------------------------------- /integrations/ragas/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/ragas/tests/__init__.py -------------------------------------------------------------------------------- /integrations/snowflake/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/snowflake-v1.0.1] - 2025-05-28 4 | 5 | ### 🌀 Miscellaneous 6 | 7 | - Add pins for Snowflake + small refactoring (#1860) 8 | 9 | ## [integrations/snowflake-v1.0.0] - 2025-04-10 10 | 11 | ### 🚜 Refactor 12 | 13 | - Update the Snowflake component to utilize Polars and ADBC for improved performance. (#1630) 14 | 15 | ### ⚙️ CI 16 | 17 | - Review testing workflows (#1541) 18 | 19 | 20 | ## [integrations/snowflake-v0.0.4] - 2025-03-11 21 | 22 | ### 🧹 Chores 23 | 24 | - Remove Python 3.8 support (#1421) 25 | 26 | ### 🌀 Miscellaneous 27 | 28 | - Snowflake - add pandas depenency (#1520) 29 | 30 | ## [integrations/snowflake-v0.0.3] - 2024-12-13 31 | 32 | ### ⚙️ CI 33 | 34 | - Adopt uv as installer (#1142) 35 | 36 | ### 🧹 Chores 37 | 38 | - Update ruff linting scripts and settings (#1105) 39 | - Add application name (#1245) 40 | 41 | 42 | ## [integrations/snowflake-v0.0.2] - 2024-09-25 43 | 44 | ### 🚀 Features 45 | 46 | - Add Snowflake integration (#1064) 47 | 48 | ### ⚙️ CI 49 | 50 | - Adding github workflow for Snowflake (#1097) 51 | 52 | ### 🌀 Miscellaneous 53 | 54 | - Docs: upd snowflake pydoc (#1102) 55 | 56 | 57 | -------------------------------------------------------------------------------- /integrations/snowflake/README.md: -------------------------------------------------------------------------------- 1 | # snowflake-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/snowflake-haystack.svg)](https://pypi.org/project/snowflake-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/snowflake-haystack.svg)](https://pypi.org/project/snowflake-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install snowflake-haystack 17 | ``` 18 | ## Examples 19 | You can find a code example showing how to use the Retriever under the `example/` folder of this repo. 20 | 21 | ## License 22 | 23 | `snowflake-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. -------------------------------------------------------------------------------- /integrations/snowflake/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.components.retrievers.snowflake.snowflake_table_retriever", 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: Snowflake integration for Haystack 20 | category_slug: integrations-api 21 | title: Snowflake 22 | slug: integrations-snowflake 23 | order: 225 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_snowflake.md 31 | -------------------------------------------------------------------------------- /integrations/snowflake/src/haystack_integrations/components/retrievers/snowflake/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .snowflake_table_retriever import SnowflakeTableRetriever 6 | 7 | __all__ = ["SnowflakeTableRetriever"] 8 | -------------------------------------------------------------------------------- /integrations/snowflake/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2024-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/stackit/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/stackit-v1.1.0] - 2025-05-23 4 | 5 | ### 🚀 Features 6 | 7 | - Add `to_dict` to `STACKITDocumentEmbedder` and `STACKITTextEmbedder` and more init parameters from underlying OpenAI classes (#1779) 8 | 9 | 10 | ### 🧪 Testing 11 | 12 | - Mistral/Stackit - add pytz test dependency (#1504) 13 | 14 | ### ⚙️ CI 15 | 16 | - Review testing workflows (#1541) 17 | 18 | ### 🌀 Miscellaneous 19 | 20 | - Fix: Fix Stackit sede tests (#1667) 21 | - Docs: add missing STACKIT Embedders to API Reference (#1737) 22 | 23 | ## [integrations/stackit-v1.0.1] - 2025-02-28 24 | 25 | ### 📚 Documentation 26 | 27 | - Add STACKIT to readme and update pypi links (#1452) 28 | 29 | ## [integrations/stackit-v1.0.0] - 2025-02-27 30 | 31 | ### 🚀 Features 32 | 33 | - Add STACKITChatGenerator and Embedders (#1274) 34 | 35 | 36 | -------------------------------------------------------------------------------- /integrations/stackit/README.md: -------------------------------------------------------------------------------- 1 | # stackit 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/stackit-haystack.svg)](https://pypi.org/project/stackit-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/stackit-haystack.svg)](https://pypi.org/project/stackit-haystack) 5 | 6 | ----- 7 | 8 | ## Table of Contents 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install stackit-haystack 17 | ``` 18 | 19 | ## License 20 | 21 | `stackit-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 22 | -------------------------------------------------------------------------------- /integrations/stackit/examples/chat_as_component.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need to set a `STACKIT_API_KEY` environment variable. 2 | 3 | from haystack.dataclasses import ChatMessage 4 | 5 | from haystack_integrations.components.generators.stackit import STACKITChatGenerator 6 | 7 | generator = STACKITChatGenerator(model="neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8") 8 | 9 | result = generator.run([ChatMessage.from_user("Tell me a joke.")]) 10 | print(result) # noqa: T201 11 | -------------------------------------------------------------------------------- /integrations/stackit/examples/chat_as_pipeline.py: -------------------------------------------------------------------------------- 1 | # To run this example, you will need to set a `STACKIT_API_KEY` environment variable. 2 | 3 | from haystack import Pipeline 4 | from haystack.components.builders import ChatPromptBuilder 5 | from haystack.dataclasses import ChatMessage 6 | 7 | from haystack_integrations.components.generators.stackit import STACKITChatGenerator 8 | 9 | prompt_builder = ChatPromptBuilder() 10 | llm = STACKITChatGenerator(model="neuralmagic/Meta-Llama-3.1-70B-Instruct-FP8") 11 | 12 | messages = [ChatMessage.from_user("Question: {{question}} \\n")] 13 | 14 | pipeline = Pipeline() 15 | pipeline.add_component("prompt_builder", prompt_builder) 16 | pipeline.add_component("llm", llm) 17 | 18 | pipeline.connect("prompt_builder.prompt", "llm.messages") 19 | 20 | result = pipeline.run({"prompt_builder": {"template_variables": {"question": "Tell me a joke."}, "template": messages}}) 21 | 22 | print(result) # noqa: T201 23 | -------------------------------------------------------------------------------- /integrations/stackit/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.generators.stackit.chat.chat_generator", 6 | "haystack_integrations.components.embedders.stackit.document_embedder", 7 | "haystack_integrations.components.embedders.stackit.text_embedder", 8 | ] 9 | ignore_when_discovered: ["__init__"] 10 | processors: 11 | - type: filter 12 | expression: 13 | documented_only: true 14 | do_not_filter_modules: false 15 | skip_empty_modules: true 16 | - type: smart 17 | - type: crossref 18 | renderer: 19 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 20 | excerpt: STACKIT integration for Haystack 21 | category_slug: integrations-api 22 | title: STACKIT 23 | slug: integrations-stackit 24 | order: 150 25 | markdown: 26 | descriptive_class_title: false 27 | classdef_code_block: false 28 | descriptive_module_title: true 29 | add_method_class_prefix: true 30 | add_member_class_prefix: false 31 | filename: _readme_stackit.md -------------------------------------------------------------------------------- /integrations/stackit/src/haystack_integrations/components/embedders/stackit/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .document_embedder import STACKITDocumentEmbedder 5 | from .text_embedder import STACKITTextEmbedder 6 | 7 | __all__ = ["STACKITDocumentEmbedder", "STACKITTextEmbedder"] 8 | -------------------------------------------------------------------------------- /integrations/stackit/src/haystack_integrations/components/generators/stackit/__init__.py: -------------------------------------------------------------------------------- 1 | from .chat.chat_generator import STACKITChatGenerator 2 | 3 | __all__ = ["STACKITChatGenerator"] 4 | -------------------------------------------------------------------------------- /integrations/stackit/src/haystack_integrations/components/generators/stackit/chat/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/stackit/src/haystack_integrations/components/generators/stackit/chat/__init__.py -------------------------------------------------------------------------------- /integrations/stackit/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2025-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/unstructured/README.md: -------------------------------------------------------------------------------- 1 | # unstructured-fileconverter-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/unstructured-fileconverter-haystack.svg)](https://pypi.org/project/unstructured-fileconverter-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/unstructured-fileconverter-haystack.svg)](https://pypi.org/project/unstructured-fileconverter-haystack) 5 | 6 | ----- 7 | 8 | **Table of Contents** 9 | 10 | - [unstructured-fileconverter-haystack](#unstructured-fileconverter-haystack) 11 | - [Installation](#installation) 12 | - [License](#license) 13 | - [Testing](#testing) 14 | 15 | ## Installation 16 | 17 | ```console 18 | pip install unstructured-fileconverter-haystack 19 | ``` 20 | 21 | ## License 22 | 23 | `unstructured-fileconverter-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 24 | 25 | ## Testing 26 | 27 | To run tests, first start a Docker container running the Unstructured API: 28 | 29 | ```console 30 | docker run -p 8000:8000 -d --rm --name unstructured-api quay.io/unstructured-io/unstructured-api:latest --port 8000 --host 0.0.0.0 31 | ``` 32 | 33 | Then run tests: 34 | 35 | ```console 36 | hatch run test 37 | ``` -------------------------------------------------------------------------------- /integrations/unstructured/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.converters.unstructured.converter", 6 | ] 7 | ignore_when_discovered: ["__init__"] 8 | processors: 9 | - type: filter 10 | expression: 11 | documented_only: true 12 | do_not_filter_modules: false 13 | skip_empty_modules: true 14 | - type: smart 15 | - type: crossref 16 | renderer: 17 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 18 | excerpt: Unstructured integration for Haystack 19 | category_slug: integrations-api 20 | title: Unstructured 21 | slug: integrations-unstructured 22 | order: 230 23 | markdown: 24 | descriptive_class_title: false 25 | classdef_code_block: false 26 | descriptive_module_title: true 27 | add_method_class_prefix: true 28 | add_member_class_prefix: false 29 | filename: _readme_unstructured.md 30 | -------------------------------------------------------------------------------- /integrations/unstructured/src/haystack_integrations/components/converters/unstructured/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .converter import UnstructuredFileConverter 5 | 6 | __all__ = ["UnstructuredFileConverter"] 7 | -------------------------------------------------------------------------------- /integrations/unstructured/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/unstructured/tests/conftest.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | import pytest 4 | 5 | 6 | @pytest.fixture 7 | def set_env_variables(monkeypatch): 8 | monkeypatch.setenv("UNSTRUCTURED_API_KEY", "test-api-key") 9 | 10 | 11 | @pytest.fixture 12 | def samples_path(): 13 | return Path(__file__).parent / "samples" 14 | -------------------------------------------------------------------------------- /integrations/unstructured/tests/samples/sample_pdf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/unstructured/tests/samples/sample_pdf.pdf -------------------------------------------------------------------------------- /integrations/unstructured/tests/samples/sample_pdf2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/unstructured/tests/samples/sample_pdf2.pdf -------------------------------------------------------------------------------- /integrations/weaviate/README.md: -------------------------------------------------------------------------------- 1 | # weaviate-haystack 2 | 3 | [![PyPI - Version](https://img.shields.io/pypi/v/weaviate-haystack.svg)](https://pypi.org/project/weaviate-haystack) 4 | [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/weaviate-haystack.svg)](https://pypi.org/project/weaviate-haystack) 5 | 6 | --- 7 | 8 | **Table of Contents** 9 | 10 | - [Installation](#installation) 11 | - [License](#license) 12 | 13 | ## Installation 14 | 15 | ```console 16 | pip install weaviate-haystack 17 | ``` 18 | 19 | ## Testing 20 | 21 | TODO 22 | 23 | ```console 24 | hatch run test 25 | ``` 26 | 27 | ## License 28 | 29 | `weaviate-haystack` is distributed under the terms of the [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) license. 30 | -------------------------------------------------------------------------------- /integrations/weaviate/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3.4' 2 | services: 3 | weaviate: 4 | command: 5 | - --host 6 | - 0.0.0.0 7 | - --port 8 | - '8080' 9 | - --scheme 10 | - http 11 | image: semitechnologies/weaviate:1.24.5 12 | ports: 13 | - 8080:8080 14 | - 50051:50051 15 | restart: on-failure:0 16 | environment: 17 | QUERY_DEFAULTS_LIMIT: 25 18 | AUTHENTICATION_ANONYMOUS_ACCESS_ENABLED: 'true' 19 | PERSISTENCE_DATA_PATH: '/var/lib/weaviate' 20 | DEFAULT_VECTORIZER_MODULE: 'none' 21 | ENABLE_MODULES: '' 22 | CLUSTER_HOSTNAME: 'node1' -------------------------------------------------------------------------------- /integrations/weaviate/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: 5 | [ 6 | "haystack_integrations.document_stores.weaviate.auth", 7 | "haystack_integrations.document_stores.weaviate.document_store", 8 | "haystack_integrations.components.retrievers.weaviate.bm25_retriever", 9 | "haystack_integrations.components.retrievers.weaviate.embedding_retriever", 10 | ] 11 | ignore_when_discovered: ["__init__"] 12 | processors: 13 | - type: filter 14 | expression: 15 | documented_only: true 16 | do_not_filter_modules: false 17 | skip_empty_modules: true 18 | - type: smart 19 | - type: crossref 20 | renderer: 21 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 22 | excerpt: Weaviate integration for Haystack 23 | category_slug: integrations-api 24 | title: Weaviate 25 | slug: integrations-weaviate 26 | order: 250 27 | markdown: 28 | descriptive_class_title: false 29 | classdef_code_block: false 30 | descriptive_module_title: true 31 | add_method_class_prefix: true 32 | add_member_class_prefix: false 33 | filename: _readme_weaviate.md 34 | -------------------------------------------------------------------------------- /integrations/weaviate/src/haystack_integrations/components/retrievers/weaviate/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .bm25_retriever import WeaviateBM25Retriever 6 | from .embedding_retriever import WeaviateEmbeddingRetriever 7 | 8 | __all__ = ["WeaviateBM25Retriever", "WeaviateEmbeddingRetriever"] 9 | -------------------------------------------------------------------------------- /integrations/weaviate/src/haystack_integrations/document_stores/weaviate/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | from .auth import AuthApiKey, AuthBearerToken, AuthClientCredentials, AuthClientPassword, AuthCredentials 5 | from .document_store import WeaviateDocumentStore 6 | 7 | __all__ = [ 8 | "AuthApiKey", 9 | "AuthBearerToken", 10 | "AuthClientCredentials", 11 | "AuthClientPassword", 12 | "AuthCredentials", 13 | "WeaviateDocumentStore", 14 | ] 15 | -------------------------------------------------------------------------------- /integrations/weaviate/tests/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /integrations/weaviate/tests/conftest.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from pathlib import Path 6 | 7 | import pytest 8 | 9 | 10 | @pytest.fixture() 11 | def test_files_path(): 12 | return Path(__file__).parent / "test_files" 13 | -------------------------------------------------------------------------------- /integrations/weaviate/tests/test_files/robot1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/deepset-ai/haystack-core-integrations/9831cb5f4e58ccff508debda36038d5b8cfdd812/integrations/weaviate/tests/test_files/robot1.jpg -------------------------------------------------------------------------------- /integrations/weaviate/tests/test_filters.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from haystack_integrations.document_stores.weaviate._filters import _invert_condition 6 | 7 | 8 | def test_invert_conditions(): 9 | filters = { 10 | "operator": "NOT", 11 | "conditions": [ 12 | {"field": "meta.number", "operator": "==", "value": 100}, 13 | {"field": "meta.name", "operator": "==", "value": "name_0"}, 14 | { 15 | "operator": "OR", 16 | "conditions": [ 17 | {"field": "meta.name", "operator": "==", "value": "name_1"}, 18 | {"field": "meta.name", "operator": "==", "value": "name_2"}, 19 | ], 20 | }, 21 | ], 22 | } 23 | 24 | inverted = _invert_condition(filters) 25 | assert inverted == { 26 | "operator": "OR", 27 | "conditions": [ 28 | {"field": "meta.number", "operator": "!=", "value": 100}, 29 | {"field": "meta.name", "operator": "!=", "value": "name_0"}, 30 | { 31 | "conditions": [ 32 | {"field": "meta.name", "operator": "!=", "value": "name_1"}, 33 | {"field": "meta.name", "operator": "!=", "value": "name_2"}, 34 | ], 35 | "operator": "AND", 36 | }, 37 | ], 38 | } 39 | -------------------------------------------------------------------------------- /integrations/weights_and_biases_weave/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [integrations/weights_and_biases_weave-v0.0.1] - 2025-03-28 4 | 5 | ### 🚜 Refactor 6 | 7 | - Renaming the project/package to weights_biases_weave (#1565) 8 | 9 | 10 | -------------------------------------------------------------------------------- /integrations/weights_and_biases_weave/example/README.md: -------------------------------------------------------------------------------- 1 | # Accessing Weights & Biases Weave 2 | 3 | You need to have a Weave account to use this feature. You can sign up for free at https://wandb.ai/site. 4 | 5 | You then need to set the `WANDB_API_KEY:` environment variable with your Weights & Biases API key. You should find 6 | your API key in https://wandb.ai/home when you are logged in. 7 | 8 | You should then head to `https://wandb.ai//projects` and see the complete trace for your pipeline under 9 | the pipeline name you specified, when creating the `WeaveConnector`. 10 | -------------------------------------------------------------------------------- /integrations/weights_and_biases_weave/pydoc/config.yml: -------------------------------------------------------------------------------- 1 | loaders: 2 | - type: haystack_pydoc_tools.loaders.CustomPythonLoader 3 | search_path: [../src] 4 | modules: [ 5 | "haystack_integrations.components.connectors.weave_connector", 6 | "haystack_integrations.tracing.weave.tracer", 7 | ] 8 | ignore_when_discovered: ["__init__"] 9 | processors: 10 | - type: filter 11 | expression: 12 | documented_only: true 13 | do_not_filter_modules: false 14 | skip_empty_modules: true 15 | - type: smart 16 | - type: crossref 17 | renderer: 18 | type: haystack_pydoc_tools.renderers.ReadmeIntegrationRenderer 19 | excerpt: Weights & Bias integration for Haystack 20 | category_slug: integrations-api 21 | title: weights and bias 22 | slug: integrations-weights-bias 23 | order: 260 24 | markdown: 25 | descriptive_class_title: false 26 | classdef_code_block: false 27 | descriptive_module_title: true 28 | add_method_class_prefix: true 29 | add_member_class_prefix: false 30 | filename: _readme_weights_and_bias.md 31 | -------------------------------------------------------------------------------- /integrations/weights_and_biases_weave/src/haystack_integrations/components/connectors/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .weave_connector import WeaveConnector 6 | 7 | __all__ = ["WeaveConnector"] 8 | -------------------------------------------------------------------------------- /integrations/weights_and_biases_weave/src/haystack_integrations/tracing/weave/__init__.py: -------------------------------------------------------------------------------- 1 | # SPDX-FileCopyrightText: 2023-present deepset GmbH 2 | # 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from .tracer import WeaveSpan, WeaveTracer 6 | 7 | __all__ = ["WeaveSpan", "WeaveTracer"] 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | hatch 2 | -------------------------------------------------------------------------------- /show_unreleased.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | INTEGRATION=$1 3 | if [ -z "${INTEGRATION}" ] ; then 4 | echo "Please provide the name of an integration, for example:" 5 | echo "./$(basename $0) chroma" 6 | exit 1 7 | fi 8 | LATEST_TAG=$(git tag -l --sort=-creatordate "integrations/${INTEGRATION}-v*" | head -n 1) 9 | git --no-pager diff $LATEST_TAG..main integrations/${INTEGRATION} 10 | --------------------------------------------------------------------------------