haive.core.engine.retriever.providers.KendraRetrieverConfig¶
Amazon Kendra Retriever implementation for the Haive framework.
from typing import Any This module provides a configuration class for the Amazon Kendra retriever, which uses AWS Kendra’s intelligent enterprise search service. Kendra provides ML-powered search capabilities with natural language understanding and enterprise document processing.
The KendraRetriever works by: 1. Connecting to an Amazon Kendra index 2. Executing natural language queries 3. Using ML to understand intent and context 4. Returning ranked results with confidence scores
This retriever is particularly useful when: - Building enterprise search applications - Need ML-powered query understanding - Working with diverse document types (PDFs, Word, etc.) - Want confidence scoring and result ranking - Building knowledge management systems
The implementation integrates with LangChain’s AmazonKendraRetriever while providing a consistent Haive configuration interface with secure AWS credential management.
Classes¶
Configuration for Amazon Kendra retriever in the Haive framework. |
Module Contents¶
- class haive.core.engine.retriever.providers.KendraRetrieverConfig.KendraRetrieverConfig[source]¶
Bases:
haive.core.common.mixins.secure_config.SecureConfigMixin
,haive.core.engine.retriever.retriever.BaseRetrieverConfig
Configuration for Amazon Kendra retriever in the Haive framework.
This retriever uses AWS Kendra’s intelligent search service to provide ML-powered enterprise search with natural language understanding.
- retriever_type¶
The type of retriever (always KENDRA).
- Type:
- 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]
- attribute_filter¶
Filters for document attributes.
- Type:
Optional[Dict]
Examples
>>> from haive.core.engine.retriever import KendraRetrieverConfig >>> >>> # Create the Kendra retriever config >>> config = KendraRetrieverConfig( ... name="kendra_retriever", ... index_id="12345678-1234-1234-1234-123456789012", ... region_name="us-east-1", ... top_k=10 ... ) >>> >>> # Instantiate and use the retriever >>> retriever = config.instantiate() >>> docs = retriever.get_relevant_documents("company policy on remote work") >>> >>> # Example with attribute filtering >>> filtered_config = KendraRetrieverConfig( ... name="filtered_kendra_retriever", ... index_id="12345678-1234-1234-1234-123456789012", ... region_name="us-east-1", ... attribute_filter={ ... "AndAllFilters": [ ... {"EqualsTo": {"Key": "Department", "Value": {"StringValue": "HR"}}} ... ] ... } ... )
- instantiate()[source]¶
Create an Amazon Kendra retriever from this configuration.
- Returns:
Instantiated retriever ready for enterprise search.
- Return type:
AmazonKendraRetriever
- Raises:
ImportError – If required packages are not available.
ValueError – If AWS credentials or configuration is invalid.