14 Commits

Author SHA1 Message Date
David S. Batista 1661601112 fix: pagination error too many values to unpack (#11475)
Co-authored-by: devteamaegis <devteam.aegis@gmail.com>
Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
2026-06-02 09:42:23 +00:00
Sebastian Husch Lee 744198ce52 feat: Add reciprocal rank fusion to MultiRetriever (#11220) 2026-04-30 13:33:05 +02:00
David S. Batista c570f8a8d5 feat: adding _normalize_metadata_field_name to haystack.utils (#10798)
* initial import

* adding tests
2026-03-12 14:59:31 +01:00
Amanpreet Singh d133829af6 refactor: JSON parsing utility function (#10597)
* Standardize JSON parsing in QueryExpander, LLMEvaluator, and LLMMetadataExtractor

- Introduce haystack.utils.json_utils with extract_json_from_text and parse_json_from_text.
- Expose these utilities in haystack.utils for cleaner imports.
- Refactor QueryExpander, LLMEvaluator, and LLMMetadataExtractor to use parse_json_from_text.
- Standardize error handling and logging for JSON parsing failures.
- Update unit tests to reflect these changes.

* Address CodeRabbit feedback: Handle generic code blocks and remove unused logger

* Fix corrupted test file and add priority test case for json extraction

* formatted files for removing formatting issues

* Fix import sorting in json_utils.py and test_json_utils.py

* Add release note for JSON parsing standardization

* Fix release note formatting: use double backticks for inline code

* Address code review: rename parse_json_from_text to internal _parse_json_from_text, simplify error handling

* removed releasenotes

* Address Code Review Feedback: merged extract to parse_json_to_test

* Address Code Review Feedback: remove markdown support from internal json utility

* Address Code Review Feedback: add raise_on_failure to json utility

* Address CodeRabbit Feedback: add tests for raise_on_failure=False

* Address Formatting Issues: add missing license header

* Address Formatting Issues: use haystack logger and mock in tests

* Address Formatting Issues: fix logging format to use kwargs

* refinements

* fix type

* fixes

* more fixes

---------

Co-authored-by: anakin87 <stefanofiorucci@gmail.com>
2026-02-18 10:52:53 +01:00
Sebastian Husch Lee d68f444667 feat!: deduplicate documents based on ID in MultiQuery components (#10496)
* refactoring

* Updates

* Remove unnecessary line

* add reno
2026-02-06 12:03:39 +01:00
bogdankostic 8538744466 feat!: Deduplicate Documents in Rankers (#10508)
* Deduplicate Documents in Rankers

* Add unit tests

* Deduplicate Documents in run_async in HuggingFaceTEIRanker

* Add release note

* Use only one loop in  _deduplicate_documents

* Avoid changing input variable in place

* Deduplicate Documents in MetafieldRanker when weight is set to 0

* Adapt doc strings

* Adapt release note

* Apply suggestion from @julian-risch

Co-authored-by: Julian Risch <julian.risch@deepset.ai>

---------

Co-authored-by: Julian Risch <julian.risch@deepset.ai>
2026-02-05 16:24:10 +01:00
Stefano Fiorucci 7c6323b960 refactor: support PEP604 typing syntax (X|Y and X|None) (#10255)
* adopt X|Y syntax: draft

* cast Union

* fix pylint + state testing

* use X|Y

* rm unused imports

* trigger e2e tests

* fix + simplification

* add compatibility tests

* rm e2e tests trigger

* fix

* add relnote

* simplify/fix pep604 union parsing

* fix comments

* test _is_optional_type

* introduce _build_pep604_union_type; make _is_union_type private

* try removing problematic test
2025-12-19 15:47:51 +01:00
David S. Batista 6c7ae8f658 feat: pipeline checkpoints crash allow to resume from snapshot (#9743)
* initial PoC idea running

* removing test code

* cleaning up

* wip

* cleaning up demos

* adding more pipelines to test persistence saving

* wip

* wip

* working example for logging components inputs in run time

* reverting to a simpler solution for intermediate results

* cleaning up

* testing that in a crash components outputs/inputs up to the crash point are returned

* adding tests for state persistance in a RAG pipeline

* updataing tests for state persistance in a RAG pipeline

* removing use cases of agent tests

* adding LICENSE header

* adding LICENSE header

* adding release notes

* updating tests for mocked components only

* updating release notes

* adapting PipelineRuntimeError

* cleaning up tests

* fixing test pipeline crash components inputs/outputs are saved

* fixing tests for state persistance

* removing code

* removing code

* removing code

* updating release notes

* validating parameters

* cleaning

* wip: debugging

* removing persistance tests

* formatting

* formatting

* cleaning up code

* updating release notes

* adding missing docstrings

* typo in release notes

* Update haystack/core/pipeline/pipeline.py

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>

* PR comments

* handling potential issues with saving the snapshot file

* updating tests

* Update haystack/core/pipeline/pipeline.py

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>

* Update haystack/core/pipeline/pipeline.py

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>

* some more improvements

* fixing exxception

* fixing exception error name conflict

---------

Co-authored-by: Sebastian Husch Lee <10526848+sjrl@users.noreply.github.com>
2025-09-01 11:22:37 +02:00
Abdelrahman Kaseb 5f3c37d287 chore: adopt PEP 585 type hints (#9678)
* chore(lint): enforce and apply PEP 585 type hinting

* Run fmt fixes

* Fix all typing imports using some regex

* Fix all typing written in string in tests

* undo changes in the e2e tests

* make e2e test use list instead of List

* type fixes

* remove type:ignore

* pylint

* Remove typing from Usage example comments

* Remove typing from most of comments

* try to fix e2e tests on comm PRs

* fix

* Add tests typing.List in to adjust test compatiplity
- test/components/agents/test_state_class.py
- test/components/converters/test_output_adapter.py
- test/components/joiners/test_list_joiner.py

* simplify pyproject

* improve relnote

---------

Co-authored-by: anakin87 <stefanofiorucci@gmail.com>
2025-08-07 10:23:14 +02:00
Sebastian Husch Lee f801171191 feat: Add DocumentTypeRouter (#9634)
* Add DocumentTypeRouter

* PR comments

* Turn off isort for one line so pylint will pass
2025-07-22 11:08:24 +00:00
Denis Washington eefda0452d chore: Make the Haystack core "type complete" (#9438)
* chore: Make the Haystack core "type complete"

For libraries with a `py.typed` marker, it is [recommended][1] to
make all public interfaces "type complete", i.e. to explicitly
annotate all function parameters and return types. Doing so has the
following benefits:

- It maximizes the type information available to users and IDEs.
- It ensures that the argument and return types are the intended ones.
- It sidesteps differences in type inference between the different
  type checker implementations.

This change makes a first step towards type completeness by enabling
the Mypy `disallow_incomplete_defs` for the core modules (excluding
`haystack.components.*` and `haystack.testing.*`) and fixing the
resulting errors.

[1]: https://typing.python.org/en/latest/guides/libraries.html#how-much-of-my-library-needs-types

* chore: Add `python_version = 3.9` to Mypy config

This catches type constructs that are only supported in later Python
versions.

* Remove unused import

* try to fix linting

---------

Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
2025-05-26 11:00:22 +02:00
Stefano Fiorucci f6fceb1b56 refactor: reorganize Tool serde utility functions (#9185)
* refactor: reorganize Tool serde utility functions

* license header

* rm unused import

* HF local update
2025-04-08 08:09:54 +02:00
Vladimir Blagojevic c81d68402c feat: Add Toolset to tooling architecture (#9161)
* Add Toolset abstraction

* Add reno note

* More pydoc improvements

* Update test

* Simplify, Toolset is a dataclass

* Wrap toolset instance with list

* Add example

* Toolset pydoc serde enhancement

* Toolset as init param

* Fix types

* Linting

* Minor updates

* PR feedback

* Add to pydoc config, minor import fixes

* Improve pydoc example

* Improve coverage for test_toolset.py

* Improve test_toolset.py, test custom toolset serde properly

* Update haystack/utils/misc.py

Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>

* Rework Toolset pydoc

* Another minor pydoc improvement

* Prevent single Tool instantiating Toolset

* Reduce number of integration tests

* Remove some toolset tests from openai

* Rework tests

---------

Co-authored-by: Stefano Fiorucci <stefanofiorucci@gmail.com>
2025-04-04 16:09:46 +02:00
Stefano Fiorucci 9546e69374 perf: Optimize import times (#8878)
* initial experiments

* progress

* draft

* fix header

* fix linting

* lot more lazy inits

* fixes to main init

* linting

* small refinements

* header fix

* release note

* improve consistency

* test: make sure no extra modules are being imported due to `__init__` definitions

* extend release note with an example

* refactoring import test

* updating release notes

* casting .keys() to list

* reverting to list

* Update haystack/__init__.py

Co-authored-by: Julian Risch <julian.risch@deepset.ai>

* fixing ident problem

* better comments

---------

Co-authored-by: David S. Batista <dsbatista@gmail.com>
Co-authored-by: Julian Risch <julian.risch@deepset.ai>
2025-02-21 09:55:20 +01:00