Skip to content

Releases: deepset-ai/haystack

v1.25.0

04 Mar 14:40
Compare
Choose a tag to compare

Release Notes

v1.25.0

⚡️ Enhancement Notes

  • Add raise_on_failure flag to BaseConverter class so that big processes can optionally continue without breaking from exceptions.

  • Upgrade Transformers to the latest version 4.37.2. This version adds support for the Phi-2 and Qwen2 models and improves support for quantization.

  • Add support for latest OpenAI embedding models text-embedding-3-large and text-embedding-3-small.

  • API_BASE can now be passed as an optional parameter in the getting_started sample. Only openai provider is supported in this set of changes. PromptNode and PromptModel were enhanced to allow passing of this parameter. This allows RAG against a local endpoint (e.g, http://localhost:1234/v1), so long as it is OpenAI compatible (such as LM Studio)

    Logging in the getting started sample was made more verbose, to make it easier for people to see what was happening under the covers.

  • Added new option split_by="page" to the preprocessor so we can chunk documents by page break.

🐛 Bug Fixes

  • Change the dummy vector used internally in the Pinecone Document Store. A recent change to the Pinecone API does not allow to use vectors filled with zeros as was the previous dummy vector.
  • The types of meta data values accepted by RouteDocuments was unnecessarily restricted to string types. This causes validation errors (for example when loading from a yaml file) if a user tries to use a boolean type for example. We add boolean and int types as valid types for metadata_values.
  • Fixed a bug that made it impossible to write Documents to Weaviate when some of the fields were empty lists (e.g. split_overlap for preprocessed documents).
  • Correct page meta field for pdfs that contain pages without any text content

v1.25.0-rc1

29 Feb 11:24
Compare
Choose a tag to compare

Release Notes

v1.25.0-rc1

⚡️ Enhancement Notes

  • Add raise_on_failure flag to BaseConverter class so that big processes can optionally continue without breaking from exceptions.

  • Upgrade Transformers to the latest version 4.37.2. This version adds support for the Phi-2 and Qwen2 models and improves support for quantization.

  • Add support for latest OpenAI embedding models text-embedding-3-large and text-embedding-3-small.

  • API_BASE can now be passed as an optional parameter in the getting_started sample. Only openai provider is supported in this set of changes. PromptNode and PromptModel were enhanced to allow passing of this parameter. This allows RAG against a local endpoint (e.g, http://localhost:1234/v1), so long as it is OpenAI compatible (such as LM Studio)

    Logging in the getting started sample was made more verbose, to make it easier for people to see what was happening under the covers.

  • Added new option split_by="page" to the preprocessor so we can chunk documents by page break.

🐛 Bug Fixes

  • Change the dummy vector used internally in the Pinecone Document Store. A recent change to the Pinecone API does not allow to use vectors filled with zeros as was the previous dummy vector.
  • The types of meta data values accepted by RouteDocuments was unnecessarily restricted to string types. This causes validation errors (for example when loading from a yaml file) if a user tries to use a boolean type for example. We add boolean and int types as valid types for metadata_values.
  • Fixed a bug that made it impossible to write Documents to Weaviate when some of the fields were empty lists (e.g. split_overlap for preprocessed documents).

v2.0.0-beta.8

22 Feb 10:08
088aa50
Compare
Choose a tag to compare
v2.0.0-beta.8 Pre-release
Pre-release

Release Notes

v2.0.0-beta.8

Highlights

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.

⬆️ Upgrade Notes

  • 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) 

🚀 New Features

  • 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 StatisticalEvaluator. 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 is_greedy argument to @component decorator. This flag will change the behaviour of Component`s with inputs that have a `Variadic type when running inside a Pipeline.

    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 SASEvaluator and StatisticalEvaluator 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 TextCleaner 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.

⚡️ Enhancement Notes

  • Add __repr__ to all Components to print their I/O. This can also be useful in Jupyter notebooks as this will be shown as a cell output if the it's the last expression in a cell.
  • Add new Pipeline.show() method to generated image inline if run in a Jupyter notebook. If called outside a notebook it will raise a PipelineDrawingError. Pipeline.draw() has also been simplified and the engine argument has been removed. Now all images will be generated using Mermaid.
  • Customize Pipeline.__repr__() to return a nice text representation of it. If run on a Jupyter notebook it will instead have the same behaviour as Pipeline.show().
  • Change Pipeline.run() to check if max_loops_allowed has been reached. If we attempt to run a Component that already ran the number of max_loops_allowed a PipelineMaxLoops will be raised.
  • Merge Pipeline`s definitions into a single `Pipeline class. The class in the haystack.pipeline package has been deleted and only haystack.core.pipeline exists now.
  • Enhanced the OpenAPIServiceConnector to support dynamic authentication handling. With this update, service credentials are now dynamically provided at each run invocation, eliminating the need for pre-configuring a known set of service authentications. This flexibility allows for the introduction of new services on-the-fly, each with its unique authentication, streamlining the integration process. This modification not only simplifies the initial setup of the OpenAPIServiceConnector but also ensures a more transparent and straightforward authentication process for each interaction with different OpenAPI services.

🐛 Bug Fixes

  • Adds api_base_url attribute to OpenAITExtEmbedder. Previously, it was used only for initialization and was not serialized.
  • Previously, when using the same input reference in different components, the Pipeline run logic had an unexpected behavior. This has been fixed by deepcopying the inputs before passing them to the components.

v1.24.1

08 Feb 13:40
Compare
Choose a tag to compare

Release Notes

v1.24.1

🐛 Bug Fixes

  • The types of meta data values accepted by RouteDocuments was unnecessarily restricted to string types. This causes validation errors (for example when loading from a yaml file) if a user tries to use a boolean type for example. We add boolean and int types as valid types for metadata_values.

v2.0.0-beta.7

07 Feb 15:44
a771d7f
Compare
Choose a tag to compare
v2.0.0-beta.7 Pre-release
Pre-release

Release Notes

v2.0.0-beta.7

⬆️ Upgrade Notes

  • Pipeline.connect() arguments have renamed for clarity. This is a breaking change if connect was called with keyword arguments only. connect_from and connect_to arguments have been renamed respectively to sender and receiver. The behaviour of Pipeline.connect() is not changed.

🚀 New Features

  • Rename Pipeline.connect() arguments for clarity

⚡️ Enhancement Notes

  • add dimensions parameter to OpenAI Embedders to fully support new embedding models like text-embedding-3-small, text-embedding-3-large and upcoming ones
  • Change Pipeline.connect() to return the instance of Pipeline. This way we can chain multiple connect() like so:
pipeline.connect("fetcher", "converter").connect("converter", "splitter").connect("splitter", "ranker")\
.connect("ranker", "prompt_builder").connect("prompt_builder", "llm")
  • Code from different "hf_utils.py" modules spread across different packages was merged into haystack.utils.hf.

🐛 Bug Fixes

  • Resolves a bug where the HuggingFaceTGIGenerator and HuggingFaceTGIChatGenerator encountered issues if provided with valid models that were not available on the HuggingFace inference API rate-limited tier. The fix, detailed in GitHub issue #6816 and its GitHub PR, ensures these components now correctly handle model availability, eliminating previous limitations.
  • Fix PromptBuilder missing input default values. These missing default value was causing the PromptBuilder to never run if certain inputs are not received.

v2.0.0-beta.6

05 Feb 15:51
c3a9dac
Compare
Choose a tag to compare
v2.0.0-beta.6 Pre-release
Pre-release

Release Notes

v2.0.0-beta.6

⬆️ Upgrade Notes

  • 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_key of 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 the Secret.from_token function to wrap any bare/string API tokens. Mind that pipelines using token secrets cannot be serialized/deserialized.

🚀 New Features

  • 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))

⚡️ Enhancement Notes

  • Change Pipeline.add_component() to fail if the Component instance has already been added in another Pipeline.
  • Use 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)
  • Add meta parameter to ByteStream.from_file_path() and ByteStream.from_string().
  • Add query and document prefix options for the TransformerSimilarityRanker
  • The default in default_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.
  • Speed up import of Document dataclass. Importing Document was slowed down cause we were importing the whole pandas and numpy packages. This has now been changed to import only the necessary classes and functions.
  • Introduces weighted score normalization for the DocumentJoiner's reciprocal rank fusion, enhancing the relevance of document sorting by allowing customizable influence on the final scores

🐛 Bug Fixes

  • Fix auto-complete never working for any Component
  • Fix Haystack imports failing when using local development environment that doesn't have haystack-ai installed.
  • Remove all mentions of Canals by renaming some variables. __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.

v1.24.0

25 Jan 16:17
Compare
Choose a tag to compare

Release Notes

Highlights

🪨 Amazon Bedrock supports new embedding models (#6406)

You can now use Titan and Cohere embedding models in your pipelines via the Amazon Bedrock integration.

  from haystack.nodes import EmbeddingRetriever

  retriever = EmbeddingRetriever(
      embedding_model="amazon.titan-embed-text-v1",
      document_store=document_store,
      aws_config = {"aws_access_key_id": "ACCESS_KEY",
                    "aws_secret_access_key": "SECRET_KEY",
                    "aws_session_token": "SESSION_TOKEN"})

🕸️ Use any WebDriver you want in Crawler (#5465)

The WebDriver that powers Haystack's crawler is no longer limited to Chrome.
Now you can configure it to use whatever WebDriver you'd like.
See our Crawler docs for more info.

v1.24.0

🚀 New Features

  • Adding Bedrock Embeddings Encoder to use as a retriever.
  • Add an optional webdriver parameter to Crawler. This allows using a pre-configured custom webdriver instead of creating the default Chrome webdriver.

⚡️ Enhancement Notes

  • Add model_kwargs to FARMReader to allow loading in fp16 at inference time
  • Make JoinDocuments sensitive to weights parameter when join_mode is reciprocal rank fusion. Add score normalization for JoinDocuments when join_mode is reciprocal rank fusion.
  • Optimize documents upsert in PineconeDocumentStore (write_documents) by enabling asynchronous requests.
  • Add model_kwargs argument to SentenceTransformersRanker to be able to pass through HF transformers loading options
  • Use batching in the predict method since multiple documents are usually passed at inference time. Allow the model to be loaded in torch.float16 by adding pipeline_kwargs to the init method
  • Correctly calculate the max token limit for gpt-3.5-turbo-1106

🐛 Bug Fixes

  • Correctly calculate the answer page number for Extractive Answers
  • Fixed a bug that caused the EmbeddingRetriever to return no documents when used with a MongoDBAtlasDocumentStore. MongoDBAtlasDocumentStore now accepts a vector_search_index parameter, which needs to be created before in the MongoDB Atlas Web UI following their documentation.

v1.24.0-rc1

24 Jan 17:17
0c0d538
Compare
Choose a tag to compare
v1.24.0-rc1 Pre-release
Pre-release

v1.24.0-rc1

v2.0.0-beta.5

17 Jan 16:30
d1bdb8c
Compare
Choose a tag to compare
v2.0.0-beta.5 Pre-release
Pre-release

Release Notes

v2.0.0-beta.5

⬆️ Upgrade Notes

  • 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 (Optional[ComponentDevice]):

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.

🚀 New Features

  • 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() 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.

⚡️ Enhancement Notes

  • Add a field called default_value to the InputSocket dataclass. Deriveis_mandatory value from the presence of default_value.
  • Added split_by "page" to DocumentSplitter, which will split the document at "\f"
  • Modify the output type of CacheChecker from List[Any] to Listto make it possible to connect it in a Pipeline.
  • Highlight optional connections in thePipeline.draw() output.
  • Improve the URLCacheChecker so that it can work with any type of data in the DocumentStore, not just URL caching. Rename the component to CacheChecker.
  • Prevent the 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.
  • Create a new package called joiners and move DocumentJoiner there for clarity.
  • Stop exposing in_memory package symbols in the haystack.document_store and <shaystack.components.retrievers root namespaces.
  • Add example script about how to use Multiplexer to route meta to file converters.
  • Adds support for single metadata dictionary input in 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.

🐛 Bug Fixes

  • Fix ComponentMeta ignoring keyword-only parameters in the 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.
  • Fixes the error descriptor '__dict__' for 'ComponentClassX' objects doesn't apply to a 'ComponentClassX' object when calling dir() on a component instance. This fix should allow auto-completion in code editors.
  • Prevent InMemoryBM25Retriever from returning documents with a score of 0.0.
  • Fix pytest breaking in VSCode due to a name collision in the RAG pipeline tests.
  • Correctly handle the serialization and deserialization of torch.dtype. This concerns the following components: ExtractiveReader, HuggingFaceLocalGenerator, and TransformersSimilarityRanker.

v2.0.0-beta.4

08 Jan 11:30
ae96c2e
Compare
Choose a tag to compare
v2.0.0-beta.4 Pre-release
Pre-release

Release Notes

v2.0.0-beta.4

⬆️ Upgrade Notes

  • If you have a LocalWhisperTranscriber in a pipeline, change the audio_files input name to sources. Similarly for standalone invocation of the component, pass sources instead of audio_files to the run() method.

🚀 New Features

  • Add HuggingFace TEI Embedders - HuggingFaceTEITextEmbedder and HuggingFaceTEIDocumentEmbedder.

    An example using HuggingFaceTEITextEmbedder 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 HuggingFaceTEIDocumentEmbedder 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 Multiplexer. For an example of its usage, see #6420.

  • Adds support for single metadata dictionary input in TextFileToDocument`.

⚡️ Enhancement Notes

  • Add support for ByteStream to LocalWhisperTranscriber and uniform the input socket names to the other components in Haystack.
  • Rename metadata to meta. Rename metadata_fields_to_embed to meta_fields_to_embed in all Embedders. Rename metadata_field to meta_field in MetaFieldRanker.
  • Rename all metadata references to meta.
  • Change DocumentWriter default policy from DuplicatePolicy.FAIL to DuplicatePolicy.NONE. The DocumentStore protocol uses the same default so that different Document Stores can choose the default policy that better fit.
  • Move serialize_type and deserialize_type in the utils module.
  • The HTMLToDocument converter now allows choosing the boilerpy3 extractor to extract the content from the HTML document. The default extractor has been changed to DefaultExtractor, which is better for generic use cases than the previous default (ArticleExtractor).
  • Adds scale_score, which allows users to toggle if they would like their document scores to be raw logits or scaled between 0 and 1 (using the sigmoid function). This is a feature that already existed in Haystack v1 that is being moved over. Adds calibration_factor. This follows the example from the ExtractiveReader which allows the user to better control the spread of scores when scaling the score using sigmoid. Adds score_threshold. Also copied from the ExtractiveReader. This optionally allows users to set a score threshold where only documents with a score above this threshold are returned.
  • Add RAG self correction loop example
  • Adds support for single metadata dictionary input in HTMLToDocument.
  • Adds support for single metadata dictionary input in PyPDFToDocument.
  • Split DynamicPromptBuilder into DynamicPromptBuilder and DynamicChatPromptBuilder
  • Depend on our own rank_bm25 fork.
  • Add meta_fields_to_embed following the implementation in SentenceTransformersDocumentEmbedder to be able to embed meta fields along with the content of the document.
  • Add new variable model_kwargs to the TransformersSimilarityRanker so we can pass different loading options supported by HuggingFace. Add device availability checking if the user passes in None to the device init param. Ranking goes, GPU, MPS, CPU.
  • Update OpenAIChatGenerator to handle both tools and functions calling. OpenAIChatGenerator now supports both tools and functions generation_kwargs parameters that enable function/tools invocation.
  • Upgrade to OpenAI client version 1.x

⚠️ Deprecation Notes

  • Deprecate GPTGenerator and GPTChatGenerator. Replace them with OpenAIGenerator and OpenAIChatGenerator.

🐛 Bug Fixes

  • Fix Pipeline.connect() so it connects sockets with same name if multiple sockets with compatible types are found.