haive.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 haive.agents.rag.speculative.agent.Hypothesis(/, **data)¶
Bases:
pydantic.BaseModelIndividual 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 haive.agents.rag.speculative.agent.HypothesisConfidence¶
-
Confidence levels for hypotheses.
Initialize self. See help(type(self)) for accurate signature.
- class haive.agents.rag.speculative.agent.HypothesisGeneratorAgent¶
Bases:
haive.agents.base.agent.AgentAgent that generates multiple hypotheses for speculative reasoning.
- build_graph()¶
Build hypothesis generation graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class haive.agents.rag.speculative.agent.ParallelVerificationAgent¶
Bases:
haive.agents.base.agent.AgentAgent that performs parallel hypothesis verification.
- build_graph()¶
Build parallel verification graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- model_post_init(__context)¶
Initialize the mixin with state tracking attributes after Pydantic validation.
- Parameters:
__context (Any)
- Return type:
None
- class haive.agents.rag.speculative.agent.SpeculativeExecutionPlan(/, **data)¶
Bases:
pydantic.BaseModelPlan 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 haive.agents.rag.speculative.agent.SpeculativeRAGAgent¶
Bases:
haive.agents.multi.base.SequentialAgentComplete Speculative RAG agent with parallel hypothesis processing.
- 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 haive.agents.rag.speculative.agent.SpeculativeResult(/, **data)¶
Bases:
pydantic.BaseModelResults 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 haive.agents.rag.speculative.agent.VerificationStatus¶
-
Status of hypothesis verification.
Initialize self. See help(type(self)) for accurate signature.
- haive.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: