haive.core.engine.retriever.providers.QdrantSparseVectorRetrieverConfig¶

Qdrant Sparse Vector Retriever implementation for the Haive framework.

from typing import Any This module provides a configuration class for the Qdrant Sparse Vector retriever, which uses Qdrant’s sparse vector capabilities for keyword-based and hybrid search. Qdrant supports both dense and sparse vectors, enabling efficient text search using sparse embeddings like BM25 or TF-IDF representations.

The QdrantSparseVectorRetriever works by: 1. Connecting to a Qdrant instance 2. Using sparse vector representations for text search 3. Supporting efficient keyword matching and retrieval 4. Enabling hybrid dense + sparse vector search

This retriever is particularly useful when: - Need efficient keyword-based search with Qdrant - Want to combine dense and sparse vector search - Building hybrid retrieval systems - Using Qdrant for production vector search - Need high-performance text matching

The implementation integrates with LangChain’s QdrantSparseVectorRetriever while providing a consistent Haive configuration interface with secure API key management.

Classes¶

QdrantSparseVectorRetrieverConfig

Configuration for Qdrant Sparse Vector retriever in the Haive framework.

Module Contents¶

class haive.core.engine.retriever.providers.QdrantSparseVectorRetrieverConfig.QdrantSparseVectorRetrieverConfig[source]¶

Bases: haive.core.common.mixins.secure_config.SecureConfigMixin, haive.core.engine.retriever.retriever.BaseRetrieverConfig

Configuration for Qdrant Sparse Vector retriever in the Haive framework.

This retriever uses Qdrant’s sparse vector capabilities to provide efficient keyword-based search and hybrid dense + sparse vector retrieval.

retriever_type¶

The type of retriever (always QDRANT_SPARSE_VECTOR).

Type:

RetrieverType

qdrant_url¶

Qdrant instance URL.

Type:

str

collection_name¶

Name of the Qdrant collection.

Type:

str

api_key¶

Qdrant API key (auto-resolved from QDRANT_API_KEY).

Type:

Optional[SecretStr]

k¶

Number of documents to retrieve.

Type:

int

sparse_vector_name¶

Name of the sparse vector field.

Type:

str

Whether to combine with dense vectors.

Type:

bool

Examples

>>> from haive.core.engine.retriever import QdrantSparseVectorRetrieverConfig
>>>
>>> # Create the Qdrant sparse vector retriever config
>>> config = QdrantSparseVectorRetrieverConfig(
...     name="qdrant_sparse_retriever",
...     qdrant_url="https://my-cluster.qdrant.tech",
...     collection_name="documents",
...     k=10,
...     sparse_vector_name="sparse_text",
...     enable_hybrid_search=False
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("machine learning algorithms")
>>>
>>> # Example with hybrid search
>>> hybrid_config = QdrantSparseVectorRetrieverConfig(
...     name="qdrant_hybrid_retriever",
...     qdrant_url="https://my-cluster.qdrant.tech",
...     collection_name="documents",
...     enable_hybrid_search=True,
...     hybrid_fusion_method="rrf"
... )
get_input_fields()[source]¶

Return input field definitions for Qdrant Sparse Vector retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for Qdrant Sparse Vector retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]¶

Create a Qdrant Sparse Vector retriever from this configuration.

Returns:

Instantiated retriever ready for sparse vector search.

Return type:

QdrantSparseVectorRetriever

Raises:
  • ImportError – If required packages are not available.

  • ValueError – If API key or configuration is invalid.