fix: adapt optimum, ragas, elasticsearch, opensearch to APIs removed in Haystack 3.0#3538
Merged
Conversation
- optimum: vendor HFModelType and check_valid_model, removed from haystack.utils.hf in 3.0; the package previously failed to import. - ragas tests: alias AsyncPipeline to Pipeline when the import fails; 3.0 merged async execution into Pipeline (run_async). - elasticsearch/opensearch tests: the hybrid-retriever serde tests used SentenceTransformersTextEmbedder, which 3.0 removed from core. Use OpenAITextEmbedder (available in both versions) and build the expected embedder dict with to_dict() at runtime, which also removes the device/revision compat shims the hard-coded dicts had accumulated. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Contributor
Contributor
Contributor
Coverage report (optimum)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
bogdankostic
reviewed
Jul 3, 2026
bogdankostic
left a comment
Contributor
There was a problem hiding this comment.
Looks good in general, just some minor comments.
…dders/optimum/_backend.py Co-authored-by: bogdankostic <bogdankostic@web.de>
- optimum: the vendored check_valid_model only needs the embedding branch, so drop the HFModelType enum and validate embedding models directly. - elasticsearch/opensearch hybrid retriever tests: pin the expected OpenAITextEmbedder dict instead of building it from to_dict(), which made the comparison a tautology; its serialization format is identical on haystack-ai 2.x and 3.x. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
bogdankostic
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issues
Haystack 3.0 removes several APIs some of our integrations relied on.
Proposed Changes:
HFModelTypeandcheck_valid_modelwere removed fromhaystack.utils.hf, so the package failed to import at all under 3.0 (mypy errors plus collection errors in every embedder test module). Both are now vendored into_backend.pyverbatim — they are small, HF-specific helpers, and vendoring keeps behavior identical on both versions with no conditional imports. The existing tests keep patching_backend.check_valid_modelunchanged.AsyncPipelineno longer exists at thehaystacktop level; 3.0 merged async execution intoPipeline(run_async). The test module now falls back toAsyncPipeline = PipelineonImportError.SentenceTransformersTextEmbedder, which 3.0 removed from core. They now useOpenAITextEmbedder(in core on both versions) and build the expected embedder sub-dict withembedder.to_dict()at runtime instead of hard-coding it — which also removes thedevice/revisioncompat shims those hard-coded dicts had accumulated. An autouse fixture sets a fakeOPENAI_API_KEY, since haystack-ai 2.x resolves the key eagerly at init.How did you test it?
git+https://github.com/deepset-ai/haystack.git@v3into the test envs): mypy is clean and unit tests passNotes for the reviewer
If we prefer not to vendor
check_valid_modelinto optimum, then the alternative is dropping Hub-side model validation entirely and letting the model load fail naturally. The advantage of vendoring is that it preserves today's error messages for users.The
SentenceTransformers*mentions remaining in elasticsearch/opensearch src are docstring usage examples only (no runtime imports); updating those examples for the 3.0 component locations is a docs follow-up.Checklist
fix:,feat:,build:,chore:,ci:,docs:,style:,refactor:,perf:,test:.🤖 Generated with Claude Code