feat(elasticsearch): add ElasticsearchInferenceDenseRetriever#3525
Open
chakshu-dhannawat wants to merge 1 commit into
Open
feat(elasticsearch): add ElasticsearchInferenceDenseRetriever#3525chakshu-dhannawat wants to merge 1 commit into
chakshu-dhannawat wants to merge 1 commit into
Conversation
Closes deepset-ai#2945. Adds server-side dense retrieval via Elasticsearch's inference API (`knn.query_vector_builder.text_embedding`). No local embedding model is needed — Elasticsearch generates the query vector from the inference endpoint at search time. - `ElasticsearchDocumentStore._create_dense_retrieval_inference_body`: builds the kNN body with `query_vector_builder` instead of `query_vector`, supporting optional filters and `num_candidates` - `_dense_retrieval_inference` / `_dense_retrieval_inference_async`: sync and async wrappers that call `_search_documents` - `ElasticsearchInferenceDenseRetriever`: new `@component` with `run()` / `run_async()`, full `to_dict` / `from_dict` serialization, and `FilterPolicy` support - `tests/test_cloud_dense_retriever.py`: unit tests (init, serde, run, filter policies, body shape, edge cases) + integration test class skipped without credentials
Contributor
Coverage report (elasticsearch)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||||||||||||||
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.
Closes #2945.
Summary
Adds server-side dense retrieval via Elasticsearch's inference API — no local embedding model required. The query vector is generated by an Elasticsearch inference endpoint at search time using
knn.query_vector_builder.text_embedding.This completes the inference retriever family alongside the existing
ElasticsearchInferenceSparseRetrieverandElasticsearchInferenceHybridRetriever.Changes
ElasticsearchDocumentStore— three new methods:_create_dense_retrieval_inference_body: builds the kNN search body withquery_vector_builder(instead of a pre-computedquery_vector), with optional filters andnum_candidates_dense_retrieval_inference: sync retrieval_dense_retrieval_inference_async: async retrievalElasticsearchInferenceDenseRetriever— new@component:__init__:document_store,inference_id,filters,top_k,num_candidates,filter_policyrun/run_async: sync and async retrievalto_dict/from_dict: full serialization supporthaystack_integrations.components.retrievers.elasticsearchtests/test_cloud_dense_retriever.py:run/run_async, filter policies, body shape (query_vector_builderpresent,query_vectorabsent), edge cases@pytest.mark.integration) — skipped unlessELASTICSEARCH_URL,ELASTIC_API_KEY, andELASTICSEARCH_DENSE_INFERENCE_IDare setUsage