agents.rag.factories.rag_workflow_factory¶
RAG Workflow Factory.
Generic factory for creating RAG workflows by composing callable functions into different agent patterns. This provides a clean, modular approach to building complex RAG systems.
Classes¶
Agent with conditional routing based on callable results. |
|
Generic agent that executes a sequence of callable functions. |
Functions¶
|
Create an adaptive RAG agent with complexity-based routing. |
|
Create a CRAG agent with web search fallback. |
|
Create a HYDE RAG agent with hypothesis generation. |
|
Create a multi-query RAG agent with query variations. |
|
Main factory function for creating RAG workflows. |
|
Create a Self-RAG agent with reflection tokens. |
|
Create a step-back prompting RAG agent. |
Module Contents¶
- class agents.rag.factories.rag_workflow_factory.ConditionalCallableAgent(router_callable, action_callables, name='Conditional Callable Agent', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent with conditional routing based on callable results.
Init .
- Parameters:
router_callable (collections.abc.Callable) – [TODO: Add description]
action_callables (dict[str, collections.abc.Callable]) – [TODO: Add description]
name (str) – [TODO: Add description]
- build_graph()¶
Build graph with conditional routing.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.factories.rag_workflow_factory.GenericCallableAgent(callables, name='Generic Callable Agent', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Generic agent that executes a sequence of callable functions.
Init .
- Parameters:
callables (list[collections.abc.Callable]) – [TODO: Add description]
name (str) – [TODO: Add description]
- build_graph()¶
Build graph with callable sequence.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- agents.rag.factories.rag_workflow_factory.create_adaptive_rag_agent(documents=None, name='Adaptive RAG Agent')¶
Create an adaptive RAG agent with complexity-based routing.
- agents.rag.factories.rag_workflow_factory.create_corrective_rag_agent(documents=None, name='Corrective RAG Agent')¶
Create a CRAG agent with web search fallback.
- agents.rag.factories.rag_workflow_factory.create_hyde_rag_agent(documents=None, name='HYDE RAG Agent')¶
Create a HYDE RAG agent with hypothesis generation.
- agents.rag.factories.rag_workflow_factory.create_multi_query_rag_agent(documents=None, name='Multi-Query RAG Agent')¶
Create a multi-query RAG agent with query variations.
- agents.rag.factories.rag_workflow_factory.create_rag_workflow(workflow_type, documents=None, custom_callables=None, **kwargs)¶
Main factory function for creating RAG workflows.
- Parameters:
workflow_type (str) – Type of RAG workflow to create
documents (list[langchain_core.documents.Document] | None) – Documents for retrieval
custom_callables (dict[str, collections.abc.Callable] | None) – Custom callable functions to override defaults
**kwargs – Additional arguments
- Returns:
Configured RAG agent
- Return type:
haive.agents.base.agent.Agent
- Available workflow types:
‘corrective’ / ‘crag’: Corrective RAG with web search
‘self_rag’: Self-RAG with reflection tokens
‘adaptive’: Adaptive RAG with complexity routing
‘hyde’: HYDE RAG with hypothesis generation
‘step_back’: Step-back prompting RAG
‘multi_query’: Multi-query RAG with variations
‘simple’: Basic sequential RAG
- agents.rag.factories.rag_workflow_factory.create_self_rag_agent(documents=None, name='Self-RAG Agent')¶
Create a Self-RAG agent with reflection tokens.