haive.core.engine.retriever.providers.LlamaIndexGraphRetrieverConfig¶
LlamaIndex Graph Retriever implementation for the Haive framework.
This module provides a configuration class for the LlamaIndex Graph retriever, which performs graph-based retrieval using knowledge graphs and graph databases like Neo4j, providing semantic relationships and graph traversal capabilities.
The LlamaIndexGraphRetriever works by: 1. Using a graph index (knowledge graph, Neo4j, etc.) as the underlying storage 2. Performing graph traversal queries to find related nodes and relationships 3. Converting graph nodes and edges into retrievable documents 4. Supporting both entity-based and relationship-based retrieval
This retriever is particularly useful when: - Working with knowledge graphs and structured data - Need to understand relationships between entities - Building systems that require graph traversal and exploration - Integrating with Neo4j or other graph databases - Performing semantic retrieval over connected data
The implementation integrates with LangChain Community’s LlamaIndexGraphRetriever while providing a consistent Haive configuration interface with graph database support.
Classes¶
Configuration for LlamaIndex Graph retriever in the Haive framework. |
Module Contents¶
- class haive.core.engine.retriever.providers.LlamaIndexGraphRetrieverConfig.LlamaIndexGraphRetrieverConfig[source]¶
Bases:
haive.core.common.mixins.secure_config.SecureConfigMixin
,haive.core.engine.retriever.retriever.BaseRetrieverConfig
Configuration for LlamaIndex Graph retriever in the Haive framework.
This retriever performs graph-based retrieval using knowledge graphs and graph databases, providing semantic relationships and graph traversal capabilities.
- retriever_type¶
The type of retriever (always LLAMA_INDEX_GRAPH).
- Type:
- api_key¶
API key for graph services (auto-resolved).
- Type:
Optional[SecretStr]
Examples
>>> from haive.core.engine.retriever import LlamaIndexGraphRetrieverConfig >>> >>> # Create Neo4j graph retriever >>> config = LlamaIndexGraphRetrieverConfig( ... name="neo4j_graph_retriever", ... graph_type="neo4j", ... connection_url="bolt://localhost:7687", ... database_name="knowledge", ... query_type="relationship", ... max_depth=3, ... k=10 ... ) >>> >>> # Create knowledge graph retriever >>> config = LlamaIndexGraphRetrieverConfig( ... name="knowledge_graph_retriever", ... graph_type="knowledge_graph", ... query_type="subgraph", ... max_depth=2, ... k=5 ... ) >>> >>> # Instantiate and use the retriever >>> retriever = config.instantiate() >>> docs = retriever.get_relevant_documents("artificial intelligence concepts")
- instantiate()[source]¶
Create a LlamaIndex Graph retriever from this configuration.
- Returns:
Instantiated retriever ready for graph-based retrieval.
- Return type:
LlamaIndexGraphRetriever
- Raises:
ImportError – If required packages are not available.
ValueError – If configuration is invalid.