agents.rag.speculative.agent¶
Speculative RAG Agents.
from typing import Any Implementation of speculative RAG with parallel hypothesis generation and verification. Uses structured output models for hypothesis planning and iterative refinement.
Classes¶
Individual hypothesis with structured metadata. |
|
Confidence levels for hypotheses. |
|
Agent that generates multiple hypotheses for speculative reasoning. |
|
Agent that performs parallel hypothesis verification. |
|
Plan for executing speculative retrieval and verification. |
|
Complete Speculative RAG agent with parallel hypothesis processing. |
|
Results from speculative RAG processing. |
|
Status of hypothesis verification. |
Functions¶
|
Create a Speculative RAG agent. |
Get I/O schema for Speculative RAG agents. |
Module Contents¶
- class agents.rag.speculative.agent.Hypothesis(/, **data)¶
Bases:
pydantic.BaseModel
Individual hypothesis with structured metadata.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.speculative.agent.HypothesisConfidence¶
-
Confidence levels for hypotheses.
Initialize self. See help(type(self)) for accurate signature.
- class agents.rag.speculative.agent.HypothesisGeneratorAgent(llm_config=None, num_hypotheses=5, hypothesis_diversity='high', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that generates multiple hypotheses for speculative reasoning.
Initialize hypothesis generator.
- Parameters:
- build_graph()¶
Build hypothesis generation graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.speculative.agent.ParallelVerificationAgent(documents, llm_config=None, verification_depth='thorough', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that performs parallel hypothesis verification.
Initialize parallel verifier.
- Parameters:
documents (list[langchain_core.documents.Document]) – Documents for evidence gathering
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
verification_depth (str) – Depth of verification (“basic”, “thorough”, “comprehensive”)
**kwargs – Additional agent arguments
- build_graph()¶
Build parallel verification graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.speculative.agent.SpeculativeExecutionPlan(/, **data)¶
Bases:
pydantic.BaseModel
Plan for executing speculative retrieval and verification.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.speculative.agent.SpeculativeRAGAgent(config)¶
Bases:
haive.agents.multi.base.SequentialAgent
Complete Speculative RAG agent with parallel hypothesis processing.
Init .
- Parameters:
config (SequentialAgentConfig) – [TODO: Add description]
- classmethod from_documents(documents, llm_config=None, num_hypotheses=5, verification_depth='thorough', **kwargs)¶
Create Speculative RAG agent from documents.
- Parameters:
documents (list[langchain_core.documents.Document]) – Documents to index
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
num_hypotheses (int) – Number of hypotheses to generate
verification_depth (str) – Depth of verification process
**kwargs – Additional arguments
- Returns:
SpeculativeRAGAgent instance
- class agents.rag.speculative.agent.SpeculativeResult(/, **data)¶
Bases:
pydantic.BaseModel
Results from speculative RAG processing.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- Parameters:
data (Any)
- class agents.rag.speculative.agent.VerificationStatus¶
-
Status of hypothesis verification.
Initialize self. See help(type(self)) for accurate signature.
- agents.rag.speculative.agent.create_speculative_rag_agent(documents, llm_config=None, speculation_mode='balanced', **kwargs)¶
Create a Speculative RAG agent.
- Parameters:
- Returns:
Configured Speculative RAG agent
- Return type: