haive.agents.rag.speculative.agent ================================== .. py:module:: haive.agents.rag.speculative.agent .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: haive.agents.rag.speculative.agent.Hypothesis haive.agents.rag.speculative.agent.HypothesisConfidence haive.agents.rag.speculative.agent.HypothesisGeneratorAgent haive.agents.rag.speculative.agent.ParallelVerificationAgent haive.agents.rag.speculative.agent.SpeculativeExecutionPlan haive.agents.rag.speculative.agent.SpeculativeRAGAgent haive.agents.rag.speculative.agent.SpeculativeResult haive.agents.rag.speculative.agent.VerificationStatus Functions --------- .. autoapisummary:: haive.agents.rag.speculative.agent.create_speculative_rag_agent haive.agents.rag.speculative.agent.get_speculative_rag_io_schema Module Contents --------------- .. py:class:: Hypothesis(/, **data) Bases: :py:obj:`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. .. py:class:: HypothesisConfidence Bases: :py:obj:`str`, :py:obj:`enum.Enum` Confidence levels for hypotheses. Initialize self. See help(type(self)) for accurate signature. .. py:class:: HypothesisGeneratorAgent Bases: :py:obj:`haive.agents.base.agent.Agent` Agent that generates multiple hypotheses for speculative reasoning. .. py:method:: build_graph() Build hypothesis generation graph. .. py:class:: ParallelVerificationAgent Bases: :py:obj:`haive.agents.base.agent.Agent` Agent that performs parallel hypothesis verification. .. py:method:: build_graph() Build parallel verification graph. .. py:method:: model_post_init(__context) Initialize the mixin with state tracking attributes after Pydantic validation. .. py:class:: SpeculativeExecutionPlan(/, **data) Bases: :py:obj:`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. .. py:class:: SpeculativeRAGAgent Bases: :py:obj:`haive.agents.multi.base.SequentialAgent` Complete Speculative RAG agent with parallel hypothesis processing. .. py:method:: from_documents(documents, llm_config = None, num_hypotheses = 5, verification_depth = 'thorough', **kwargs) :classmethod: Create Speculative RAG agent from documents. :param documents: Documents to index :param llm_config: LLM configuration :param num_hypotheses: Number of hypotheses to generate :param verification_depth: Depth of verification process :param \*\*kwargs: Additional arguments :returns: SpeculativeRAGAgent instance .. py:class:: SpeculativeResult(/, **data) Bases: :py:obj:`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. .. py:class:: VerificationStatus Bases: :py:obj:`str`, :py:obj:`enum.Enum` Status of hypothesis verification. Initialize self. See help(type(self)) for accurate signature. .. py:function:: create_speculative_rag_agent(documents, llm_config = None, speculation_mode = 'balanced', **kwargs) Create a Speculative RAG agent. :param documents: Documents for retrieval :param llm_config: LLM configuration :param speculation_mode: Mode ("conservative", "balanced", "aggressive") :param \*\*kwargs: Additional arguments :returns: Configured Speculative RAG agent .. py:function:: get_speculative_rag_io_schema() Get I/O schema for Speculative RAG agents.