haive.core.engine.retriever.providers.BedrockRetrieverConfig¶

Amazon Bedrock Retriever implementation for the Haive framework.

from typing import Any This module provides a configuration class for the Amazon Bedrock retriever, which uses AWS Bedrock’s foundation models for retrieval tasks. Bedrock provides access to foundation models from various providers (Anthropic, AI21, etc.) and can be used for retrieval-augmented generation workflows.

The BedrockRetriever works by: 1. Connecting to Amazon Bedrock service 2. Using foundation models for embedding generation 3. Performing semantic search using model-generated embeddings 4. Supporting various foundation model providers

This retriever is particularly useful when: - Building RAG applications with AWS Bedrock - Need access to multiple foundation model providers - Want managed AI model infrastructure - Building enterprise applications on AWS - Need consistent API across different model providers

The implementation integrates with LangChain’s BedrockRetriever while providing a consistent Haive configuration interface with secure AWS credential management.

Classes¶

BedrockRetrieverConfig

Configuration for Amazon Bedrock retriever in the Haive framework.

Module Contents¶

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

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

Configuration for Amazon Bedrock retriever in the Haive framework.

This retriever uses AWS Bedrock foundation models for embedding generation and retrieval tasks within RAG workflows.

retriever_type¶

The type of retriever (always BEDROCK).

Type:

RetrieverType

vectorstore_config¶

Vector store for document storage.

Type:

VectorStoreConfig

model_id¶

Bedrock foundation model ID for embeddings.

Type:

str

region_name¶

AWS region name.

Type:

str

api_key¶

AWS access key (auto-resolved from AWS_ACCESS_KEY_ID).

Type:

Optional[SecretStr]

secret_key¶

AWS secret key (auto-resolved from AWS_SECRET_ACCESS_KEY).

Type:

Optional[SecretStr]

k¶

Number of documents to retrieve.

Type:

int

Examples

>>> from haive.core.engine.retriever import BedrockRetrieverConfig
>>> from haive.core.engine.vectorstore.providers.FAISSVectorStoreConfig import FAISSVectorStoreConfig
>>>
>>> # Configure vector store
>>> vectorstore_config = FAISSVectorStoreConfig(
...     name="bedrock_faiss_store",
...     index_name="bedrock_index"
... )
>>>
>>> # Create the Bedrock retriever config
>>> config = BedrockRetrieverConfig(
...     name="bedrock_retriever",
...     vectorstore_config=vectorstore_config,
...     model_id="amazon.titan-embed-text-v1",
...     region_name="us-east-1",
...     k=10
... )
>>>
>>> # Instantiate and use the retriever
>>> retriever = config.instantiate()
>>> docs = retriever.get_relevant_documents("cloud computing best practices")
>>>
>>> # Example with different embedding model
>>> anthropic_config = BedrockRetrieverConfig(
...     name="anthropic_bedrock_retriever",
...     vectorstore_config=vectorstore_config,
...     model_id="anthropic.claude-instant-v1",
...     region_name="us-west-2"
... )
get_input_fields()[source]¶

Return input field definitions for Bedrock retriever.

Return type:

dict[str, tuple[type, Any]]

get_output_fields()[source]¶

Return output field definitions for Bedrock retriever.

Return type:

dict[str, tuple[type, Any]]

instantiate()[source]¶

Create an Amazon Bedrock retriever from this configuration.

Returns:

Instantiated retriever ready for foundation model-powered search.

Return type:

BedrockRetriever

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

  • ValueError – If AWS credentials or configuration is invalid.