haive.agents.rag.flare.agent ============================ .. py:module:: haive.agents.rag.flare.agent .. autoapi-nested-parse:: FLARE (Forward-Looking Active REtrieval) RAG Agents. from typing import Any Implementation of FLARE RAG with forward-looking retrieval and iterative generation. Uses structured output models for planning and managing active retrieval decisions. Classes ------- .. autoapisummary:: haive.agents.rag.flare.agent.ActiveRetrievalAgent haive.agents.rag.flare.agent.ConfidenceLevel haive.agents.rag.flare.agent.FLAREPlan haive.agents.rag.flare.agent.FLAREPlannerAgent haive.agents.rag.flare.agent.FLARERAGAgent haive.agents.rag.flare.agent.FLAREResult haive.agents.rag.flare.agent.RetrievalDecision Functions --------- .. autoapisummary:: haive.agents.rag.flare.agent.create_active_retrieval_callable haive.agents.rag.flare.agent.create_flare_planner_callable haive.agents.rag.flare.agent.create_flare_rag_agent haive.agents.rag.flare.agent.get_flare_rag_io_schema Module Contents --------------- .. py:class:: ActiveRetrievalAgent Bases: :py:obj:`haive.agents.base.agent.Agent` Agent that performs active retrieval based on FLARE plans. .. py:method:: build_graph() Build active retrieval graph. .. py:class:: ConfidenceLevel Bases: :py:obj:`str`, :py:obj:`enum.Enum` Confidence levels for generation. Initialize self. See help(type(self)) for accurate signature. .. py:class:: FLAREPlan(/, **data) Bases: :py:obj:`pydantic.BaseModel` Forward-looking plan for active retrieval. 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:: FLAREPlannerAgent Bases: :py:obj:`haive.agents.base.agent.Agent` Agent that creates FLARE plans for iterative generation and active retrieval. .. py:method:: build_graph() Build FLARE planning graph. .. py:class:: FLARERAGAgent Bases: :py:obj:`haive.agents.multi.base.SequentialAgent` Complete FLARE RAG agent with forward-looking active retrieval. .. py:method:: from_documents(documents, llm_config = None, max_iterations = 5, confidence_threshold = 0.7, **kwargs) :classmethod: Create FLARE RAG agent from documents. :param documents: Documents to index :param llm_config: LLM configuration :param max_iterations: Maximum FLARE iterations :param confidence_threshold: Confidence threshold for retrieval :param \*\*kwargs: Additional arguments :returns: FLARERAGAgent instance .. py:class:: FLAREResult(/, **data) Bases: :py:obj:`pydantic.BaseModel` Results from FLARE 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:: RetrievalDecision Bases: :py:obj:`str`, :py:obj:`enum.Enum` Decisions for active retrieval. Initialize self. See help(type(self)) for accurate signature. .. py:function:: create_active_retrieval_callable(documents, embedding_model = None) Create callable function for active retrieval. .. py:function:: create_flare_planner_callable(llm_config) Create callable function for FLARE planning. .. py:function:: create_flare_rag_agent(documents, llm_config = None, flare_mode = 'adaptive', **kwargs) Create a FLARE RAG agent. :param documents: Documents for retrieval :param llm_config: LLM configuration :param flare_mode: FLARE mode ("conservative", "adaptive", "aggressive") :param \*\*kwargs: Additional arguments :returns: Configured FLARE RAG agent .. py:function:: get_flare_rag_io_schema() Get I/O schema for FLARE RAG agents.