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¶
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.BaseRetrieverConfigConfiguration 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:
- api_key¶
Qdrant API key (auto-resolved from QDRANT_API_KEY).
- Type:
Optional[SecretStr]
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" ... )
- 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.