agents.rag.step_back.agent¶
Step-Back Prompting RAG Agents.
from typing import Any Implementation of step-back prompting for abstract reasoning. Generates broader conceptual queries for enhanced context retrieval.
Classes¶
Agent that performs both original and step-back retrieval. |
|
Step-back query generation result. |
|
Agent that generates step-back queries for abstract reasoning. |
|
Complete Step-Back RAG agent with abstract reasoning. |
|
Combined results from step-back retrieval. |
Functions¶
|
Create a Step-Back RAG agent. |
Get I/O schema for Step-Back RAG agents. |
Module Contents¶
- class agents.rag.step_back.agent.DualRetrievalAgent(documents, embedding_model=None, max_docs_each=5, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that performs both original and step-back retrieval.
Initialize dual retrieval agent.
- Parameters:
- build_graph()¶
Build dual retrieval graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.step_back.agent.StepBackQuery(/, **data)¶
Bases:
pydantic.BaseModel
Step-back query generation result.
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.step_back.agent.StepBackQueryGeneratorAgent(llm_config=None, abstraction_level='moderate', **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Agent that generates step-back queries for abstract reasoning.
Initialize step-back query generator.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
abstraction_level (str) – Level of abstraction (“low”, “moderate”, “high”)
**kwargs – Additional agent arguments
- build_graph()¶
Build step-back query generation graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.step_back.agent.StepBackRAGAgent(config)¶
Bases:
haive.agents.multi.base.SequentialAgent
Complete Step-Back RAG agent with abstract reasoning.
Init .
- Parameters:
config (SequentialAgentConfig) – [TODO: Add description]
- classmethod from_documents(documents, llm_config=None, embedding_model=None, abstraction_level='moderate', max_docs_each=5, **kwargs)¶
Create Step-Back 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
embedding_model (str | None) – Embedding model for retrieval
abstraction_level (str) – Level of abstraction for step-back queries
max_docs_each (int) – Max docs to retrieve for each query type
**kwargs – Additional arguments
- Returns:
StepBackRAGAgent instance
- class agents.rag.step_back.agent.StepBackResult(/, **data)¶
Bases:
pydantic.BaseModel
Combined results from step-back 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.
- Parameters:
data (Any)
- agents.rag.step_back.agent.create_step_back_rag_agent(documents, llm_config=None, reasoning_depth='moderate', **kwargs)¶
Create a Step-Back RAG agent.
- Parameters:
- Returns:
Configured Step-Back RAG agent
- Return type: