NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #5108 most downloaded on PyPI
LLM framework to build customizable, production-ready LLM applications. Connect components (models, vector DBs, file converters) to pipelines or agents that can interact with your data.
Last release today
05 Oct 2026
Ships fairly regularly
a new release about every 8 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
3 years old
231 releases · first in 2023
Revert change to PyPDFConverter that broke the deserialization of pre 2.6.0 YAMLs.
The DefaultConverter class used by the PyPDFToDocument component has been deprecated. Its functionality will be merged into the component in 2.7.0.
gpt-3.5-turbo was replaced by gpt-4o-mini as the default model for all components relying on OpenAI APIAdded a new component DocumentNDCGEvaluator, which is similar to DocumentMRREvaluator and useful for retrieval evaluation. It calculates the normalized discounted cumulative gain, an evaluation metric useful when there are multiple ground truth relevant documents and the order in which they are retrieved is important.
Add new CSVToDocument component. Loads the file as bytes object. Adds the loaded string as a new document that can be used for further processing by the Document Splitter.
Adds support for zero shot document classification via new TransformersZeroShotDocumentClassifier component. This allows you to classify documents into user-defined classes (binary and multi-label classification) using pre-trained models from Hugging Face.
Added the option to use a custom splitting function in DocumentSplitter. The function must accept a string as input and return a list of strings, representing the split units. To use the feature initialise DocumentSplitter with split_by="function" providing the custom splitting function as splitting_function=custom_function.
Add new JSONConverter Component to convert JSON files to Document. Optionally it can use jq to filter the source JSON files and extract only specific parts.
import json
from haystack.components.converters import JSONConverter
from haystack.dataclasses import ByteStream
data = {
"laureates": [
{
"firstname": "Enrico",
"surname": "Fermi",
"motivation": "for his demonstrations of the existence of new radioactive elements produced "
"by neutron irradiation, and for his related discovery of nuclear reactions brought about by slow neutrons",
},
{
"firstname": "Rita",
"surname": "Levi-Montalcini",
"motivation": "for their discoveries of growth factors",
},
],
}
source = ByteStream.from_string(json.dumps(data))
converter = JSONConverter(jq_schema=".laureates[]", content_key="motivation", extra_meta_fields=["firstname", "surname"])
results = converter.run(sources=[source])
documents = results["documents"] print(documents[0].content)
# 'for his demonstrations of the existence of new radioactive elements produced by
# neutron irradiation, and for his related discovery of nuclear reactions brought
# about by slow neutrons'
print(documents[0].meta)
# {'firstname': 'Enrico', 'surname': 'Fermi'}
print(documents[1].content)
# 'for their discoveries of growth factors' print(documents[1].meta) # {'firstname': 'Rita', 'surname': 'Levi-Montalcini'}
Added a new NLTKDocumentSplitter, a component enhancing document preprocessing capabilities with NLTK. This feature allows for fine-grained control over the splitting of documents into smaller parts based on configurable criteria such as word count, sentence boundaries, and page breaks. It supports multiple languages and offers options for handling sentence boundaries and abbreviations, facilitating better handling of various document types for further processing tasks.
Updates SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder so model_max_length passed through tokenizer_kwargs also updates the max_seq_length of the underlying SentenceTransformer model.
Adapts how ChatPromptBuilder creates ChatMessages. Messages are deep copied to ensure all meta fields are copied correctly.
Expose default_headers to pass custom headers to Azure API including APIM subscription key.
Add optional azure_kwargs dictionary parameter to pass in parameters undefined in Haystack but supported by AzureOpenAI.
Allow the ability to add the current date inside a template in PromptBuilder using the following syntax:
{% now 'UTC' %}: Get the current date for the UTC timezone.{% now 'America/Chicago' + 'hours=2' %}: Add two hours to the current date in the Chicago timezone.{% now 'Europe/Berlin' - 'weeks=2' %}: Subtract two weeks from the current date in the Berlin timezone.{% now 'Pacific/Fiji' + 'hours=2', '%H' %}: Display only the number of hours after adding two hours to the Fiji timezone.{% now 'Etc/GMT-4', '%I:%M %p' %}: Change the date format to AM/PM for the GMT-4 timezone.Note that if no date format is provided, the default will be %Y-%m-%d %H:%M:%S. Please refer to list of tz database for a list of timezones.
Adds usage meta field with prompt_tokens and completion_tokens keys to HuggingFaceAPIChatGenerator.
Add new GreedyVariadic input type. This has a similar behaviour to Variadic input type as it can be connected to multiple output sockets, though the Pipeline will run it as soon as it receives an input without waiting for others. This replaces the is_greedy argument in the @component decorator. If you had a Component with a Variadic input type and @component(is_greedy=True) you need to change the type to GreedyVariadic and remove is_greedy=true from @component.
Add new Pipeline init argument max_runs_per_component, this has the same identical behaviour as the existing max_loops_allowed argument but is more descriptive of its actual effects.
Add new PipelineMaxLoops to reflect new max_runs_per_component init argument
We added batching during inference time to the TransformerSimilarityRanker to help prevent OOMs when ranking large amounts of Documents.
DefaultConverter class used by the PyPDFToDocument component has been deprecated. Its functionality will be merged into the component in 2.7.0.debug_path is deprecated and will be removed in version 2.7.0.@component decorator is_greedy argument is deprecated and will be removed in version 2.7.0. Use GreedyVariadic type instead.Pipeline.connect(), it will raise an error from version 2.7.0 onwardsmax_loops_allowed is deprecated and will be removed in version 2.7.0. Use max_runs_per_component instead.PipelineMaxLoops exception is deprecated and will be removed in version 2.7.0. Use PipelineMaxComponentRuns instead.PyPDFToDocument component to prevent the default converter from being serialized unnecessarily.component.set_input_type and component.set_input_types to prevent undefined behaviour when the run method does not contain a variadic keyword argument.set_output_types from being called when the output_types decorator is used.CHAT_WITH_WEBSITE Pipeline template to reflect the changes in the HTMLToDocument converter component.SentenceWindowRetriever allowing now support for 3 more DocumentStores: Astra, PGVector, Qdrantfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorfrom_dict method of the PyPDFToDocument more robust to cases when the converter is not provided in the dictionary.One column per month.
The DefaultConverter class used by the PyPDFToDocument component has been deprecated. Its functionality will be merged into the component in 2.7.0.
gpt-3.5-turbo was replaced by gpt-4o-mini as the default model for all components relying on OpenAI APIAdded a new component DocumentNDCGEvaluator, which is similar to DocumentMRREvaluator and useful for retrieval evaluation. It calculates the normalized discounted cumulative gain, an evaluation metric useful when there are multiple ground truth relevant documents and the order in which they are retrieved is important.
Add new CSVToDocument component. Loads the file as bytes object. Adds the loaded string as a new document that can be used for further processing by the Document Splitter.
Adds support for zero shot document classification via new TransformersZeroShotDocumentClassifier component. This allows you to classify documents into user-defined classes (binary and multi-label classification) using pre-trained models from Hugging Face.
Added the option to use a custom splitting function in DocumentSplitter. The function must accept a string as input and return a list of strings, representing the split units. To use the feature initialise DocumentSplitter with split_by="function" providing the custom splitting function as splitting_function=custom_function.
Add new JSONConverter Component to convert JSON files to Document. Optionally it can use jq to filter the source JSON files and extract only specific parts.
import json
from haystack.components.converters import JSONConverter
from haystack.dataclasses import ByteStream
data = {
"laureates": [
{
"firstname": "Enrico",
"surname": "Fermi",
"motivation": "for his demonstrations of the existence of new radioactive elements produced "
"by neutron irradiation, and for his related discovery of nuclear reactions brought about by slow neutrons",
},
{
"firstname": "Rita",
"surname": "Levi-Montalcini",
"motivation": "for their discoveries of growth factors",
},
],
}
source = ByteStream.from_string(json.dumps(data))
converter = JSONConverter(jq_schema=".laureates[]", content_key="motivation", extra_meta_fields=["firstname", "surname"])
results = converter.run(sources=[source])
documents = results["documents"] print(documents[0].content)
# 'for his demonstrations of the existence of new radioactive elements produced by
# neutron irradiation, and for his related discovery of nuclear reactions brought
# about by slow neutrons'
print(documents[0].meta)
# {'firstname': 'Enrico', 'surname': 'Fermi'}
print(documents[1].content)
# 'for their discoveries of growth factors' print(documents[1].meta) # {'firstname': 'Rita', 'surname': 'Levi-Montalcini'}
Added a new NLTKDocumentSplitter, a component enhancing document preprocessing capabilities with NLTK. This feature allows for fine-grained control over the splitting of documents into smaller parts based on configurable criteria such as word count, sentence boundaries, and page breaks. It supports multiple languages and offers options for handling sentence boundaries and abbreviations, facilitating better handling of various document types for further processing tasks.
Updates SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder so model_max_length passed through tokenizer_kwargs also updates the max_seq_length of the underlying SentenceTransformer model.
Adapts how ChatPromptBuilder creates ChatMessages. Messages are deep copied to ensure all meta fields are copied correctly.
Expose default_headers to pass custom headers to Azure API including APIM subscription key.
Add optional azure_kwargs dictionary parameter to pass in parameters undefined in Haystack but supported by AzureOpenAI.
Allow the ability to add the current date inside a template in PromptBuilder using the following syntax:
{% now 'UTC' %}: Get the current date for the UTC timezone.{% now 'America/Chicago' + 'hours=2' %}: Add two hours to the current date in the Chicago timezone.{% now 'Europe/Berlin' - 'weeks=2' %}: Subtract two weeks from the current date in the Berlin timezone.{% now 'Pacific/Fiji' + 'hours=2', '%H' %}: Display only the number of hours after adding two hours to the Fiji timezone.{% now 'Etc/GMT-4', '%I:%M %p' %}: Change the date format to AM/PM for the GMT-4 timezone.Note that if no date format is provided, the default will be %Y-%m-%d %H:%M:%S. Please refer to list of tz database for a list of timezones.
Adds usage meta field with prompt_tokens and completion_tokens keys to HuggingFaceAPIChatGenerator.
Add new GreedyVariadic input type. This has a similar behaviour to Variadic input type as it can be connected to multiple output sockets, though the Pipeline will run it as soon as it receives an input without waiting for others. This replaces the is_greedy argument in the @component decorator. If you had a Component with a Variadic input type and @component(is_greedy=True) you need to change the type to GreedyVariadic and remove is_greedy=true from @component.
Add new Pipeline init argument max_runs_per_component, this has the same identical behaviour as the existing max_loops_allowed argument but is more descriptive of its actual effects.
Add new PipelineMaxLoops to reflect new max_runs_per_component init argument
We added batching during inference time to the TransformerSimilarityRanker to help prevent OOMs when ranking large amounts of Documents.
DefaultConverter class used by the PyPDFToDocument component has been deprecated. Its functionality will be merged into the component in 2.7.0.debug_path is deprecated and will be removed in version 2.7.0.@component decorator is_greedy argument is deprecated and will be removed in version 2.7.0. Use GreedyVariadic type instead.Pipeline.connect(), it will raise an error from version 2.7.0 onwardsmax_loops_allowed is deprecated and will be removed in version 2.7.0. Use max_runs_per_component instead.PipelineMaxLoops exception is deprecated and will be removed in version 2.7.0. Use PipelineMaxComponentRuns instead.PyPDFToDocument component to prevent the default converter from being serialized unnecessarily.component.set_input_type and component.set_input_types to prevent undefined behaviour when the run method does not contain a variadic keyword argument.set_output_types from being called when the output_types decorator is used.CHAT_WITH_WEBSITE Pipeline template to reflect the changes in the HTMLToDocument converter component.SentenceWindowRetriever allowing now support for 3 more DocumentStores: Astra, PGVector, Qdrantfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorfrom_dict method of the PyPDFToDocument more robust to cases when the converter is not provided in the dictionary.Pipeline init argument debug_path is deprecated and will be removed in version 2.7.0.
gpt-3.5-turbo was replaced by gpt-4o-mini as the default model for all components relying on OpenAI APIAdd new CSVToDocument component. Loads the file as bytes object. Adds the loaded string as a new document that can be used for further processing by the Document Splitter.
Adds support for zero shot document classification via new TransformersZeroShotDocumentClassifier component. This allows you to classify documents into user-defined classes (binary and multi-label classification) using pre-trained models from Hugging Face.
Added the option to use a custom splitting function in DocumentSplitter. The function must accept a string as input and return a list of strings, representing the split units. To use the feature initialise DocumentSplitter with split_by="function" providing the custom splitting function as splitting_function=custom_function.
Add new JSONConverter Component to convert JSON files to Document. Optionally it can use jq to filter the source JSON files and extract only specific parts.
import json
from haystack.components.converters import JSONConverter
from haystack.dataclasses import ByteStream
data = {
"laureates": [
{
"firstname": "Enrico",
"surname": "Fermi",
"motivation": "for his demonstrations of the existence of new radioactive elements produced "
"by neutron irradiation, and for his related discovery of nuclear reactions brought about by slow neutrons",
},
{
"firstname": "Rita",
"surname": "Levi-Montalcini",
"motivation": "for their discoveries of growth factors",
},
],
}
source = ByteStream.from_string(json.dumps(data))
converter = JSONConverter(jq_schema=".laureates[]", content_key="motivation", extra_meta_fields=["firstname", "surname"])
results = converter.run(sources=[source])
documents = results["documents"] print(documents[0].content)
# 'for his demonstrations of the existence of new radioactive elements produced by
# neutron irradiation, and for his related discovery of nuclear reactions brought
# about by slow neutrons'
print(documents[0].meta)
# {'firstname': 'Enrico', 'surname': 'Fermi'}
print(documents[1].content)
# 'for their discoveries of growth factors' print(documents[1].meta) # {'firstname': 'Rita', 'surname': 'Levi-Montalcini'}
Added a new NLTKDocumentSplitter, a component enhancing document preprocessing capabilities with NLTK. This feature allows for fine-grained control over the splitting of documents into smaller parts based on configurable criteria such as word count, sentence boundaries, and page breaks. It supports multiple languages and offers options for handling sentence boundaries and abbreviations, facilitating better handling of various document types for further processing tasks.
Updates SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder so model_max_length passed through tokenizer_kwargs also updates the max_seq_length of the underlying SentenceTransformer model.
Adapts how ChatPromptBuilder creates ChatMessages. Messages are deep copied to ensure all meta fields are copied correctly.
Expose default_headers to pass custom headers to Azure API including APIM subscription key.
Add optional azure_kwargs dictionary parameter to pass in parameters undefined in Haystack but supported by AzureOpenAI.
Allow the ability to add the current date inside a template in PromptBuilder using the following syntax:
{% now 'UTC' %}: Get the current date for the UTC timezone.{% now 'America/Chicago' + 'hours=2' %}: Add two hours to the current date in the Chicago timezone.{% now 'Europe/Berlin' - 'weeks=2' %}: Subtract two weeks from the current date in the Berlin timezone.{% now 'Pacific/Fiji' + 'hours=2', '%H' %}: Display only the number of hours after adding two hours to the Fiji timezone.{% now 'Etc/GMT-4', '%I:%M %p' %}: Change the date format to AM/PM for the GMT-4 timezone.Note that if no date format is provided, the default will be %Y-%m-%d %H:%M:%S. Please refer to list of tz database for a list of timezones.
Adds usage meta field with prompt_tokens and completion_tokens keys to HuggingFaceAPIChatGenerator.
Add new GreedyVariadic input type. This has a similar behaviour to Variadic input type as it can be connected to multiple output sockets, though the Pipeline will run it as soon as it receives an input without waiting for others. This replaces the is_greedy argument in the @component decorator. If you had a Component with a Variadic input type and @component(is_greedy=True) you need to change the type to GreedyVariadic and remove is_greedy=true from @component.
Add new Pipeline init argument max_runs_per_component, this has the same identical behaviour as the existing max_loops_allowed argument but is more descriptive of its actual effects.
Add new PipelineMaxLoops to reflect new max_runs_per_component init argument
We added batching during inference time to the TransformerSimilarityRanker to help prevent OOMs when ranking large amounts of Documents.
debug_path is deprecated and will be removed in version 2.7.0.@component decorator is_greedy argument is deprecated and will be removed in version 2.7.0. Use GreedyVariadic type instead.Pipeline.connect(), it will raise an error from version 2.7.0 onwardsmax_loops_allowed is deprecated and will be removed in version 2.7.0. Use max_runs_per_component instead.PipelineMaxLoops exception is deprecated and will be removed in version 2.7.0. Use PipelineMaxComponentRuns instead.component.set_input_type and component.set_input_types to prevent undefined behaviour when the run method does not contain a variadic keyword argument.set_output_types from being called when the output_types decorator is used.CHAT_WITH_WEBSITE Pipeline template to reflect the changes in the HTMLToDocument converter component.SentenceWindowRetriever allowing now support for 3 more DocumentStores: Astra, PGVector, Qdrantfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorfrom_dict method of the PyPDFToDocument more robust to cases when the converter is not provided in the dictionary.Add default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGenerator
default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGeneratorPipeline not running Components with Variadic input even if it received inputs only from a subset of its sendersfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorAdd default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGenerator
default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGeneratorPipeline not running Components with Variadic input even if it received inputs only from a subset of its sendersfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorAdd default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGenerator
default_headers init argument to AzureOpenAIGenerator and AzureOpenAIChatGeneratorPipeline not running Components with Variadic input even if it received inputs only from a subset of its sendersfrom_dict method of ConditionalRouter now correctly handles the case where the dict passed to it contains the key custom_filters explicitly set to None. Previously this was causing an AttributeErrorRemoved deprecated SentenceWindowRetrieval. Use SentenceWindowRetriever instead.
ChatMessage.to_openai_format method. Use haystack.components.generators.openai_utils._convert_message_to_openai_format instead.debug parameter from Pipeline.run method.SentenceWindowRetrieval. Use SentenceWindowRetriever instead.ConditionalRouter and OutputAdapter. By default, unsafe behavior is disabled, and users must explicitly set unsafe=True to enable it. When unsafe is enabled, types such as ChatMessage, Document, and Answer can be used as output types. We recommend enabling unsafe behavior only when the Jinja template source is trusted. For more information, see the documentation for ConditionalRouter and OutputAdapter.ChatPromptBuilder creates ChatMessages. Messages are deep copied to ensure all meta fields are copied correctly.min_top_k, has been added to the TopPSampler. This parameter sets the minimum number of documents to be returned when the top-p sampling algorithm selects fewer documents than desired. Documents with the next highest scores are added to meet the minimum. This is useful when guaranteeing a set number of documents to pass through while still allowing the Top-P algorithm to determine if more documents should be sent based on scores.init_parameters of a serialized component.deserialize_document_store_in_init_parameters to clarify that the function operates in place and does not return a value.SentenceWindowRetriever now returns context_documents as well as the context_windows for each Document in retrieved_documents . This allows you to get a list of Documents from within the context window for each retrieved document.OpenAIGenerator and OpenAIChatGenerator, previously 'gpt-3.5-turbo', will be replaced by 'gpt-4o-mini'.Paragraph class in the DOCXToDocument converter to prevent import errors.DOCXToDocument component is now JSON serializable. Previously, it contained datetime objects automatically extracted from DOCX files, which are not JSON serializable. These datetime objects are now converted to strings.haystack-ai==2.4.0, Haystack is compatible with sentence-transformers>=3.0.0; earlier versions of sentence-transformers are not supported. We have updated the test dependencies and LazyImport messages to reflect this change.from_dict class method for deserialization when available. Otherwise, fall back to the generic default_from_dict method. This impacts the following generic components: CacheChecker, DocumentWriter, FilterRetriever, and SentenceWindowRetriever.Adapts how ChatPromptBuilder creates ChatMessages. Messages are deep copied to ensure all meta fields are copied correctly.
Removing deprecated SentenceWindowRetrieval , replaced by SentenceWindowRetriever
Nothing published for this version
Removed the deprecated DynamicPromptBuilder and DynamicChatPromptBuilder components. Use PromptBuilder and ChatPromptBuilder instead.
The new api_params init parameter added to LLM-based evaluators such as ContextRelevanceEvaluator and FaithfulnessEvaluator can be used to pass in supported OpenAIGenerator parameters, allowing for custom generation parameters (via generation_kwargs) and local LLM support (via api_base_url).
New AnswerJoiner component to combine multiple lists of Answers.
Fix issue that could lead to remote code execution when using insecure Jinja template in the following Components:
The same issue has been fixed in the <span class="title-ref">PipelineTemplate</span> class too.
Removed the deprecated DynamicPromptBuilder and DynamicChatPromptBuilder components. Use PromptBuilder and ChatPromptBuilder instead.
The new api_params init parameter added to LLM-based evaluators such as ContextRelevanceEvaluator and FaithfulnessEvaluator can be used to pass in supported OpenAIGenerator parameters, allowing for custom generation parameters (via generation_kwargs) and local LLM support (via api_base_url).
New AnswerJoiner component to combine multiple lists of Answers.
Fix issue that could lead to remote code execution when using insecure Jinja template in the following Components:
The same issue has been fixed in the <span class="title-ref">PipelineTemplate</span> class too.
For security reasons, OutputAdapter and ConditionalRouter can only return the following Python literal structures: strings, bytes, numbers, tuples, li
OutputAdapter and ConditionalRouter can only return the following Python literal structures: strings, bytes, numbers, tuples, lists, dicts, sets, booleans, None and Ellipsis (...). This implies that types like ChatMessage, Document, and Answer cannot be used as output types.Fix issue that could lead to remote code execution when using insecure Jinja template in the following Components:
The same issue has been fixed in the <span class="title-ref">PipelineTemplate</span> class too.
OutputAdapter and ConditionalRouter can't return users inputs anymore.
Fix issue that could lead to remote code execution when using insecure Jinja template in the following Components:
The same issue has been fixed in the <span class="title-ref">PipelineTemplate</span> class too.
Pin numpy\<2 to avoid breaking changes that cause several core integrations to fail. Pin tenacity too (8.4.0 is broken).
Alongside this release, we're introducing a new repository and package: haystack-experimental.
This package will be installed alongside haystack-ai and will give you access to experimental components. As the name suggests, these components will be highly exploratory, and may or may not make their way into the main haystack package.
To learn more about the experimental package, check out the Experimental Package docs[LINK] and the API references[LINK]
To use components in the experimental package, simply from haystack_experimental.component_type import Component
What's in there already?
OpenAIFunctionCaller: Use this component after Chat Generators to call the functions that the LLM returns withOpenAPITool: The OpenAPITool is a component designed to interact with RESTful endpoints of OpenAPI services. Its primary function is to generate and send appropriate payloads to these endpoints based on human-provided instructions. OpenAPITool bridges the gap between natural language inputs and structured API calls, making it easier for users to interact with complex APIs and thus integrating the structured world of OpenAPI-specified services with the LLMs apps.EvaluationHarness - A tool that can wrap pipelines to be evaluated as well as complex evaluation tasks into one simple runnable componentFor more information, visit https://github.com/deepset-ai/haystack-experimental or the haystack_experimental reference API at https://docs.haystack.deepset.ai/v2.3/reference/ (bottom left pane)
DocxToDocument component to convert Docx files to Documents.<span class="title-ref">trafilatura</span> must now be manually installed with <span class="title-ref">pip install trafilatura</span> to use the <span class="title-ref">HTMLToDocument</span> Component.
The deprecated <span class="title-ref">converter_name</span> parameter has been removed from <span class="title-ref">PyPDFToDocument</span>.
To specify a custom converter for <span class="title-ref">PyPDFToDocument</span>, use the <span class="title-ref">converter</span> initialization parameter and pass an instance of a class that implements the <span class="title-ref">PyPDFConverter</span> protocol.
The <span class="title-ref">PyPDFConverter</span> protocol defines the methods <span class="title-ref">convert</span>, <span class="title-ref">to_dict</span> and <span class="title-ref">from_dict</span>. A default implementation of <span class="title-ref">PyPDFConverter</span> is provided in the <span class="title-ref">DefaultConverter</span> class.
Deprecated <span class="title-ref">HuggingFaceTEITextEmbedder</span> and <span class="title-ref">HuggingFaceTEIDocumentEmbedder</span> have been removed. Use <span class="title-ref">HuggingFaceAPITextEmbedder</span> and <span class="title-ref">HuggingFaceAPIDocumentEmbedder</span> instead.
Deprecated <span class="title-ref">HuggingFaceTGIGenerator</span> and <span class="title-ref">HuggingFaceTGIChatGenerator</span> have been removed. Use <span class="title-ref">HuggingFaceAPIGenerator</span> and <span class="title-ref">HuggingFaceAPIChatGenerator</span> instead.
SentenceWindowRetrieval component allowing to perform sentence-window retrieval, i.e. retrieves surrounding documents of a given document from the document store. This is useful when a document is split into multiple chunks and you want to retrieve the surrounding context of a given chunk.`python index = "my_personal_index" document_store_1 = InMemoryDocumentStore(index=index) document_store_2 = InMemoryDocumentStore(index=index) assert document_store_1.count_documents() == 0 assert document_store_2.count_documents() == 0 document_store_1.write_documents([Document(content="Hello world")]) assert document_store_1.count_documents() == 1 assert document_store_2.count_documents() == 1`max_retries and timeout parameters to the AzureOpenAIChatGenerator initializations.max_retries and timeout parameters to the AzureOpenAITextEmbedder initializations.max_retries, timeout parameters to the AzureOpenAIDocumentEmbedder initialization.Haystack 1.x legacy filters are deprecated and will be removed in a future release. Please use the new filter style as described in the documentation…
Pin numpy\<2 to avoid breaking changes that cause several core integrations to fail. Pin tenacity too (8.4.0 is broken).
Adding the <span class="title-ref">DocxToDocument</span> component to convert Docx files to Documents.
<span class="title-ref">trafilatura</span> must now be manually installed with <span class="title-ref">pip install trafilatura</span> to use the <span class="title-ref">HTMLToDocument</span> Component.
The deprecated <span class="title-ref">converter_name</span> parameter has been removed from <span class="title-ref">PyPDFToDocument</span>.
To specify a custom converter for <span class="title-ref">PyPDFToDocument</span>, use the <span class="title-ref">converter</span> initialization parameter and pass an instance of a class that implements the <span class="title-ref">PyPDFConverter</span> protocol.
The <span class="title-ref">PyPDFConverter</span> protocol defines the methods <span class="title-ref">convert</span>, <span class="title-ref">to_dict</span> and <span class="title-ref">from_dict</span>. A default implementation of <span class="title-ref">PyPDFConverter</span> is provided in the <span class="title-ref">DefaultConverter</span> class.
Deprecated <span class="title-ref">HuggingFaceTEITextEmbedder</span> and <span class="title-ref">HuggingFaceTEIDocumentEmbedder</span> have been removed. Use <span class="title-ref">HuggingFaceAPITextEmbedder</span> and <span class="title-ref">HuggingFaceAPIDocumentEmbedder</span> instead.
Deprecated <span class="title-ref">HuggingFaceTGIGenerator</span> and <span class="title-ref">HuggingFaceTGIChatGenerator</span> have been removed. Use <span class="title-ref">HuggingFaceAPIGenerator</span> and <span class="title-ref">HuggingFaceAPIChatGenerator</span> instead.
`python index = "my_personal_index" document_store_1 = InMemoryDocumentStore(index=index) document_store_2 = InMemoryDocumentStore(index=index) assert document_store_1.count_documents() == 0 assert document_store_2.count_documents() == 0 document_store_1.write_documents([Document(content="Hello world")]) assert document_store_1.count_documents() == 1 assert document_store_2.count_documents() == 1`Added the apply_filter_policy function to standardize the application of filter policies across all document store-specific retrievers, allowing for c
Added the apply_filter_policy function to standardize the application of filter policies across all document store-specific retrievers, allowing for c
Pin numpy\<2 to avoid breaking changes that cause several core integrations to fail. Pin tenacity too (8.4.0 is broken).
ChatPromptBuilder in builders moduleAdd missing metrics column in DataFrame returned by EvaluationRunResult.score_report()
metrics column in DataFrame returned by EvaluationRunResult.score_report()Add missing metrics column in DataFrame returned by EvaluationRunResult.score_report()
metrics column in DataFrame returned by EvaluationRunResult.score_report()trafilatura must now be manually installed with pip install trafilatura to use the HTMLToDocument Component.
trafilatura must now be manually installed with pip install trafilatura to use the HTMLToDocument Component.trafilatura as direct dependency and make it a lazily imported onetrafilatura must now be manually installed with pip install trafilatura to use the HTMLToDocument Component.
DynamicChatPromptBuilder has been deprecated as ChatPromptBuilder fully covers its functionality. Use ChatPromptBuilder instead.
The <span class="title-ref">Multiplexer</span> component proved to be hard to explain and to understand. After reviewing its use cases, the documentation was rewritten and the component was renamed to <span class="title-ref">BranchJoiner</span> to better explain its functionalities.
Add the 'OPENAI_TIMEOUT' and 'OPENAI_MAX_RETRIES' to the OpenAI components.
DynamicChatPromptBuilder has been deprecated as ChatPromptBuilder fully covers its functionality. Use ChatPromptBuilder instead.
The <span class="title-ref">Multiplexer</span> component proved to be hard to explain and to understand. After reviewing its use cases, the documentation was rewritten and the component was renamed to <span class="title-ref">BranchJoiner</span> to better explain its functionalities.
Add the 'OPENAI_TIMEOUT' and 'OPENAI_MAX_RETRIES' to the OpenAI components.
Nothing published for this version
Enforce JSON mode on OpenAI LLM-based evaluators so that the they always return valid JSON output. This is to ensure that the output is always in a co
FaithfullnessEvaluator and ContextRelevanceEvaluator now return 0 instead of NaN when applied to an empty context or empty statements.@component decorator.from_dict method of SentenceTransformersTextEmbedder, SentenceTransformersDocumentEmbedder, NamedEntityExtractor, SentenceTransformersDiversityRanker and LocalWhisperTranscriber to allow None as a valid value for device when deserializing from a YAML file. This allows a deserialized pipeline to auto-determine what device to use using the ComponentDevice.resolve_device logic.list[Document], and their nested version). This improvement enables better serialization of generics and nested types and improves/fixes matching of list[X] and List[X]` types in component connections after serialization.NamedEntityExtractor. Includes updated tests verifying these fixes when NamedEntityExtractor is used in pipelines.include_outputs_from parameter in Pipeline.run correctly returns outputs of components with multiple outputs.Nothing published for this version
Make SparseEmbedding a dataclass, this makes it easier to use the class with Pydantic
SparseEmbedding a dataclass, this makes it easier to use the class with PydanticHuggingFaceAPITextEmbedder, HuggingFaceAPIDocumentEmbedder, HuggingFaceAPIGenerator, and HuggingFaceAPIChatGenerator.to_dict method to DocumentRecallEvaluator to allow proper serialization of the component.Make SparseEmbedding a dataclass, this makes it easier to use the class with Pydantic
SparseEmbedding a dataclass, this makes it easier to use the class with PydanticHuggingFaceAPITextEmbedder, HuggingFaceAPIDocumentEmbedder, HuggingFaceAPIGenerator, and HuggingFaceAPIChatGenerator.to_dict method to DocumentRecallEvaluator to allow proper serialization of the component.Deprecate HuggingFaceTGIChatGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIChatGenerator instead.
Haystack introduces new components for both with model-based, and statistical evaluation: AnswerExactMatchEvaluator, ContextRelevanceEvaluator, DocumentMAPEvaluator, DocumentMRREvaluator, DocumentRecallEvaluator, FaithfulnessEvaluator, LLMEvaluator, SASEvaluator
Here's an example of how to use DocumentMAPEvaluator to evaluate retrieved documents and calculate mean average precision score:
from haystack import Document
from haystack.components.evaluators import DocumentMAPEvaluator
evaluator = DocumentMAPEvaluator()
result = evaluator.run(
ground_truth_documents=[
[Document(content="France")],
[Document(content="9th century"), Document(content="9th")],
],
retrieved_documents=[
[Document(content="France")],
[Document(content="9th century"), Document(content="10th century"), Document(content="9th")],
],
)
result["individual_scores"]
>> [1.0, 0.8333333333333333]
result["score"]
>> 0 .9166666666666666
To learn more about evaluating RAG pipelines both with model-based, and statistical metrics available in the Haystack, check out Tutorial: Evaluating RAG Pipelines.
Haystack offers robust support for Sparse Embedding Retrieval techniques, including SPLADE. Here's how to create a simple retrieval Pipeline with sparse embeddings:
from haystack import Pipeline
from haystack_integrations.components.retrievers.qdrant import QdrantSparseEmbeddingRetriever
from haystack_integrations.components.embedders.fastembed import FastembedSparseTextEmbedder
sparse_text_embedder = FastembedSparseTextEmbedder(model="prithvida/Splade_PP_en_v1")
sparse_retriever = QdrantSparseEmbeddingRetriever(document_store=document_store)
query_pipeline = Pipeline()
query_pipeline.add_component("sparse_text_embedder", sparse_text_embedder)
query_pipeline.add_component("sparse_retriever", sparse_retriever)
query_pipeline.connect("sparse_text_embedder.sparse_embedding", "sparse_retriever.query_sparse_embedding")
Learn more about this topic in our documentation on Sparse Embedding-based Retrievers Start building with our new cookbook: 🧑🍳 Sparse Embedding Retrieval using Qdrant and FastEmbed.
As of 2.1.0, you can now inspect each component output after running a pipeline. Provide component names with include_outputs_from key to pipeline.run:
pipe.run(data, include_outputs_from={"prompt_builder", "llm", "retriever"})
And the pipeline output should look like this:
{'llm': {'replies': ['The Rhodes Statue was described as being built with iron tie bars to which brass plates were fixed to form the skin. It stood on a 15-meter-high white marble pedestal near the Rhodes harbor entrance. The statue itself was about 70 cubits, or 32 meters, tall.'],
'meta': [{'model': 'gpt-3.5-turbo-0125',
...
'usage': {'completion_tokens': 57,
'prompt_tokens': 446,
'total_tokens': 503}}]},
'retriever': {'documents': [Document(id=a3ee3a9a55b47ff651ae11dc56d84d2b6f8d931b795bd866c14eacfa56000965, content: 'Within it, too, are to be seen large masses of rock, by the weight of which the artist steadied it w...', meta: {'url': 'https://en.wikipedia.org/wiki/Colossus_of_Rhodes', '_split_id': 9}, score: 0.648961685430463),...]},
'prompt_builder': {'prompt': "\nGiven the following information, answer the question.\n\nContext:\n\n Within it, too, are to be seen large masses of rock, by the weight of which the artist steadied it while...
... levels during construction.\n\n\n\nQuestion: What does Rhodes Statue look like?\nAnswer:"}}
Add several new Evaluation components, i.e:
AnswerExactMatchEvaluatorContextRelevanceEvaluatorDocumentMAPEvaluatorDocumentMRREvaluatorDocumentRecallEvaluatorFaithfulnessEvaluatorLLMEvaluatorSASEvaluatorIntroduce a new SparseEmbedding class that can store a sparse vector representation of a document. It will be instrumental in supporting sparse embedding retrieval with the subsequent introduction of sparse embedders and sparse embedding retrievers.
Added a SentenceTransformersDiversityRanker. The diversity ranker orders documents to maximize their overall diversity. The ranker leverages sentence-transformer models to calculate semantic embeddings for each document and the query.
Introduced new HuggingFace API components, namely:
HuggingFaceAPIChatGenerator, which will replace the HuggingFaceTGIChatGenerator in the future.HuggingFaceAPIDocumentEmbedder, which will replace the HuggingFaceTEIDocumentEmbedder in the future.HuggingFaceAPIGenerator, which will replace the HuggingFaceTGIGenerator in the future.HuggingFaceAPITextEmbedder, which will replace the HuggingFaceTEITextEmbedder in the future.Compatibility with huggingface_hub>=0.22.0 for HuggingFaceTGIGenerator and HuggingFaceTGIChatGenerator components.
Adds truncate and normalize parameters to HuggingFaceTEITextEmbedder and HuggingFaceTEITextEmbedder to allow truncation and normalization of embeddings.
Adds trust_remote_code parameter to SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder for allowing custom models and scripts.
Adds streaming_callback parameter to HuggingFaceLocalGenerator, allowing users to handle streaming responses.
Adds a ZeroShotTextRouter that uses an NLI model from HuggingFace to classify texts based on a set of provided labels and routes them based on the label they were classified with.
Adds dimensions parameter to Azure OpenAI Embedders (AzureOpenAITextEmbedder and AzureOpenAIDocumentEmbedder) to fully support new embedding models like text-embedding-3-small, text-embedding-3-large and upcoming ones
Now the DocumentSplitter adds the page_number field to the metadata of all output documents to keep track of the page of the original document it belongs to.
Allows users to customise text extraction from PDF files. This is particularly useful for PDFs with unusual layouts, such as multiple text columns. For instance, users can configure the object to retain the reading order.
Enhanced PromptBuilder to specify and enforce required variables in prompt templates.
Set max_new_tokens default to 512 in HuggingFace generators.
Enhanced the AzureOCRDocumentConverter to include advanced handling of tables and text. Features such as extracting preceding and following context for tables, merging multiple column headers, and enabling single-column page layout for text have been introduced. This update furthers the flexibility and accuracy of document conversion within complex layouts.
Enhanced DynamicChatPromptBuilder's capabilities by allowing all user and system messages to be templated with provided variables. This update ensures a more versatile and dynamic templating process, making chat prompt generation more efficient and customised to user needs.
Improved HTML content extraction by attempting to use multiple extractors in order of priority until successful. An additional try_others parameter in HTMLToDocument, True by default, determines whether subsequent extractors are used after a failure. This enhancement decreases extraction failures, ensuring more dependable content retrieval.
Enhanced FileTypeRouter with regex pattern support for MIME types. This powerful addition allows for more granular control and flexibility in routing files based on their MIME types, enabling the handling of broad categories or specific MIME type patterns with ease. This feature particularly benefits applications requiring sophisticated file classification and routing logic.
In Jupyter notebooks, the image of the Pipeline will no longer be displayed automatically. Instead, the textual representation of the Pipeline will be displayed. To display the Pipeline image, use the show method of the Pipeline object.
Add support for callbacks during pipeline deserialization. Currently supports a pre-init hook for components that can be used to inspect and modify the initialization parameters before the invocation of the component's __init__ method.
pipeline.run() accepts a set of component names whose intermediate outputs are returned in the final pipeline output dictionary.
Refactor PyPDFToDocument to simplify support for custom PDF converters. PDF converters are classes that implement the PyPDFConverter protocol and have 3 methods: convert, to_dict and from_dict.
HuggingFaceTGIChatGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIChatGenerator instead.HuggingFaceTEIDocumentEmbedder, will be removed in Haystack 2.3.0. Use HuggingFaceAPIDocumentEmbedder instead.HuggingFaceTGIGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIGenerator instead.HuggingFaceTEITextEmbedder, will be removed in Haystack 2.3.0. Use HuggingFaceAPITextEmbedder instead.converter_name parameter in the PyPDFToDocument component is deprecated. it will be removed in the 2.3.0 release. Use the converter parameter instead.Forward declaration of AnalyzeResult type in AzureOCRDocumentConverter. AnalyzeResult is already imported in a lazy import block. The forward declaration avoids issues when azure-ai-formrecognizer>=3.2.0b2 is not installed.
Fixed a bug in the MetaFieldRanker: when the weight parameter was set to 0 in the run method, the component incorrectly used the default parameter set in the __init__ method.
Fixes Pipeline.run() logic so components with all their inputs with a default are run in the correct order.
Fix a bug when running a Pipeline that would cause it to get stuck in an infinite loop
Fixes on the HuggingFaceTEITextEmbedder returning an embedding of incorrect shape when used with a Text-Embedding-Inference endpoint deployed using Docker.
Add the @component decorator to HuggingFaceTGIChatGenerator. The lack of this decorator made it impossible to use the HuggingFaceTGIChatGenerator in a pipeline.
Updated the SearchApiWebSearch component with new search format and allowed users to specify the search engine via the engine parameter in search_params. The default search engine is Google, making it easier for users to tailor their web searches.
Deprecate HuggingFaceTGIChatGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIChatGenerator instead.
Haystack introduces new components for both with model-based, and statistical evaluation: AnswerExactMatchEvaluator, ContextRelevanceEvaluator, DocumentMAPEvaluator, DocumentMRREvaluator, DocumentRecallEvaluator, FaithfulnessEvaluator, LLMEvaluator, SASEvaluator
Here's an example of how to use DocumentMAPEvaluator to evaluate retrieved documents and calculate mean average precision score:
from haystack import Document
from haystack.components.evaluators import DocumentMAPEvaluator
evaluator = DocumentMAPEvaluator()
result = evaluator.run(
ground_truth_documents=[
[Document(content="France")],
[Document(content="9th century"), Document(content="9th")],
],
retrieved_documents=[
[Document(content="France")],
[Document(content="9th century"), Document(content="10th century"), Document(content="9th")],
],
)
result["individual_scores"]
>> [1.0, 0.8333333333333333]
result["score"]
>> 0 .9166666666666666
To learn more about evaluating RAG pipelines both with model-based, and statistical metrics available in the Haystack, check out Tutorial: Evaluating RAG Pipelines.
Haystack offers robust support for Sparse Embedding Retrieval techniques, including SPLADE. Here's how to create a simple retrieval Pipeline with sparse embeddings:
from haystack import Pipeline
from haystack_integrations.components.retrievers.qdrant import QdrantSparseEmbeddingRetriever
from haystack_integrations.components.embedders.fastembed import FastembedSparseTextEmbedder
sparse_text_embedder = FastembedSparseTextEmbedder(model="prithvida/Splade_PP_en_v1")
sparse_retriever = QdrantSparseEmbeddingRetriever(document_store=document_store)
query_pipeline = Pipeline()
query_pipeline.add_component("sparse_text_embedder", sparse_text_embedder)
query_pipeline.add_component("sparse_retriever", sparse_retriever)
query_pipeline.connect("sparse_text_embedder.sparse_embedding", "sparse_retriever.query_sparse_embedding")
Learn more about this topic in our documentation on Sparse Embedding-based Retrievers Start building with our new cookbook: 🧑🍳 Sparse Embedding Retrieval using Qdrant and FastEmbed.
As of 2.1.0, you can now inspect each component output after running a pipeline. Provide component names with include_outputs_from key to pipeline.run:
pipe.run(data, include_outputs_from=["prompt_builder", "llm", "retriever"])
And the pipeline output should look like this:
{'llm': {'replies': ['The Rhodes Statue was described as being built with iron tie bars to which brass plates were fixed to form the skin. It stood on a 15-meter-high white marble pedestal near the Rhodes harbor entrance. The statue itself was about 70 cubits, or 32 meters, tall.'],
'meta': [{'model': 'gpt-3.5-turbo-0125',
...
'usage': {'completion_tokens': 57,
'prompt_tokens': 446,
'total_tokens': 503}}]},
'retriever': {'documents': [Document(id=a3ee3a9a55b47ff651ae11dc56d84d2b6f8d931b795bd866c14eacfa56000965, content: 'Within it, too, are to be seen large masses of rock, by the weight of which the artist steadied it w...', meta: {'url': 'https://en.wikipedia.org/wiki/Colossus_of_Rhodes', '_split_id': 9}, score: 0.648961685430463),...]},
'prompt_builder': {'prompt': "\nGiven the following information, answer the question.\n\nContext:\n\n Within it, too, are to be seen large masses of rock, by the weight of which the artist steadied it while...
... levels during construction.\n\n\n\nQuestion: What does Rhodes Statue look like?\nAnswer:"}}
Add several new Evaluation components, i.e:
AnswerExactMatchEvaluatorContextRelevanceEvaluatorDocumentMAPEvaluatorDocumentMRREvaluatorDocumentRecallEvaluatorFaithfulnessEvaluatorLLMEvaluatorSASEvaluatorIntroduce a new SparseEmbedding class that can store a sparse vector representation of a document. It will be instrumental in supporting sparse embedding retrieval with the subsequent introduction of sparse embedders and sparse embedding retrievers.
Added a SentenceTransformersDiversityRanker. The diversity ranker orders documents to maximize their overall diversity. The ranker leverages sentence-transformer models to calculate semantic embeddings for each document and the query.
Introduced new HuggingFace API components, namely:
HuggingFaceAPIChatGenerator, which will replace the HuggingFaceTGIChatGenerator in the future.HuggingFaceAPIDocumentEmbedder, which will replace the HuggingFaceTEIDocumentEmbedder in the future.HuggingFaceAPIGenerator, which will replace the HuggingFaceTGIGenerator in the future.HuggingFaceAPITextEmbedder, which will replace the HuggingFaceTEITextEmbedder in the future.Compatibility with huggingface_hub>=0.22.0 for HuggingFaceTGIGenerator and HuggingFaceTGIChatGenerator components.
Adds truncate and normalize parameters to HuggingFaceTEITextEmbedder and HuggingFaceTEITextEmbedder to allow truncation and normalization of embeddings.
Adds trust_remote_code parameter to SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder for allowing custom models and scripts.
Adds streaming_callback parameter to HuggingFaceLocalGenerator, allowing users to handle streaming responses.
Adds a ZeroShotTextRouter that uses an NLI model from HuggingFace to classify texts based on a set of provided labels and routes them based on the label they were classified with.
Adds dimensions parameter to Azure OpenAI Embedders (AzureOpenAITextEmbedder and AzureOpenAIDocumentEmbedder) to fully support new embedding models like text-embedding-3-small, text-embedding-3-large and upcoming ones
Now the DocumentSplitter adds the page_number field to the metadata of all output documents to keep track of the page of the original document it belongs to.
Allows users to customise text extraction from PDF files. This is particularly useful for PDFs with unusual layouts, such as multiple text columns. For instance, users can configure the object to retain the reading order.
Enhanced PromptBuilder to specify and enforce required variables in prompt templates.
Set max_new_tokens default to 512 in HuggingFace generators.
Enhanced the AzureOCRDocumentConverter to include advanced handling of tables and text. Features such as extracting preceding and following context for tables, merging multiple column headers, and enabling single-column page layout for text have been introduced. This update furthers the flexibility and accuracy of document conversion within complex layouts.
Enhanced DynamicChatPromptBuilder's capabilities by allowing all user and system messages to be templated with provided variables. This update ensures a more versatile and dynamic templating process, making chat prompt generation more efficient and customised to user needs.
Improved HTML content extraction by attempting to use multiple extractors in order of priority until successful. An additional try_others parameter in HTMLToDocument, True by default, determines whether subsequent extractors are used after a failure. This enhancement decreases extraction failures, ensuring more dependable content retrieval.
Enhanced FileTypeRouter with regex pattern support for MIME types. This powerful addition allows for more granular control and flexibility in routing files based on their MIME types, enabling the handling of broad categories or specific MIME type patterns with ease. This feature particularly benefits applications requiring sophisticated file classification and routing logic.
In Jupyter notebooks, the image of the Pipeline will no longer be displayed automatically. Instead, the textual representation of the Pipeline will be displayed. To display the Pipeline image, use the show method of the Pipeline object.
Add support for callbacks during pipeline deserialization. Currently supports a pre-init hook for components that can be used to inspect and modify the initialization parameters before the invocation of the component's __init__ method.
pipeline.run() accepts a set of component names whose intermediate outputs are returned in the final pipeline output dictionary.
Refactor PyPDFToDocument to simplify support for custom PDF converters. PDF converters are classes that implement the PyPDFConverter protocol and have 3 methods: convert, to_dict and from_dict.
HuggingFaceTGIChatGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIChatGenerator instead.HuggingFaceTEIDocumentEmbedder, will be removed in Haystack 2.3.0. Use HuggingFaceAPIDocumentEmbedder instead.HuggingFaceTGIGenerator, will be removed in Haystack 2.3.0. Use HuggingFaceAPIGenerator instead.HuggingFaceTEITextEmbedder, will be removed in Haystack 2.3.0. Use HuggingFaceAPITextEmbedder instead.converter_name parameter in the PyPDFToDocument component is deprecated. it will be removed in the 2.3.0 release. Use the converter parameter instead.Forward declaration of AnalyzeResult type in AzureOCRDocumentConverter. AnalyzeResult is already imported in a lazy import block. The forward declaration avoids issues when azure-ai-formrecognizer>=3.2.0b2 is not installed.
Fixed a bug in the MetaFieldRanker: when the weight parameter was set to 0 in the run method, the component incorrectly used the default parameter set in the __init__ method.
Fixes Pipeline.run() logic so components with all their inputs with a default are run in the correct order.
Fix a bug when running a Pipeline that would cause it to get stuck in an infinite loop
Fixes on the HuggingFaceTEITextEmbedder returning an embedding of incorrect shape when used with a Text-Embedding-Inference endpoint deployed using Docker.
Add the @component decorator to HuggingFaceTGIChatGenerator. The lack of this decorator made it impossible to use the HuggingFaceTGIChatGenerator in a pipeline.
Updated the SearchApiWebSearch component with new search format and allowed users to specify the search engine via the engine parameter in search_params. The default search engine is Google, making it easier for users to tailor their web searches.
Deprecate HuggingFaceTGIChatGenerator . This component will be removed in Haystack 2.3.0. Use HuggingFaceAPIChatGenerator instead.
Add the "page_number" field to the metadata of all output documents.
The <span class="title-ref">HuggingFaceTGIGenerator</span> and <span class="title-ref">HuggingFaceTGIChatGenerator</span> components have been modified to be compatible with <span class="title-ref">huggingface_hub>=0.22.0</span>.
If you use these components, you may need to upgrade the <span class="title-ref">huggingface_hub</span> library. To do this, run the following command in your environment: `bash pip install "huggingface_hub>=0.22.0"`
Add <span class="title-ref">SentenceTransformersDiversityRanker</span>. The Diversity Ranker orders documents in such a way as to maximize the overall diversity of the given documents. The ranker leverages sentence-transformer models to calculate semantic embeddings for each document and the query.
Adds <span class="title-ref">truncate</span> and <span class="title-ref">normalize</span> parameters to <span class="title-ref">HuggingFaceTEITextEmbedder</span> and <span class="title-ref">HuggingFaceTEITextEmbedder</span> for allowing truncation and normalization of embeddings.
Add trust_remote_code parameter to SentenceTransformersDocumentEmbedder and SentenceTransformersTextEmbedder for allowing custom models and scripts.
Add a new ContextRelevanceEvaluator component that can be used to evaluate whether retrieved documents are relevant to answer a question with a RAG pipeline. Given a question and a list of retrieved document contents (contexts), an LLM is used to score to what extent the provided context is relevant. The score ranges from 0 to 1.
Add DocumentMAPEvaluator, it can be used to calculate mean average precision of retrieved documents.
Add DocumentMRREvaluator, it can be used to calculate mean reciprocal rank of retrieved documents.
Add a new FaithfulnessEvaluator component that can be used to evaluate faithfulness / groundedness / hallucinations of LLMs in a RAG pipeline. Given a question, a list of retrieved document contents (contexts), and a predicted answer, FaithfulnessEvaluator returns a score ranging from 0 (poor faithfulness) to 1 (perfect faithfulness). The score is the proportion of statements in the predicted answer that could by inferred from the documents.
Introduce <span class="title-ref">HuggingFaceAPIChatGenerator</span>. This text-generation component uses the ChatMessage format and supports different Hugging Face APIs: - free Serverless Inference API - paid Inference Endpoints - self-hosted Text Generation Inference.
This generator will replace the <span class="title-ref">HuggingFaceTGIChatGenerator</span> in the future.
Introduce <span class="title-ref">HuggingFaceAPIDocumentEmbedder</span>. This component can be used to compute Document embeddings using different Hugging Face APIs: - free Serverless Inference API - paid Inference Endpoints - self-hosted Text Embeddings Inference. This embedder will replace the <span class="title-ref">HuggingFaceTEIDocumentEmbedder</span> in the future.
Introduce <span class="title-ref">HuggingFaceAPIGenerator</span>. This text-generation component supports different Hugging Face APIs:
This generator will replace the <span class="title-ref">HuggingFaceTGIGenerator</span> in the future.
Introduce <span class="title-ref">HuggingFaceAPITextEmbedder</span>. This component can be used to embed strings using different Hugging Face APIs: - free Serverless Inference API - paid Inference Endpoints - self-hosted Text Embeddings Inference. This embedder will replace the <span class="title-ref">HuggingFaceTEITextEmbedder</span> in the future.
Adds 'streaming_callback' parameter to 'HuggingFaceLocalGenerator', allowing users to handle streaming responses.
Added a new EvaluationRunResult dataclass that wraps the results of an evaluation pipeline, allowing for its transformation and visualization.
Add a new LLMEvaluator component that leverages LLMs through the OpenAI api to evaluate pipelines.
Add <span class="title-ref">DocumentRecallEvaluator</span>, a Component that can be used to calculate the Recall single-hit or multi-hit metric given a list of questions, a list of expected documents for each question and the list of predicted documents for each question.
Add SASEvaluator, it can be used to calculate Semantic Answer Similarity of generated answers from an LLM
Introduce a new <span class="title-ref">SparseEmbedding</span> class which can be used to store a sparse vector representation of a Document. It will be instrumental to support Sparse Embedding Retrieval with the subsequent introduction of Sparse Embedders and Sparse Embedding Retrievers.
Add a Zero Shot Text Router that uses an NLI model from HF to classify texts based on a set of provided labels and routes them based on the label they were classified with.
add dimensions parameter to Azure OpenAI Embedders (AzureOpenAITextEmbedder and AzureOpenAIDocumentEmbedder) to fully support new embedding models like text-embedding-3-small, text-embedding-3-large and upcoming ones
Now the DocumentSplitter adds the "page_number" field to the metadata of all output documents to keep track of the page of the original document it belongs to.
Provides users the ability to customize text extraction from PDF files. It is particularly useful for PDFs with unusual layouts, such as those containing multiple text columns. For instance, users can configure the object to retain the reading order.
Enhanced PromptBuilder to specify and enforce required variables in prompt templates.
Set max_new_tokens default to 512 in Hugging Face generators.
Enhanced the AzureOCRDocumentConverter to include advanced handling of tables and text. Features such as extracting preceding and following context for tables, merging multiple column headers, and enabling single column page layout for text have been introduced. This update furthers the flexibility and accuracy of document conversion within complex layouts.
Enhanced DynamicChatPromptBuilder's capabilities by allowing all user and system messages to be templated with provided variables. This update ensures a more versatile and dynamic templating process, making chat prompt generation more efficient and customized to user needs.
Improved HTML content extraction by attempting to use multiple extractors in order of priority until successful. An additional try_others parameter in HTMLToDocument, which is true by default, determines whether subsequent extractors are used after a failure. This enhancement decreases extraction failures, ensuring more dependable content retrieval.
Enhanced FileTypeRouter with Regex Pattern Support for MIME Types: This introduces a significant enhancement to the <span class="title-ref">FileTypeRouter</span>, now featuring support for regex pattern matching for MIME types. This powerful addition allows for more granular control and flexibility in routing files based on their MIME types, enabling the handling of broad categories or specific MIME type patterns with ease. This feature is particularly beneficial for applications requiring sophisticated file classification and routing logic.
Usage example: `python from haystack.components.routers import FileTypeRouter router = FileTypeRouter(mime_types=[r"text/.*", r"application/(pdf|json)"]) # Example files to classify file_paths = [ Path("document.pdf"), Path("report.json"), Path("notes.txt"), Path("image.png"), ] result = router.run(sources=file_paths) for mime_type, files in result.items(): print(f"MIME Type: {mime_type}, Files: {[str(file) for file in files]}")`
Improved pipeline run tracing to include pipeline input/output data.
In Jupyter notebooks, the image of the Pipeline will no longer be displayed automatically. The textual representation of the Pipeline will be displayed.
To display the Pipeline image, use the <span class="title-ref">show</span> method of the Pipeline object.
Add support for callbacks during pipeline deserialization. Currently supports a pre-init hook for components that can be used to inspect and modify the initialization parameters before the invocation of the component's <span class="title-ref">__init__</span> method.
<span class="title-ref">pipeline.run</span> accepts a set of component names whose intermediate outputs are returned in the final pipeline output dictionary.
<span class="title-ref">Pipeline.inputs</span> and <span class="title-ref">Pipeline.outputs</span> can optionally include components input/output sockets that are connected.
Refactor <span class="title-ref">PyPDFToDocument</span> to simplify support for custom PDF converters. PDF converters are classes that implement the <span class="title-ref">PyPDFConverter</span> protocol and have 3 methods: <span class="title-ref">convert</span>, <span class="title-ref">to_dict</span> and <span class="title-ref">from_dict</span>. The <span class="title-ref">DefaultConverter</span> class is provided as a default implementation.
Add an <span class="title-ref">__eq__</span> method to <span class="title-ref">SparseEmbedding</span> class to compare two <span class="title-ref">SparseEmbedding</span> objects.
Forward declaration of <span class="title-ref">AnalyzeResult</span> type in <span class="title-ref">AzureOCRDocumentConverter</span>.
<span class="title-ref">AnalyzeResult</span> is already imported in a lazy import block. The forward declaration avoids issues when <span class="title-ref">azure-ai-formrecognizer>=3.2.0b2</span> is not installed.
The <span class="title-ref">test_comparison_in</span> test case in the base document store tests used to always pass, no matter how the <span class="title-ref">in</span> filtering logic was implemented in document stores. With the fix, the <span class="title-ref">in</span> logic is actually tested. Some tests might start to fail for document stores that don't implement the <span class="title-ref">in</span> filter correctly.
Remove the usage of reserved keywords in the logger calls, causing a <span class="title-ref">KeyError</span> when setting the log level to DEBUG.
Fixed a bug in the `MetaFieldRanker`: when the <span class="title-ref">weight</span> parameter was set to 0 in the <span class="title-ref">run</span> method, the component was incorrectly using the default <span class="title-ref">weight</span> parameter set in the <span class="title-ref">__init__</span> method.
Fixes <span class="title-ref">Pipeline.run()</span> logic so Components that have all their inputs with a default are run in the correct order. This happened we gather a list of Components to run internally when running the Pipeline in the order they are added during creation of the Pipeline. This caused some Components to run before they received all their inputs.
Fix a bug when running a Pipeline that would cause it to get stuck in an infinite loop
Fixes <span class="title-ref">HuggingFaceTEITextEmbedder</span> returning an embedding of incorrect shape when used with a Text-Embedding-Inference endpoint deployed using Docker.
Add the <span class="title-ref">@component</span> decorator to <span class="title-ref">HuggingFaceTGIChatGenerator</span>. The lack of this decorator made it impossible to use the <span class="title-ref">HuggingFaceTGIChatGenerator</span> in a pipeline.
Updated the SearchApiWebSearch component with new search format and allowed users to specify the search engine via the <span class="title-ref">engine</span> parameter in <span class="title-ref">search_params</span>. The default search engine is Google, making it easier for users to tailor their web searches.
Fixed a bug in the `MetaFieldRanker`: when the <span class="title-ref">ranking_mode</span> parameter was overridden in the <span class="title-ref">run</span> method, the component was incorrectly using the <span class="title-ref">ranking_mode</span> parameter set in the <span class="title-ref">__init__</span> method.
Removed the deprecated GPTGenerator and GPTChatGenerator components. Use OpenAIGenerator and OpenAIChatGeneratornotes instead.
Update secret handling for the <span class="title-ref">ExtractiveReader</span> component using the <span class="title-ref">Secret</span> type.
The default init parameter <span class="title-ref">token</span> is now required to either use a token or the environment <span class="title-ref">HF_API_TOKEN</span> variable if authentication is required - The on-disk local token file is no longer supported.
Add a new pipeline template <span class="title-ref">PredefinedPipeline.CHAT_WITH_WEBSITE</span> to quickly create a pipeline that will answer questions based on data collected from one or more web pages.
Usage example: `python from haystack import Pipeline, PredefinedPipeline pipe = Pipeline.from_template(PredefinedPipeline.CHAT_WITH_WEBSITE) result = pipe.run({ "fetcher": {"urls": ["https://haystack.deepset.ai/overview/quick-start"]}, "prompt": {"query": "How should I install Haystack?"}} ) print(result["llm"]["replies"][0])`
Added option to instrument pipeline and component runs. This allows users to observe their pipeline runs and component runs in real-time via their chosen observability tool. Out-of-the-box support for OpenTelemetry and Datadog will be added in separate contributions.
Example usage for [OpenTelemetry](https://opentelemetry.io/docs/languages/python/):
1. Install OpenTelemetry SDK and exporter:
`bash pip install opentelemetry-sdk opentelemetry-exporter-otlp-proto-http`
2. Configure OpenTelemetry SDK with your tracing provider and exporter:
```python from opentelemetry.sdk.resources import SERVICE_NAME, Resource
from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor
# Service name is required for most backends resource = Resource(attributes={ SERVICE_NAME: "haystack" })
traceProvider = TracerProvider(resource=resource) processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4318/v1/traces")) traceProvider.add_span_processor(processor) trace.set_tracer_provider(traceProvider)
tracer = traceProvider.get_tracer("my_application")
3. Create tracer
`python import contextlib from typing import Optional, Dict, Any, Iterator from opentelemetry import trace from opentelemetry.trace import NonRecordingSpan from haystack.tracing import Tracer, Span from haystack.tracing import utils as tracing_utils import opentelemetry.trace class OpenTelemetrySpan(Span): def __init__(self, span: opentelemetry.trace.Span) -> None: self._span = span def set_tag(self, key: str, value: Any) -> None: coerced_value = tracing_utils.coerce_tag_value(value) self._span.set_attribute(key, coerced_value) class OpenTelemetryTracer(Tracer): def __init__(self, tracer: opentelemetry.trace.Tracer) -> None: self._tracer = tracer @contextlib.contextmanager def trace(self, operation_name: str, tags: Optional[Dict[str, Any]] = None) -> Iterator[Span]: with self._tracer.start_as_current_span(operation_name) as span: span = OpenTelemetrySpan(span) if tags: span.set_tags(tags) yield span def current_span(self) -> Optional[Span]: current_span = trace.get_current_span() if isinstance(current_span, NonRecordingSpan): return None return OpenTelemetrySpan(current_span)`
4. Use the tracer with Haystack:
`python from haystack import tracing haystack_tracer = OpenTelemetryTracer(tracer) tracing.enable_tracing(haystack_tracer)`
Enhanced OpenAPI integration by handling complex types of requests and responses in OpenAPIServiceConnector and OpenAPIServiceToFunctions.
Added out-of-the-box support for the Datadog Tracer. This allows you to instrument pipeline and component runs using Datadog and send traces to your preferred backend.
To use the Datadog Tracer you need to have the <span class="title-ref">ddtrace</span> package installed in your environment. To instruct Haystack to use the Datadog tracer, you have multiple options:
`python from haystack.tracing import DatadogTracer import haystack.tracing import ddtrace tracer = ddtrace.tracer tracing.enable_tracing(DatadogTracer(tracer))`Add <span class="title-ref">AnswerExactMatchEvaluator</span>, a component that can be used to calculate the Exact Match metric comparing a list of expected answers with a list of predicted answers.
Added out-of-the-box support for the OpenTelemetry Tracer. This allows you to instrument pipeline and component runs using OpenTelemetry and send traces to your preferred backend.
To use the OpenTelemetry Tracer you need to have the <span class="title-ref">opentelemetry-sdk</span> package installed in your environment. To instruct Haystack to use the OpenTelemetry Tracer, you have multiple options:
* Run your Haystack application using the <span class="title-ref">opentelemetry-instrument</span> command line tool as described in the
[OpenTelemetry documentation](https://opentelemetry.io/docs/languages/python/automatic/#configuring-the-agent).
This behavior can be disabled by setting the <span class="title-ref">HAYSTACK_AUTO_TRACE_ENABLED_ENV_VAR</span> environment variable to <span class="title-ref">false</span>.
* Configure the tracer manually in your code using the <span class="title-ref">opentelemetry</span> package:
`python from opentelemetry import trace from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor # Service name is required for most backends resource = Resource(attributes={ SERVICE_NAME: "haystack" }) traceProvider = TracerProvider(resource=resource) processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4318/v1/traces")) traceProvider.add_span_processor(processor) trace.set_tracer_provider(traceProvider) # Auto-configuration import haystack.tracing haystack.tracing.auto_enable_tracing() # Or explicitly from haystack.tracing import OpenTelemetryTracer tracer = traceProvider.get_tracer("my_application") tracing.enable_tracing(OpenTelemetryTracer(tracer))`
Haystack now supports structured logging out-of-the box. Logging can be separated into 3 categories:
`python import haystack.logging haystack.logging.configure_logging(use_json=True)`Allow code instrumentation to also trace the input and output of components. This is useful for debugging and understanding the behavior of components. This behavior is disabled by default and can be enabled with one of the following methods:
Set the environment variable <span class="title-ref">HAYSTACK_CONTENT_TRACING_ENABLED_ENV_VAR</span> to <span class="title-ref">true</span> before importing Haystack.
Enable content tracing in the code:
`python from haystack import tracing tracing.tracer.is_content_tracing_enabled = True`
Update <span class="title-ref">Component</span> protocol to fix type checking issues with some Language Servers. Most Language Servers and some type checkers would show warnings when calling <span class="title-ref">Pipeline.add_component()</span> as technically most `Component`s weren't respecting the protocol we defined.
Added a new <span class="title-ref">Logger</span> implementation which eases and enforces logging via key-word arguments. This is an internal change only. The behavior of instances created via <span class="title-ref">logging.getLogger</span> is not affected.
If using JSON logging in conjunction with tracing, Haystack will automatically add correlation IDs to the logs. This is done by getting the necessary information from the current span and adding it to the log record. You can customize this by overriding the <span class="title-ref">get_correlation_data_for_logs</span> of your tracer's span:
`python from haystack.tracing import Span class OpenTelemetrySpan(Span): ... def get_correlation_data_for_logs(self) -> Dict[str, Any]: span_context = ... return {"trace_id": span_context.trace_id, "span_id": span_context.span_id}`
The <span class="title-ref">logging</span> module now detects if the standard output is a TTY. If it is not and <span class="title-ref">structlog</span> is installed, it will automatically disable the console renderer and log in JSON format. This behavior can be overridden by setting the environment variable <span class="title-ref">HAYSTACK_LOGGING_USE_JSON</span> to <span class="title-ref">false</span>.
Enhanced OpenAPI service connector to better handle method invocation with support for security schemes, refined handling of method arguments including URL/query parameters and request body, alongside improved error validation for method calls. This update enables more versatile interactions with OpenAPI services, ensuring compatibility with a wide range of API specifications.
Remove the text value from a warning log in the <span class="title-ref">TextLanguageRouter</span> to avoid logging sensitive information. The text can be still be shown by switching to the <span class="title-ref">debug</span> log level.
`python import logging logging.basicConfig(format="%(levelname)s - %(name)s - %(message)s", level=logging.WARNING) logging.getLogger("haystack").setLevel(logging.DEBUG)`
The HuggingFaceTGIGenerator and HuggingFaceTGIChatGenerator components have been modified to be compatible with huggingface_hub>=0.22.0.
The HuggingFaceTGIGenerator and HuggingFaceTGIChatGenerator components have been modified to be compatible with huggingface_hub>=0.22.0.
If you use these components, you may need to upgrade the huggingface_hub library. To do this, run the following command in your environment: pip install "huggingface_hub>=0.22.0"
streaming_callback parameter to HuggingFaceLocalGenerator, allowing users to handle streaming responses.SparseEmbedding class which can be used to store a sparse vector representation of a Document. It will be instrumental to support Sparse Embedding Retrieval with the subsequent introduction of Sparse Embedders and Sparse Embedding Retrievers.Set max_new_tokens default to 512 in Hugging Face generators.
In Jupyter notebooks, the image of the Pipeline will no longer be displayed automatically. The textual representation of the Pipeline will be displayed.
To display the Pipeline image, use the show method of the Pipeline object.
test_comparison_in test case in the base document store tests used to always pass, no matter how the in filtering logic was implemented in document stores. With the fix, the in logic is actually tested. Some tests might start to fail for document stores that don't implement the in filter correctly.HFTokenStreamingHandler in a lazy import block in HuggingFaceLocalGenerator. This fixed some breaking core-integrations.Pipeline.run() logic so Components that have all their inputs with a default are run in the correct order. This happened we gather a list of Components to run internally when running the Pipeline in the order they are added during creation of the Pipeline. This caused some Components to run before they received all their inputs.HuggingFaceTEITextEmbedder returning an embedding of incorrect shape when used with a Text-Embedding-Inference endpoint deployed using Docker.@component decorator to HuggingFaceTGIChatGenerator. The lack of this decorator made it impossible to use the HuggingFaceTGIChatGenerator in a pipeline.Nothing published for this version
Nothing published for this version
Today, we’ve released the stable version of Haystack 2.0. This is ultimately a rewrite of the Haystack framework, so these release notes are not what
Today, we’ve released the stable version of Haystack 2.0. This is ultimately a rewrite of the Haystack framework, so these release notes are not what you’d usually expect to see in regular release notes where we highlight specific changes to the codebase. Instead, we will highlight features of Haystack 2.0 and how it’s meant to be used.
To read more about our motivation for Haystack 2.0 and what makes up our design choices, you can read our release announcement article.
To get started with Haystack, follow our quick starting guide.
Haystack 2.0 is distributed with haystack-ai, while Haystack 1.x will continue to be supported with farm-haystack with security updates and bug fixes.
NOTE: Installing haystack-ai and farm-haystack into the same Python environment will lead to conflicts - Please use separate virtual environments for each package.
Check out the installation guide for more information.
In Haystack 2.0, pipelines are dynamic computation graphs that support:
Pipelines can be built with a few easy steps:
Pipeline object.add_component() method.connect() method. Trying to connect components that are not compatible in type will raise an error.run() method.The following pipeline does question-answering on a given URL:
import os
from haystack import Pipeline
from haystack.components.fetchers import LinkContentFetcher
from haystack.components.converters import HTMLToDocument
from haystack.components.builders import PromptBuilder
from haystack.components.generators import OpenAIGenerator
from haystack.utils import Secret
os.environ["OPENAI_API_KEY"] = "Your OpenAI API Key"
fetcher = LinkContentFetcher()
converter = HTMLToDocument()
prompt_template = """
According to the contents of this website:
{% for document in documents %}
{{document.content}}
{% endfor %}
Answer the given question: {{query}}
Answer:
"""
prompt_builder = PromptBuilder(template=prompt_template)
llm = OpenAIGenerator(api_key=Secret.from_env_var("OPENAI_API_KEY"))
pipeline = Pipeline()
pipeline.add_component("fetcher", fetcher)
pipeline.add_component("converter", converter)
pipeline.add_component("prompt", prompt_builder)
pipeline.add_component("llm", llm)
# pass the fetchers's `streams` output to the converter using the `sources` parameter
pipeline.connect("fetcher.streams", "converter.sources")
# pass the converted `documents to the prompt_builder using the `documents` parameter
pipeline.connect("converter.documents", "prompt.documents")
# pass the interpolated `prompt to the llm using the `prompt` parameter
pipeline.connect("prompt.prompt", "llm.prompt")
pipeline.run({"fetcher": {"urls": ["https://haystack.deepset.ai/overview/quick-start"]},
"prompt": {"query": "How should I install Haystack?"}})
print(result["llm"]["replies"][0])
Previously known as Nodes, components have been formalized with well-defined inputs and outputs that allow for easy extensibility and composability.
Haystack 2.0 provides a diverse selection of built-in components. Here’s a non-exhaustive overview:
| Category | Description | External Providers & Integrations |
|---|---|---|
| Audio Transcriber | Transcribe audio to text | OpenAI |
| Builders | Build prompts and answers from templates | |
| Classifiers | Classify documents based on specific criteria | |
| Connectors | Interface with external services | OpenAPI |
| Converters | Convert data between different formats | Azure, Tika, Unstructured, PyPDF, OpenAPI, Jinja |
| Embedders | Transform texts and documents to vector representations | Amazon Bedrock, Azure, Cohere, FastEmbed, Gradient, Hugging Face (Optimum, Sentence Transformers, Text Embedding Inference), Instructor, Jina, Mistral, Nvidia, Ollama, OpenAI |
| Extractors | Extract information from documents | Hugging Face, spaCy |
| Evaluators | Evaluate components using metrics | Ragas, DeepEval, UpTrain |
| Fetcher | Fetch data from remote URLs | |
| Generators | Prompt and generate text using generative models | Amazon Bedrock, Amazon Sagemaker, Azure, Cohere, Google AI, Google Vertex, Gradient, Hugging Face, Llama.cpp, Mistral, Nvidia, Ollama, OpenAI |
| Joiners | Combine documents from different components | |
| Preprocessors | Preprocess text and documents | |
| Rankers | Sort documents based on specific criteria | Hugging Face |
| Readers | Find answers in documents | |
| Retrievers | Fetch documents from a document store based on a query | Astra, Chroma, Elasticsearch, MongoDB Atlas, OpenSearch, Pgvector, Pinecone, Qdrant, Weaviate |
| Routers | Manipulate pipeline control flow | |
| Validators | Validate data based on schemas | |
| Web Search | Perform search queries | Search, SerperDev |
| Writers | Write data into data sources |
If Haystack lacks a functionality that you need, you can easily create your own component and slot that into a pipeline. Broadly speaking, writing a custom component requires:
@component decorator.run() method. The parameters passed to this method double as the component’s inputs.run() method with a @component.output_types() decorator.Below is an example of a toy Embedder component that receives a text input and returns a random vector representation as embedding.
import random
from typing import List
from haystack import component, Pipeline
from haystack.document_stores.in_memory import InMemoryDocumentStore
from haystack.components.retrievers.in_memory import InMemoryEmbeddingRetriever
@component
class MyEmbedder:
def __init__(self, dim: int = 128):
self.dim = dim
@component.output_types(embedding=List[float])
def run(self, text: str):
print(f"Random embedding for text : {text}")
embedding = [random.uniform(1.0, -1.0) for _ in range(self.dim)]
return {"embedding": embedding}
# Using the component directly
my_embedder = MyEmbedder()
my_embedder.run(text="Hi, my name is Tuana")
# Using the component in a pipeline
document_store = InMemoryDocumentStore()
query_pipeline = Pipeline()
query_pipeline.add_component("text_embedder", MyEmbedder())
query_pipeline.add_component("retriever", InMemoryEmbeddingRetriever(document_store=document_store))
query_pipeline.connect("text_embedder.embedding", "retriever.query_embedding")
query_pipeline.run({"text_embedder":{"text": "Who lives in Berlin?"}})
Haystack 2.0 offers ready-made pipeline templates for common use cases, which can be created with just a single line of code.
from haystack import Pipeline, PredefinedPipeline
pipeline = Pipeline.from_template(PredefinedPipeline.CHAT_WITH_WEBSITE)
# and then you can run this pipeline 👇
# pipeline.run({
# "fetcher": {"urls": ["https://haystack.deepset.ai/overview/quick-start"]},
# "prompt": {"query": "How should I install Haystack?"}}
# )
In Haystack 2.0, Document Stores provide a common interface through which pipeline components can read and manipulate data without any knowledge of the backend technology. Furthermore, Document Stores are paired with specialized retriever components that can be used to fetch documents from a particular data source based on specific queries.
This separation of interface and implementation lets us provide support for several third-party providers of vector databases such as Weaviate, Chroma, Pinecone, Astra DB, MongoDB, Qdrant, Pgvector, Elasticsearch, OpenSearch, Neo4j and Marqo.
#pip install chroma-haystack
from haystack_integrations.document_stores.chroma import ChromaDocumentStore
from haystack_integrations.components.retrievers.chroma import ChromaEmbeddingRetriever
document_store = ChromaDocumentStore()
retriever = ChromaEmbeddingRetriever(document_store)
Thanks to Haystack 2.0’s flexible infrastructure, pipelines can be easily extended with external technologies and libraries in the form of new components, document stores, etc, all the while keeping dependencies cleanly separated.
Starting with 2.0, integrations are divided into two categories:
haystack-core-integrations GitHub repository.Please refer to the official integrations website for more information.
The monitoring of Haystack 2.0 pipelines in production is aided by both a customizable logging system that supports structured logging and tracing correlation out of the box, and code instrumentation collecting spans and traces in strategic points of the execution path, with support for Open Telemetry and Datadog already in place.
Haystack 2.0 provides a framework-agnostic system of addressing and using devices such as GPUs and accelerators across different platforms and providers.
To securely manage credentials for services that require authentication, Haystack 2.0 provides a type-safe approach to handle authentication and API secrets that prevents accidental leaks.
Haystack 2.0 prompt templating uses Jinja, and prompts are included in pipelines with the use of a PromptBuilder (or DymanicPromptBuilder for advanced use cases ). Everything in {{ }} in a prompt, becomes an input to the PromptBuilder.
The following prompt_builder will expect documents and query as input.
from haystack.components.builders import PromptBuilder
template = """Given these documents, answer the question.
Documents:
{% for doc in documents %}
{{ doc.content }}
{% endfor %}
Question: {{query}}
Answer:"""
prompt_builder = PromptBuilder(template=template)
Alongside Haystack 2.0, today we are also releasing a whole set of new tutorials, documentation, resources and more to help you get started:
Stay up-to-date with Haystack:
Follow the progress we made during beta in each beta release:
Nothing published for this version
Introducing a flexible and dynamic approach to creating NLP pipelines with Haystack's new PipelineTemplate class!
Introducing a flexible and dynamic approach to creating NLP pipelines with Haystack's new PipelineTemplate class!
This innovative feature utilizes Jinja templated YAML files, allowing users to effortlessly construct and customize complex data processing pipelines for various NLP tasks. From question answering and document indexing to custom pipeline requirements, the PipelineTemplate simplifies configuration and enhances adaptability. Users can now easily override default components or integrate custom settings with simple, straightforward code.
For example, the following pipeline template can be used to create an indexing pipeline:
from haystack.components.embedders import SentenceTransformersDocumentEmbedder
from haystack.templates import PipelineTemplate, PipelineType
pt = PipelineTemplate(PipelineType.INDEXING, template_params={"use_pdf_file_converter": True})
pt.override("embedder", SentenceTransformersDocumentEmbedder(progress_bar=True))
pipe = ptb.build()
result = pipe.run(data={"sources": ["some_local_dir/and_text_file.txt", "some_other_local_dir/and_pdf_file.pdf"]})
print(result)
In the above example, a PipelineType.INDEXING enum is used to create a pipeline with a custom instance of SentenceTransformersDocumentEmbedder and the PDF file converter enabled.
The pipeline is then run on a list of local files and the result is printed (number of indexed documents). We could have of course used the same PipelineTemplate class to create any other pre-defined pipeline or even a custom pipeline with custom components and settings. On the other hand, the following pipeline template can be used to create a pre-defined RAG pipeline:
from haystack.templates import PipelineTemplate, PipelineType
pipe = PipelineTemplate(PipelineType.RAG).build()
result = pipe.run(query="What's the meaning of life?")
print(result)
_templateSource loads template content from various inputs, including strings, files, predefined templates, and URLs. The class provides mechanisms to load templates dynamically and ensure they contain valid Jinja2 syntax.
Adopt the new framework-agnostic device management in Sentence Transformers Embedders.
Before this change:
from haystack.components.embedders import SentenceTransformersTextEmbedder
embedder = SentenceTransformersTextEmbedder(device="cuda:0")
After this change:
from haystack.utils.device import ComponentDevice, Device
from haystack.components.embedders import SentenceTransformersTextEmbedder
device = ComponentDevice.from_single(Device.gpu(id=0)) # or
# device = ComponentDevice.from_str("cuda:0") embedder = SentenceTransformersTextEmbedder(device=device)
Adopt the new framework-agnostic device management in Local Whisper Transcriber.
Before this change:
from haystack.components.audio import LocalWhisperTranscriber
transcriber = LocalWhisperTranscriber(device="cuda:0")
After this change:
from haystack.utils.device import ComponentDevice, Device from haystack.components.audio import LocalWhisperTranscriber
device = ComponentDevice.from_single(Device.gpu(id=0)) # or
# device = ComponentDevice.from_str("cuda:0") transcriber = LocalWhisperTranscriber(device=device)
Add FilterRetriever. It retrieves documents that match the provided (either at init or runtime) filters.
Add LostInTheMiddleRanker. It reorders documents based on the "Lost in the Middle" order, a strategy that places the most relevant paragraphs at the beginning or end of the context, while less relevant paragraphs are positioned in the middle.
Add support for Mean Reciprocal Rank (MRR) Metric to <span class="title-ref">StatisticalEvaluator</span>. MRR measures the mean reciprocal rank of times a label is present in at least one or more predictions.
Introducing the OutputAdapter component which enables seamless data flow between pipeline components by adapting the output of one component to match the expected input of another using Jinja2 template expressions. This addition opens the door to greater flexibility in pipeline configurations, facilitating custom adaptation rules and exemplifying a structured approach to inter-component communication.
Add <span class="title-ref">is_greedy</span> argument to <span class="title-ref">@component</span> decorator. This flag will change the behaviour of <span class="title-ref">Component`s with inputs that have a `Variadic</span> type when running inside a <span class="title-ref">Pipeline</span>.
Variadic `Component`s that are marked as greedy will run as soon as they receive their first input. If not marked as greedy instead they'll wait as long as possible before running to make sure they receive as many inputs as possible from their senders.
It will be ignored for all other `Component`s even if set explicitly.
Remove the old evaluation API in favor of a Component based API. We now have <span class="title-ref">SASEvaluator</span> and <span class="title-ref">StatisticalEvaluator</span> replacing the old API.
Introduced JsonSchemaValidator to validate the JSON content of ChatMessage against a provided JSON schema. Valid messages are emitted through the 'validated' output, while messages failing validation are sent via the 'validation_error' output, along with useful error details for troubleshooting.
Add a new variable called meta_value_type to the MetaFieldRanker that allows a user to parse the meta value into the data type specified as along as the meta value is a string. The supported values for meta_value_type are '"float"', '"int"', '"date"', or 'None'. If None is passed then no parsing is done. For example, if we specified meta_value_type="date" then for the meta value "date": "2015-02-01" we would parse the string into a datetime object.
Add <span class="title-ref">TextCleaner</span> Component to clean list of strings. It can remove substrings matching a list of regular expressions, convert text to lowercase, remove punctuation, and remove numbers. This is mostly useful to clean generator predictions before evaluation.
Pipeline.connect() arguments have renamed for clarity. This is a breaking change if connect was called with keyword arguments only. connect_from and c…
pipeline.connect("fetcher", "converter").connect("converter", "splitter").connect("splitter", "ranker")\
.connect("ranker", "prompt_builder").connect("prompt_builder", "llm")
⚠️ Breaking change: Update secret handling for components using the Secret type. The following components are affected: RemoteWhisperTranscriber, Azur…
Upgraded the default converter in PyPDFToDocument to insert page breaks "f" between each extracted page. This allows for downstream components and applications to better be able to keep track of the original PDF page a portion of text comes from.
⚠️ Breaking change: Update secret handling for components using the Secret type. The following components are affected: RemoteWhisperTranscriber, AzureOCRDocumentConverter, AzureOpenAIDocumentEmbedder, AzureOpenAITextEmbedder, HuggingFaceTEIDocumentEmbedder, HuggingFaceTEITextEmbedder, OpenAIDocumentEmbedder, SentenceTransformersDocumentEmbedder, SentenceTransformersTextEmbedder, AzureOpenAIGenerator, AzureOpenAIChatGenerator, HuggingFaceLocalChatGenerator, HuggingFaceTGIChatGenerator, OpenAIChatGenerator, HuggingFaceLocalGenerator, HuggingFaceTGIGenerator, OpenAIGenerator, TransformersSimilarityRanker, SearchApiWebSearch, SerperDevWebSearch
The default init parameters for api_key, token, azure_ad_token have been adjusted to use environment variables wherever possible. The azure_ad_token_provider parameter has been removed from Azure-based components. Components based on Hugging Face are now required to either use a token or an environment variable if authentication is required - The on-disk local token file is no longer supported.
Required actions to take: To make fixes to accommodate to this breaking change check the expected environment variable name for the
api_keyof the affected component you are using. Make sure to provide your API keys via this environment variable. Alternatively, if that's not an option, use theSecret.from_tokenfunction to wrap any bare/string API tokens. Mind that pipelines using token secrets cannot be serialized/deserialized.
Expose a Secret type to provide consistent API for any component that requires secrets for authentication. Currently supports string tokens and environment variables. Token-based secrets are automatically prevented from being serialized to disk (to prevent accidental leakage of secrets).
from haystack.utils import Secret
@component
class MyComponent:
def __init__(self, api_key: Optional[Secret] = None, **kwargs):
self.api_key = api_key
self.backend = None
def warm_up(self):
# Call resolve_value to yield a single result. The semantics of the result is policy-dependent.
# Currently, all supported policies will return a single string token.
self.backend = SomeBackend(api_key=self.api_key.resolve_value() if self.api_key else None, ...)
def to_dict(self):
# Serialize the policy like any other (custom) data. If the policy is token-based, it will
# raise an error.
return default_to_dict(self, api_key=self.api_key.to_dict() if self.api_key else None, ...)
@classmethod
def from_dict(cls, data):
# Deserialize the policy data before passing it to the generic from_dict function.
api_key_data = data["init_parameters"]["api_key"]
api_key = Secret.from_dict(api_key_data) if api_key_data is not None else None
data["init_parameters"]["api_key"] = api_key
return default_from_dict(cls, data)
# No authentication.
component = MyComponent(api_key=None)
# Token based authentication
component = MyComponent(api_key=Secret.from_token("sk-randomAPIkeyasdsa32ekasd32e"))
component.to_dict() # Error! Can't serialize authentication tokens
# Environment variable based authentication
component = MyComponent(api_key=Secret.from_env("OPENAI_API_KEY"))
component.to_dict() # This is fine
Adds support for the Exact Match metric to EvaluationResult.calculate_metrics(...):
from haystack.evaluation.metrics import Metric
exact_match_metric = eval_result.calculate_metrics(Metric.EM, output_key="answers")
Adds support for the F1 metric to EvaluationResult.calculate_metrics(...):
from haystack.evaluation.metrics import Metric
f1_metric = eval_result.calculate_metrics(Metric.F1, output_key="answers")
Adds support for the Semantic Answer Similarity (SAS) metric to EvaluationResult.calculate_metrics(...):
from haystack.evaluation.metrics import Metric
sas_metric = eval_result.calculate_metrics(
Metric.SAS, output_key="answers", model="sentence-transformers/paraphrase-multilingual-mpnet-base-v2" )
Introducing the HuggingFaceLocalChatGenerator, a new chat-based generator designed for leveraging chat models from Hugging Face's (HF) model hub. Users can now perform inference with chat-based models in a local runtime, utilizing familiar HF generation parameters, stop words, and even employing custom chat templates for custom message formatting. This component also supports streaming responses and is optimized for compatibility with a variety of devices.
Here is an example of how to use the HuggingFaceLocalChatGenerator:
from haystack.components.generators.chat import HuggingFaceLocalChatGenerator
from haystack.dataclasses import ChatMessage
generator = HuggingFaceLocalChatGenerator(model="HuggingFaceH4/zephyr-7b-beta")
generator.warm_up()
messages = [ChatMessage.from_user("What's Natural Language Processing? Be brief.")]
print(generator.run(messages))
Pipeline.add_component() to fail if the Component instance has already been added in another Pipeline.device_map when loading a TransformersSimilarityRanker and ExtractiveReader. This allows for multi-device inference and for loading quantized models (e.g. load_in_8bit=True)ByteStream.from_file_path() and ByteStream.from_string().TransformerSimilarityRankerdefault_streaming_callback was confusing, this function was the go-to-helper one would use to quickly print the generated tokens as they come, but it was not used by default. The function was then renamed to print_streaming_chunk.pandas and numpy packages. This has now been changed to import only the necessary classes and functions.DocumentJoiner's reciprocal rank fusion, enhancing the relevance of document sorting by allowing customizable influence on the final scoresComponenthaystack-ai installed.__canals_input__ and __canals_ouput__ have been renamed respectively to __haystack_input__ and __haystack_ouput__. CANALS_VARIADIC_ANNOTATION has been renamed to HAYSTACK_VARIADIC_ANNOTATION and it's value changed from __canals__variadic_t to __haystack__variadic_t. Default Pipeline debug_path has been changed from .canals_debug to .haystack_debug.Implement framework-agnostic device representations. The main impetus behind this change is to move away from stringified representations of devices t
Implement framework-agnostic device representations. The main impetus behind this change is to move away from stringified representations of devices that are not portable between different frameworks. It also enables support for multi-device inference in a generic manner.
Going forward, components can expose a single, optional device parameter in their constructor (<span class="title-ref">Optional[ComponentDevice]</span>):
import haystack.utils import ComponentDevice, Device, DeviceMap
class MyComponent(Component):
def __init__(self, device: Optional[ComponentDevice] = None):
# If device is None, automatically select a device.
self.device = ComponentDevice.resolve_device(device)
def warm_up(self):
# Call the framework-specific conversion method.
self.model = AutoModel.from_pretrained("deepset/bert-base-cased-squad2", device=self.device.to_hf())
# Automatically selects a device.
c = MyComponent(device=None)
# Uses the first GPU available.
c = MyComponent(device=ComponentDevice.from_str("cuda:0"))
# Uses the CPU.
c = MyComponent(device=ComponentDevice.from_single(Device.cpu()))
# Allow the component to use multiple devices using a device map.
c = MyComponent(device=ComponentDevice.from_multiple(
DeviceMap({
"layer1": Device.cpu(),
"layer2": Device.gpu(1),
"layer3": Device.disk()
})
))
Change any occurrence of:
from haystack.components.routers.document_joiner import DocumentJoiner
to:
from haystack.components.joiners.document_joiner import DocumentJoiner
Change the imports for in_memory document store and retrievers from:
from haystack.document_stores import InMemoryDocumentStore from haystack.components.retrievers import InMemoryEmbeddingRetriever
to:
from haystack.document_stores.in_memory import InMemoryDocumentStore from haystack.components.retrievers.in_memory import InMemoryBM25Retriever
Rename the transcriber parametersmodel_name and model_name_or_path to model. This change affects both LocalWhisperTranscriber and RemoteWhisperTranscriber classes.
Rename the embedder parameters model_name and model_name_or_path tomodel. This change affects all Embedder classes.
Rename model_name_or_path to model in NamedEntityExtractor.
Rename model_name_or_path to model in TransformersSimilarityRanker.
Rename parametermodel_name_or_pathtomodel inExtractiveReader.
Rename the generator parameters model_name and model_name_or_path to model. This change affects all Generator classes.
Adds calculate_metrics() function to EvaluationResult for computation of evaluation metrics. Adds Metric class to store list of available metrics. Adds MetricsResult class to store the metric values computed during the evaluation.
Added a new extractor component, namely NamedEntityExtractor. This component accepts a list of Documents as its input - the raw text in the documents are annotated by the extractor and the annotations are stored in the document's meta dictionary (under the key named_entities).
The component is designed to support multiple NER backends, and the current implementations support two at the moment: Hugging Face and spaCy. These two backends implement support for any HF/spaCy model that supports token classification/NER respectively.
Add `component.set_input_type()</span> function to set a Component input name, type and default value.
Adds support for single metadata dictionary input in MarkdownToDocument.
Adds support for single metadata dictionary input in TikaDocumentConverter.
default_value to the InputSocket dataclass. Deriveis_mandatory value from the presence of default_value.split_by "page" to DocumentSplitter, which will split the document at "\f"CacheChecker from List[Any] to Listto make it possible to connect it in a Pipeline.Pipeline.draw() output.URLCacheChecker so that it can work with any type of data in the DocumentStore, not just URL caching. Rename the component to CacheChecker.MetaFieldRanker from throwing an error if one or more of the documents doesn't contain the specific meta data field. Now those documents will be ignored for ranking purposes and placed at the end of the ranked list so we don't completely throw them away. Adding a sort_order that can have values of descending or ascending. Added more runtime parameters.joiners and move DocumentJoiner there for clarity.in_memory package symbols in the haystack.document_store and <shaystack.components.retrievers root namespaces.AzureOCRDocumentConverter. In this way, additional metadata can be added to all files processed by this component even when the length of the list of sources is unknown.run method. ComponentMeta.__call__ handles the creation of InputSockets for the component's inputs when the latter has not explicitly called _Component.set_input_types(). This logic was not correctly handling keyword-only parameters.InMemoryBM25Retriever from returning documents with a score of 0.0.pytest breaking in VSCode due to a name collision in the RAG pipeline tests.Deprecate GPTGenerator and GPTChatGenerator. Replace them with OpenAIGenerator and OpenAIChatGenerator.
Add HuggingFace TEI Embedders - <span class="title-ref">HuggingFaceTEITextEmbedder</span> and <span class="title-ref">HuggingFaceTEIDocumentEmbedder</span>.
An example using <span class="title-ref">HuggingFaceTEITextEmbedder</span> to embed a string:
from haystack.components.embedders import HuggingFaceTEITextEmbedder
text_to_embed = "I love pizza!"
text_embedder = HuggingFaceTEITextEmbedder(model="BAAI/bge-small-en-v1.5", url="<your-tei-endpoint-url>", token="<your-token>" ) print(text_embedder.run(text_to_embed))
# {'embedding': [0.017020374536514282, -0.023255806416273117, ...]
An example using <span class="title-ref">HuggingFaceTEIDocumentEmbedder</span> to create Document embeddings:
from haystack.dataclasses import Document
from haystack.components.embedders import HuggingFaceTEIDocumentEmbedder
doc = Document(content="I love pizza!")
document_embedder = HuggingFaceTEIDocumentEmbedder( model="BAAI/bge-small-en-v1.5", url="<your-tei-endpoint-url>", token="<your-token>" )
result = document_embedder.run([doc])
print(result["documents"][0].embedding)
# [0.017020374536514282, -0.023255806416273117, ...]
Adds AzureOpenAIDocumentEmbedder and AzureOpenAITextEmbedder as new embedders. These embedders are very similar to their OpenAI counterparts, but they use the Azure API instead of the OpenAI API.
Adds support for Azure OpenAI models with AzureOpenAIGenerator and AzureOpenAIChatGenerator components.
Adds RAG OpenAPI services integration.
Introduces answer deduplication on the Document level based on an overlap threshold.
Add <span class="title-ref">Multiplexer</span>. For an example of its usage, see https://github.com/deepset-ai/haystack/pull/6420.
Adds support for single metadata dictionary input in <span class="title-ref">TextFileToDocument</span>`.
If you are using AzureOCRDocumentConverter or TikaDocumentConverter , you need to change paths to sources in the run method.
If you are using <span class="title-ref">AzureOCRDocumentConverter</span> or <span class="title-ref">TikaDocumentConverter</span>, you need to change <span class="title-ref">paths</span> to <span class="title-ref">sources</span> in the <span class="title-ref">run</span> method.
An example: `python from haystack.components.converters import TikaDocumentConverter converter = TikaDocumentConverter() converter.run(paths=["paths/to/file1.pdf", "path/to/file2.pdf"])`
The last line should be changed to: `python converter.run(sources=["paths/to/file1.pdf", "path/to/file2.pdf"])`
Adds markdown mimetype support to the file type router i.e. <span class="title-ref">FileTypeRouter</span> class.
Refactor <span class="title-ref">Answer</span> dataclass and classes that inherited it. Now <span class="title-ref">Answer</span> is a Protocol, classes that used to inherit it now respect that interface. We also added a new <span class="title-ref">ExtractiveTableAnswer</span> to be used for table question answering.
All classes now are easily serializable using <span class="title-ref">to_dict()</span> and <span class="title-ref">from_dict()</span> like <span class="title-ref">Document</span> and components.
Make all Converters accept <span class="title-ref">meta</span> in the <span class="title-ref">run</span> method, so that users can provide their own metadata. The length of this list should match the number of <span class="title-ref">sources</span>.
Make all the Converters accept the <span class="title-ref">sources</span> parameter in the <span class="title-ref">run</span> method. <span class="title-ref">sources</span> is a list that can contain str, Path or ByteStream objects.
Renamed the confidence_threshold parameter of the ExtractiveReader to score_threshold as ExtractedAnswers have a score and this is what the threshold is for. For consistency, the term confidence is not mentioned anymore in favor of score.
Include 'boilerpy3' in the 'haystack-ai' dependencies.
Nothing published for this version
We will add more features and we might add breaking changes until the stable 2.0 release in late Q1 2024.
We are happy to officially share Haystack 2.0-beta with you. The new version is a complete rework of the pipeline, our core concept, with production readiness, ease of use, and customizability in mind.
Haystack 2.0-Beta Documentation. Check the available features in this Beta release (see section below). Try out Haystack 2.0-Beta in “Advent of Code”.
Production readiness means also caring about stability. Therefore, we decided to release a beta version now and test it thoroughly in public over the next weeks. We will add more features and we might add breaking changes until the stable 2.0 release in late Q1 2024.
We invite you to try this beta version and give candid feedback, it will be heard and we will change Haystack accordingly. We’ve put together 10 code challenges for you in our “Advent of Haystack” to get your hands on it. We don’t recommend migrating your production pipelines yet to 2.0 beta.
We will support Haystack 1.x with updates and important features being added to the codebase even after the final 2.0.0 release, to give users time to migrate.
For a detailed overview of what’s changed in this Beta release, check out our article “Introducing Haystack 2.0 and Advent of Haystack”.
The bulk of the work in this release introduces changes to the fundamental design of:
In the last few months, we've been working with our community members and partners to already start adding some integrations for Haystack 2.0. Today, along with the beta package you can also try integrations tagged with Haystack 2.0 in our Integration inventory!
One way to get started with Haystack 2.0 Beta is to participate in the “Advent of Haystack” and give us feedback on how you got along.
To install the new package:
pip install haystack-ai
To use a simple RAG pipeline:
from haystack import Document
from haystack.document_stores import InMemoryDocumentStore
from haystack.pipeline_utils import build_rag_pipeline
API_KEY = "sk-xxx" # ADD YOUR OPENAI API KEY
# We support many different databases. Here we load a simple and lightweight in-memory document store.
document_store = InMemoryDocumentStore()
# Create some example documents and add them to the document store.
documents = [
Document(content="My name is Jean and I live in Paris."),
Document(content="My name is Mark and I live in Berlin."),
Document(content="My name is Giorgio and I live in Rome."),
]
document_store.write_documents(documents)
# Let's now build a simple RAG pipeline that uses a generative model to answer questions.
rag_pipeline = build_rag_pipeline(llm_api_key=API_KEY, document_store=document_store)
answers = rag_pipeline.run(query="Who lives in Rome?")
print(answers.data)
For more details on how to get started see: https://docs.haystack.deepset.ai/v2.0/docs/get_started
✅ Ready in this Beta release
🏗️ Under construction
| Feature | Haystack 2.0-Beta |
|---|---|
| Document Stores | |
| InMemoryDocumentStore | ✅ |
| ElasticsearchDocumentstore | ✅ |
| OpenSearchDocumentStore | ✅ |
| ChromaDocumentStore | ✅ |
| MarqoDocumentStore | ✅ |
| FAISSDocumentStore | 🏗️ |
| PineconeDocumentStore | 🏗️ |
| WeaviateDocumentStore | 🏗️ |
| MilvusDocumentStore | 🏗️ |
| QdrantDocumentStore | 🏗️ |
| PGVectorDocumentStore | 🏗️ |
| MongoDBAtlasDocumentStore | 🏗️ |
| Generators | |
| GPTGenerator | ✅ |
| HuggingFaceLocalGenerator | ✅ |
| HuggingFaceTGIGenerator | ✅ |
| GradientGenerator | ✅ |
| Anthropic - Claude | 🏗️ |
| Cohere - generate | ✅ |
| AzureGPT | 🏗️ |
| AWS Bedrock | 🏗️ |
| AWS SageMaker | 🏗️ |
| PromptNode | 🏗️ |
| PromptBuilder | ✅ |
| AnswerBuilder | ✅ |
| Embedders | |
| OpenAI Embedder | ✅ |
| SentenceTransformers Embedder | ✅ |
| Cohere - embed | 🏗️ |
| Gradient Embedder (external) | ✅ |
| Retrievers | |
| InMemoryBM25Retriever | ✅ |
| InMemoryEmbeddingRetriever | ✅ |
| ElasticsearchBM25Retriever | ✅ |
| ElasticsearchEmbeddingRetriever | ✅ |
| OpensearchBM25Retriever | ✅ |
| OpensearchEmbeddingRetriever | ✅ |
| SerperDevWebSearch | ✅ |
| MultiModalRetriever | 🏗️ |
| TableTextRetriever | 🏗️ |
| DensePassageRetriever | 🏗️ |
| Rankers | |
| TransformersSimilarityRanker | ✅ |
| CohereRanker | 🏗️ |
| DiversityRanker | 🏗️ |
| LostInTheMiddleRanker | 🏗️ |
| RecentnessRanker | 🏗️ |
| MetaFieldRanker | ✅ |
| Readers | |
| ExtractiveReader | |
| (successor of both FARMReader and TransformersReader) | ✅ |
| TableReader | 🏗️ |
| Data Processing | |
| Local + Remote WhisperTranscriber | ✅ |
| UrlCacheChecker | ✅ |
| LinkContentFetcher | ✅ |
| AzureOCRDocumentConverter | ✅ |
| HTMLToDocument | ✅ |
| PyPDFToDocument | ✅ |
| TikaDocumentConverter | ✅ |
| TextFileToDocument | ✅ |
| MarkdownToDocument | ✅ |
| DocumentCleaner | ✅ |
| TextDocumentSplitter | ✅ |
| TextLanguageClassifier | ✅ |
| FileTypeRouter | ✅ |
| MetadataRouter | ✅ |
| DocumentWriter | ✅ |
| DocumentJoiner | ✅ |
| Misc | |
| Evaluation | 🏗️ |
| Agents | 🏗️ |
| Conversational Agent | 🏗️ |
| TopPSampler | ✅ |
| TransformersSummarizer | 🏗️ |
| TransformersTranslator | 🏗️ |
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →