agents.rag.multi_agent_rag.complete_rag_workflows

Complete RAG Workflows Implementation.

Implements all RAG architectures from rag-architectures-flows.md including: - Corrective RAG with web search fallback - Self-RAG with reflection tokens - Adaptive RAG with complexity routing - Multi-Query RAG and RAG Fusion - HYDE and Step-Back prompting - Hallucination detection and requerying

Classes

AdaptiveRAGAgent

Adaptive RAG with complexity-based routing.

CorrectiveRAGAgent

Full Corrective RAG implementation with web search fallback.

HYDERAGAgent

Enhanced HYDE RAG with hypothesis generation.

RAGQuality

Quality assessment for retrieved documents.

ReflectionToken

Self-RAG reflection tokens.

SelfRAGAgent

Self-RAG with reflection tokens and adaptive retrieval.

Functions

crag_relevance_check(input_data)

CRAG relevance checking with three-way classification.

create_complete_rag_workflow(workflow_type[, documents])

Factory for creating complete RAG workflows.

hallucination_detection(input_data)

Detect hallucination in generated response.

web_search_fallback(input_data)

Web search fallback for when documents are insufficient.

Module Contents

class agents.rag.multi_agent_rag.complete_rag_workflows.AdaptiveRAGAgent(documents=None, **kwargs)

Bases: haive.agents.multi.base.ConditionalAgent

Adaptive RAG with complexity-based routing.

Init .

Parameters:

documents (list[langchain_core.documents.Document] | None) – [TODO: Add description]

class agents.rag.multi_agent_rag.complete_rag_workflows.CorrectiveRAGAgent(documents=None, **kwargs)

Bases: haive.agents.multi.base.ConditionalAgent

Full Corrective RAG implementation with web search fallback.

Init .

Parameters:

documents (list[langchain_core.documents.Document] | None) – [TODO: Add description]

class agents.rag.multi_agent_rag.complete_rag_workflows.HYDERAGAgent(documents=None, **kwargs)

Bases: haive.agents.multi.base.SequentialAgent

Enhanced HYDE RAG with hypothesis generation.

Init .

Parameters:

documents (list[langchain_core.documents.Document] | None) – [TODO: Add description]

class agents.rag.multi_agent_rag.complete_rag_workflows.RAGQuality

Bases: str, enum.Enum

Quality assessment for retrieved documents.

Initialize self. See help(type(self)) for accurate signature.

class agents.rag.multi_agent_rag.complete_rag_workflows.ReflectionToken

Bases: str, enum.Enum

Self-RAG reflection tokens.

Initialize self. See help(type(self)) for accurate signature.

class agents.rag.multi_agent_rag.complete_rag_workflows.SelfRAGAgent(documents=None, **kwargs)

Bases: haive.agents.multi.base.ConditionalAgent

Self-RAG with reflection tokens and adaptive retrieval.

Init .

Parameters:

documents (list[langchain_core.documents.Document] | None) – [TODO: Add description]

agents.rag.multi_agent_rag.complete_rag_workflows.crag_relevance_check(input_data)

CRAG relevance checking with three-way classification.

Parameters:

input_data (dict)

Return type:

dict

agents.rag.multi_agent_rag.complete_rag_workflows.create_complete_rag_workflow(workflow_type, documents=None, **kwargs)

Factory for creating complete RAG workflows.

Available types: - ‘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 - ‘multi_query’: Multi-Query RAG with query variations

Parameters:
  • workflow_type (str)

  • documents (list[langchain_core.documents.Document] | None)

Return type:

haive.agents.base.agent.Agent

agents.rag.multi_agent_rag.complete_rag_workflows.hallucination_detection(input_data)

Detect hallucination in generated response.

Parameters:

input_data (dict)

Return type:

dict

agents.rag.multi_agent_rag.complete_rag_workflows.web_search_fallback(input_data)

Web search fallback for when documents are insufficient.

Parameters:

input_data (dict)

Return type:

dict