haive.core.engine.retriever.providers.WeaviateHybridSearchRetrieverConfig¶

from typing import Any. Weaviate Hybrid Search Retriever implementation for the Haive framework.

This module provides a configuration class for the Weaviate Hybrid Search retriever, which combines vector similarity search with keyword search using Weaviate’s hybrid search capabilities. Weaviate is an open-source vector database that supports both vector and keyword search in a single query.

The WeaviateHybridSearchRetriever works by: 1. Connecting to a Weaviate instance 2. Performing both vector and keyword search simultaneously 3. Combining results using Weaviate’s hybrid ranking algorithm 4. Supporting advanced filtering and where clauses

This retriever is particularly useful when: - Need both semantic and keyword search - Want optimized hybrid search performance - Building applications with diverse query types - Using Weaviate as the vector database - Need flexible filtering capabilities

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

Classes¶

WeaviateHybridSearchRetrieverConfig

Configuration for Weaviate Hybrid Search retriever in the Haive framework.

Module Contents¶

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

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

Configuration for Weaviate Hybrid Search retriever in the Haive framework.

This retriever uses Weaviate’s hybrid search capabilities to combine vector similarity search with keyword search for comprehensive retrieval.

retriever_type¶

The type of retriever (always WEAVIATE_HYBRID_SEARCH).

Type:

RetrieverType

weaviate_url¶

Weaviate instance URL.

Type:

str

index_name¶

Name of the Weaviate class/index.

Type:

str

api_key¶

Weaviate API key (auto-resolved from WEAVIATE_API_KEY).

Type:

Optional[SecretStr]

k¶

Number of documents to retrieve.

Type:

int

alpha¶

Balance between vector and keyword search.

Type:

float

where_filter¶

Weaviate where clause for filtering.

Type:

Optional[Dict]

Examples

>>> from haive.core.engine.retriever import WeaviateHybridSearchRetrieverConfig
>>>
>>> # Create the Weaviate hybrid search retriever config
>>> config = WeaviateHybridSearchRetrieverConfig(
...     name="weaviate_hybrid_retriever",
...     weaviate_url="https://my-cluster.weaviate.network",
...     index_name="Document",
...     k=10,
...     alpha=0.5  # Equal weight to vector and keyword search
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("machine learning algorithms")
>>>
>>> # Example with filtering
>>> filtered_config = WeaviateHybridSearchRetrieverConfig(
...     name="filtered_weaviate_hybrid",
...     weaviate_url="https://my-cluster.weaviate.network",
...     index_name="Document",
...     where_filter={
...         "path": ["category"],
...         "operator": "Equal",
...         "valueText": "technology"
...     }
... )
get_input_fields()[source]¶

Return input field definitions for Weaviate Hybrid Search retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for Weaviate Hybrid Search retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]¶

Create a Weaviate Hybrid Search retriever from this configuration.

Returns:

Instantiated retriever ready for hybrid search.

Return type:

WeaviateHybridSearchRetriever

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

  • ValueError – If API key or configuration is invalid.