⭐️ Highlights
Faster imports
Thanks to lazy import, importing individual components now uses 50% less CPU time on average. The overall import performance has also improved: for example, import haystack
now uses between 2-5% of its previous CPU time.
Extended Async Run Support
As of this release, all chat generators and retrievers come with the run_async
method, providing async execution on the component level.
New MSGToDocument
component
Use MSGToDocument to convert Microsoft Outlook .msg
files into Haystack documents. This component extracts the email metadata (such as sender, recipients, CC, BCC, subject) and body content and converts any file attachments into ByteStream
objects.
Turn off validation for pipeline connections
Set connection_type_validation
to false when initializing Pipeline
to disable type validation for pipeline connections. This will allow you to connect any edges and bypass errors you might get for example when you connect Optional[str]
output to str
input
⬆️ Upgrade Notes
-
The
ExtractedTableAnswer
dataclass and thedataframe
field in theDocument
dataclass, deprecated in Haystack 2.10.0, have now been removed.pandas
is no longer a required dependency for Haystack, making the installation lighter. If a component you use requirespandas
, an informative error will be raised, prompting you to install it. For details and motivation, see the GitHub discussion #8688. -
Starting from Haystack 2.11.0 Python 3.8 is no longer supported. Python 3.8 reached its end of life on October 2024.
-
The AzureOCRDocumentConverter no longer produces
Document
objects with the deprecateddataframe
field.Am I affected?
- If your workflow relies on the
dataframe
field inDocument
objects generated by AzureOCRDocumentConverter, you are affected. - If you saw a
DeprecationWarning
in Haystack 2.10 when initializing aDocument
with adataframe
, this change will now remove that field entirely.
How to handle the change:
- Instead of storing detected tables as a
dataframe
, AzureOCRDocumentConverter now represents tables as CSV-formatted text in thecontent
field of theDocument
. - Update your processing logic to handle CSV-formatted tables instead of a
dataframe
. If needed, you can convert the CSV text back into adataframe
usingpandas.read_csv()
.
- If your workflow relies on the
🚀 New Features
- Add a new MSGToDocument component to convert .msg files into Haystack Document objects.
- Extracts email metadata (e.g. sender, recipients, CC, BCC, subject) and body content into a Document.
- Converts attachments into ByteStream objects which can be passed onto a FileTypeRouter + relevant converters.
- We've introduced a new type_validation parameter to control type compatibility checks in pipeline connections. It can be set to True (default) or False which means no type checks will be done and everything is allowed.
- Add
run_async
method to HuggingFaceAPIChatGenerator. This method relies internally on theAsyncInferenceClient
from huggingface to generate chat completions and supports the same parameters as therun
method. It returns a coroutine that can be awaited. - Add
run_async
method to OpenAIChatGenerator. This method internally uses the async version of the OpenAI client to generate chat completions and supports the same parameters as therun
method. It returns a coroutine that can be awaited. - The InMemoryDocumentStore and the associated InMemoryBM25Retriever and InMemoryEmbeddingRetriever retrievers now support async mode.
- Add
run_async
method to DocumentWriter. This method supports the same parameters as therun
method and relies on the DocumentStore to implementwrite_documents_async
. It returns a coroutine that can be awaited. - Add
run_async
method to AzureOpenAIChatGenerator. This method usesAsyncAzureOpenAI
to generate chat completions and supports the same parameters as therun
method. It returns a coroutine that can be awaited. - Sentence Transformers components now support ONNX and OpenVINO backends through the "backend" parameter. Supported backends are torch (default), onnx, and openvino. Refer to the Sentence Transformers documentation for more information.
- Add
run_async
method to HuggingFaceLocalChatGenerator. This method internally uses ThreadPoolExecutor to return coroutines that can be awaited.
⚡️ Enhancement Notes
- Improved AzureDocumentEmbedder to handle embedding generation failures gracefully. Errors are logged, and processing continues with the remaining batches.
- In the FileTypeRouter add explicit support for classifying .msg files with mimetype "application/vnd.ms-outlook" since the mimetypes module returns None for .msg files by default.
- Added the store_full_path init variable to XLSXToDocument to allow users to toggle whether to store the full path of the source file in the meta of the Document. This is set to False by default to increase privacy.
- Increased default timeout for Mermaid server to 30 seconds. Mermaid server is used to draw Pipelines. Exposed the timeout as a parameter for the
Pipeline.show
andPipeline.draw
methods. This allows users to customize the timeout as needed. - Optimize import times through extensive use of lazy imports across packages. Importing one component of a certain package, no longer leads to importing all components of the same package. For example, importing OpenAIChatGenerator no longer imports AzureOpenAIChatGenerator.
- Haystack now officially supports Python 3.13. Some components and integrations may not yet be compatible. Specifically, the NamedEntityExtractor does not work with Python 3.13 when using the
spacy
backend. Additionally, you may encounter issues installingopenai-whisper
, which is required by the LocalWhisperTranscriber component, if you useuv
orpoetry
for installation. In this case, we recommend usingpip
for installation. EvaluationRunResult
can now output the results in JSON, a pandas Dataframe or in a CSV file.- Update ListJoiner to only optionally need list_type to be passed. By default it uses type List which acts like List[Any].
- This allows the ListJoiner to combine any incoming lists into a single flattened list.
- Users can still pass list_type if they would like to have stricter type validation in their pipelines.
- Added PDFMinerToDocument functionality to detect and report undecoded CID characters in PDF text extraction, helping users identify potential text extraction quality issues when processing PDFs with non-standard fonts.
- Simplified the serialization code for better readability and maintainability.
- Updated deserialization to allow users to omit the
typing.
prefix for standard typing library types (e.g.,List[str]
instead oftyping.List[str]
).
- Updated deserialization to allow users to omit the
⚠️ Deprecation Notes
- The use of pandas Dataframe in
EvaluationRunResult
is now optional and the methodsscore_report
,to_pandas
andcomparative_individual_scores_report
are deprecated and will be removed in the next haystack release.
🐛 Bug Fixes
- In the
ChatMessage.to_openai_dict_format
utility method, include thename
field in the returned dictionary, if present. Previously, thename
field was erroneously skipped. - Pipelines with components that return plain pandas dataframes failed. The comparison of socket values is now 'is not' instead of '!=' to avoid errors with dataframes.
- Make sure that OpenAIChatGenerator sets
additionalProperties: False
in the tool schema whentool_strict
is set toTrue
. - Fix a bug where the
output_type
of a ConditionalRouter was not being serialized correctly. This would cause the router to work incorrectly after being serialized and deserialized. - Fixed accumulation of a tools arguments when streaming with an OpenAIChatGenerator
- Added a fix to the pipeline's component scheduling alogrithm to reduce edge cases where the execution order of components that are simultaneously waiting for inputs has an impact on a pipeline's output. We look at topolgical order first to see which of the waiting components should run first and fall back to lexicographical order when both components are on the same topology-level. In cyclic pipelines, if the waiting components are in the same cycle, we fall back to lexicographical order immediately.
- Fixes serialization of
typing.Any
when usingserialize_type
utility - Fixes an edge case in the pipeline-run logic where an existing input could be overwritten if the same component connects to the socket from multiple output sockets.
- ComponentTool does not truncate
description
anymore. - Updates import paths for type hints to get ddtrace 3.0.0 working with our datadog tracer
- Improved serialization and deserialization in
haystack/utils/type_serialization.py
to handleOptional
types correctly.