haive.core.engine.retriever.providers.MetalRetrieverConfig¶

Metal Retriever implementation for the Haive framework.

from typing import Any This module provides a configuration class for the Metal retriever, which uses Metal’s vector search infrastructure for high-performance similarity search. Metal provides a managed vector database service optimized for production use cases.

The MetalRetriever works by: 1. Connecting to a Metal index 2. Performing vector similarity search 3. Supporting metadata filtering and search 4. Providing production-ready vector infrastructure

This retriever is particularly useful when: - Need managed vector search infrastructure - Building production vector search applications - Want optimized performance and scaling - Need reliable vector database service - Building recommendation or search systems

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

Classes¶

MetalRetrieverConfig

Configuration for Metal retriever in the Haive framework.

Module Contents¶

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

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

Configuration for Metal retriever in the Haive framework.

This retriever uses Metal’s vector search infrastructure to provide high-performance similarity search with managed scaling and reliability.

retriever_type¶

The type of retriever (always METAL).

Type:

RetrieverType

metal_api_key¶

Metal API key (auto-resolved from METAL_API_KEY).

Type:

Optional[SecretStr]

metal_client_id¶

Metal client ID (auto-resolved from METAL_CLIENT_ID).

Type:

Optional[SecretStr]

index_id¶

Metal index ID for the vector collection.

Type:

str

k¶

Number of documents to retrieve.

Type:

int

filters¶

Metadata filters for search results.

Type:

Optional[Dict]

Examples

>>> from haive.core.engine.retriever import MetalRetrieverConfig
>>>
>>> # Create the Metal retriever config
>>> config = MetalRetrieverConfig(
...     name="metal_retriever",
...     index_id="my-metal-index-123",
...     k=10
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("machine learning algorithms")
>>>
>>> # Example with metadata filtering
>>> filtered_config = MetalRetrieverConfig(
...     name="filtered_metal_retriever",
...     index_id="my-metal-index-123",
...     k=5,
...     filters={
...         "category": "technology",
...         "published_year": {"$gte": 2020}
...     }
... )
get_input_fields()[source]¶

Return input field definitions for Metal retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for Metal retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]¶

Create a Metal retriever from this configuration.

Returns:

Instantiated retriever ready for vector search.

Return type:

MetalRetriever

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

  • ValueError – If API key or configuration is invalid.