github deepset-ai/haystack v2.11.0-rc3

pre-release2 days ago

⭐️ 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 the dataframe field in the Document 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 requires pandas, 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 deprecated dataframe field.

    Am I affected?

    • If your workflow relies on the dataframe field in Document objects generated by AzureOCRDocumentConverter, you are affected.
    • If you saw a DeprecationWarning in Haystack 2.10 when initializing a Document with a dataframe, 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 the content field of the Document.
    • Update your processing logic to handle CSV-formatted tables instead of a dataframe. If needed, you can convert the CSV text back into a dataframe using pandas.read_csv().

🚀 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 the AsyncInferenceClient from huggingface to generate chat completions and supports the same parameters as the run 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 the run 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 the run method and relies on the DocumentStore to implement write_documents_async. It returns a coroutine that can be awaited.
  • Add run_async method to AzureOpenAIChatGenerator. This method uses AsyncAzureOpenAI to generate chat completions and supports the same parameters as the run 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 and Pipeline.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 installing openai-whisper, which is required by the LocalWhisperTranscriber component, if you use uv or poetry for installation. In this case, we recommend using pip 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 of typing.List[str]).

⚠️ Deprecation Notes

  • The use of pandas Dataframe in EvaluationRunResult is now optional and the methods score_report, to_pandas and comparative_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 the name field in the returned dictionary, if present. Previously, the name 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 when tool_strict is set to True.
  • 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 using serialize_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 handle Optional types correctly.

Don't miss a new haystack release

NewReleases is sending notifications on new releases.