agents.rag.hyde.enhanced_agent¶
Enhanced HyDE RAG Agent using Structured Output Pattern.
from typing import Any, Dict This demonstrates the new pattern where any agent can be enhanced with structured output by appending a SimpleAgent. This approach is more modular and follows the principle of separation of concerns.
Classes¶
Enhanced HyDE RAG Agent using the structured output enhancement pattern. |
|
Enhanced retriever that handles both enhancement pattern and traditional outputs. |
Functions¶
|
Perform adaptive retrieval on documents. |
Build custom graph for enhanced HyDE workflows. |
|
|
Create an Enhanced HyDE RAG agent. |
Stub function for create_hyde_enhancer. |
|
Demonstrate the difference between enhancement and traditional patterns. |
Module Contents¶
- class agents.rag.hyde.enhanced_agent.EnhancedHyDERAGAgent¶
Bases:
haive.agents.multi.enhanced_sequential_agent.SequentialAgent
Enhanced HyDE RAG Agent using the structured output enhancement pattern.
This agent demonstrates the new modular approach where: 1. Base agents handle core functionality (generation, retrieval) 2. Enhancement agents add structured output processing 3. The pattern is reusable across different RAG types
Benefits: - Separation of concerns between generation and structure - Reusable enhancement pattern - Easier testing and debugging - Better maintainability
- classmethod from_documents(documents, llm_config=None, embedding_model=None, use_enhancement_pattern=True, **kwargs)¶
Create Enhanced HyDE RAG from documents.
- Parameters:
documents (list[langchain_core.documents.Document]) – Documents to index
llm_config (haive.core.models.llm.base.LLMConfig | None) – Optional LLM configuration
embedding_model (str | None) – Optional embedding model for vector store
use_enhancement_pattern (bool) – Whether to use the new enhancement pattern
**kwargs – Additional arguments
- Returns:
EnhancedHyDERAGAgent instance
- class agents.rag.hyde.enhanced_agent.EnhancedHyDERetriever(documents, embedding_model=None, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Enhanced retriever that handles both enhancement pattern and traditional outputs.
Init .
- Parameters:
- build_graph()¶
Build graph that adapts to both enhancement and traditional patterns.
- Return type:
Any
- agents.rag.hyde.enhanced_agent.adaptive_retrieval(query, documents)¶
Perform adaptive retrieval on documents.
- agents.rag.hyde.enhanced_agent.build_graph()¶
Build custom graph for enhanced HyDE workflows.
- Return type:
Any
- agents.rag.hyde.enhanced_agent.create_enhanced_hyde_agent(documents, llm_config=None, use_enhancement_pattern=True, **kwargs)¶
Create an Enhanced HyDE RAG agent.
- Parameters:
- Returns:
Configured Enhanced HyDE RAG agent
- Return type:
- agents.rag.hyde.enhanced_agent.create_hyde_enhancer()¶
Stub function for create_hyde_enhancer.