Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

QdrantHybridRetriever

Retrieves documents from a QdrantDocumentStore using both dense and sparse vectors, fusing results with Reciprocal Rank Fusion.

Key Features

  • Hybrid retrieval combining dense and sparse vector search.
  • Reciprocal Rank Fusion (RRF) for merging dense and sparse results.
  • Optional document grouping by payload fields.
  • Score threshold filtering to limit returned results.
  • Optional return of document embeddings alongside content.

Configuration

  1. Drag the QdrantHybridRetriever component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. On the General tab:
    1. Configure the document_store with your Qdrant connection details. Make sure the document store has use_sparse_embeddings enabled.
  4. Go to the Advanced tab to configure top_k, filters, return_embedding, and scale_score.

Connections

QdrantHybridRetriever accepts both a dense query_embedding and a sparse query_sparse_embedding as inputs. It outputs a list of retrieved documents.

Connect a text embedder to query_embedding and a sparse text embedder to query_sparse_embedding. Connect the documents output to a PromptBuilder, Ranker, or answer builder.

Usage Example

components:
QdrantHybridRetriever:
type: qdrant.src.haystack_integrations.components.retrievers.qdrant.retriever.QdrantHybridRetriever
init_parameters:

Parameters

Inputs

ParameterTypeDefaultDescription
query_embeddingList[float]Dense embedding of the query.
query_sparse_embeddingSparseEmbeddingSparse embedding of the query.
filtersOptional[Union[Dict[str, Any], models.Filter]]NoneFilters applied to the retrieved Documents. The way runtime filters are applied depends on the filter_policy chosen at retriever initialization. See init method docstring for more details.
top_kOptional[int]NoneThe maximum number of documents to return. If using group_by parameters, maximum number of groups to return.
return_embeddingOptional[bool]NoneWhether to return the embedding of the retrieved Documents.
score_thresholdOptional[float]NoneA minimal score threshold for the result. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.
group_byOptional[str]NonePayload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.
group_sizeOptional[int]NoneMaximum amount of points to return per group. Default is 3.

Outputs

ParameterTypeDefaultDescription
documentsList[Document]The retrieved documents.

Init Parameters

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
document_storeQdrantDocumentStoreAn instance of QdrantDocumentStore.
filtersOptional[Union[Dict[str, Any], models.Filter]]NoneA dictionary with filters to narrow down the search space.
top_kint10The maximum number of documents to retrieve. If using group_by parameters, maximum number of groups to return.
return_embeddingboolFalseWhether to return the embeddings of the retrieved Documents.
filter_policyUnion[str, FilterPolicy]FilterPolicy.REPLACEPolicy to determine how filters are applied.
score_thresholdOptional[float]NoneA minimal score threshold for the result. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.
group_byOptional[str]NonePayload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.
group_sizeOptional[int]NoneMaximum amount of points to return per group. Default is 3.

Run Method Parameters

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
query_embeddingList[float]Dense embedding of the query.
query_sparse_embeddingSparseEmbeddingSparse embedding of the query.
filtersOptional[Union[Dict[str, Any], models.Filter]]NoneFilters applied to the retrieved Documents. The way runtime filters are applied depends on the filter_policy chosen at retriever initialization. See init method docstring for more details.
top_kOptional[int]NoneThe maximum number of documents to return. If using group_by parameters, maximum number of groups to return.
return_embeddingOptional[bool]NoneWhether to return the embedding of the retrieved Documents.
score_thresholdOptional[float]NoneA minimal score threshold for the result. Score of the returned result might be higher or smaller than the threshold depending on the Distance function used. E.g. for cosine similarity only higher scores will be returned.
group_byOptional[str]NonePayload field to group by, must be a string or number field. If the field contains more than 1 value, all values will be used for grouping. One point can be in multiple groups.
group_sizeOptional[int]NoneMaximum amount of points to return per group. Default is 3.