Skip to content

Conversation

@OscarPindaro
Copy link

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
Copy link

CLAassistant commented Oct 19, 2025

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
Copy link
Collaborator

Pull Request Test Coverage Report for Build 18635856245

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

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.218%

Totals Coverage Status
Change from base Build 18597051353: 0.02%
Covered Lines: 13378
Relevant Lines: 14507

💛 - Coveralls

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

3 participants