Skip to content

feat: add run async filter and automerging retriever#9897

Merged
davidsbatista merged 12 commits into
deepset-ai:mainfrom
OscarPindaro:feat/add-run-async-filter-and-automerging-retriever
Dec 3, 2025
Merged

feat: add run async filter and automerging retriever#9897
davidsbatista merged 12 commits into
deepset-ai:mainfrom
OscarPindaro:feat/add-run-async-filter-and-automerging-retriever

Conversation

@OscarPindaro

Copy link
Copy Markdown
Contributor

Related Issues

Proposed Changes:

Now FilterRetriever and AutoMergingRetriever both support the async method run_async.
The code in run_async is copied from the run method, except for the calls to the document store and async helper functions that have been marked and called accordingly with the async/await keywords.

How did you test it?

For each retriever, I created a copy of the original tests adding the suffix _async at the end of the filename.
I kept the fixtures from the original file, so there is some duplication.
I kept only the tests regarding the run method, ignoring the initialization tests (since they are not affected by this PR).
FilterRetriever had an integration test, so I wrote the equivalent async one.
AutoMergingRetriever does not have any integration tests.

Notes for the reviewer

run and run_async share a lot of code, but I was cautious because I don't know if you expect me to refactor shared logic into separate functions to avoid the duplication. If that's the case, I'm happy to do that.

Unfortunately, the type checking is failing since the general DocumentStore class does not support the async filtering method. The tests are passing because they are using InMemoryDocumentStore, which actually has that method.

> hatch run test:types
haystack/components/retrievers/filter_retriever.py:107: error: "DocumentStore" has no attribute "filter_documents_async"; maybe "filter_documents"?  [attr-defined]
haystack/components/retrievers/auto_merging_retriever.py:187: error: "DocumentStore" has no attribute "filter_documents_async"; maybe "filter_documents"?  [attr-defined]
Found 2 errors in 2 files (checked 257 source files) 

Checklist

  • I have read the contributors guidelines and the code of conduct
  • I have updated the related issue with new insights and changes
  • I added unit tests and updated the docstrings
  • I've used one of the conventional commit types for my PR title: fix:, feat:, build:, chore:, ci:, docs:, style:, refactor:, perf:, test: and added ! in case the PR includes breaking changes
  • I documented my code
  • I ran pre-commit hooks and fixed any issues

@OscarPindaro OscarPindaro requested a review from a team as a code owner October 19, 2025 20:43
@OscarPindaro OscarPindaro requested review from Amnah199 and removed request for a team October 19, 2025 20:43
@CLAassistant

CLAassistant commented Oct 19, 2025

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added topic:tests type:documentation Improvements on the docs labels Oct 19, 2025
@coveralls

coveralls commented Oct 20, 2025

Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 19898331435

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.02%) to 92.199%

Totals Coverage Status
Change from base Build 19897788268: 0.02%
Covered Lines: 14076
Relevant Lines: 15267

💛 - Coveralls

@vercel

vercel Bot commented Nov 14, 2025

Copy link
Copy Markdown

@Amnah199 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@Amnah199 Amnah199 requested review from davidsbatista and removed request for Amnah199 December 3, 2025 11:58

@davidsbatista davidsbatista left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@davidsbatista

Copy link
Copy Markdown
Contributor

@OscarPindaro, thanks for your contribution - I did some adjustments, mainly because of type checking and some tests. Thanks once again 👍🏽

@davidsbatista davidsbatista merged commit bad2937 into deepset-ai:main Dec 3, 2025
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic:tests type:documentation Improvements on the docs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add run_async method to FilterRetriever and AutoMergingRetriever

5 participants