agents.rag.query_planning.agent_chain

Query Planning RAG using ChainAgent.

Simplified version using the new ChainAgent approach.

Classes

QueryPlan

Simplified query plan.

SubQueryResult

Result from a sub-query.

Functions

create_adaptive_planning_chain(documents[, llm_config])

Adaptive planning based on query complexity.

create_query_planning_chain(documents[, llm_config, name])

Create query planning RAG using ChainAgent.

create_simple_decomposition_chain(documents[, llm_config])

Even simpler version - just decompose and answer.

get_query_planning_chain_io_schema()

Get I/O schema for query planning chain.

Module Contents

class agents.rag.query_planning.agent_chain.QueryPlan(/, **data)

Bases: pydantic.BaseModel

Simplified query plan.

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.query_planning.agent_chain.SubQueryResult(/, **data)

Bases: pydantic.BaseModel

Result from a sub-query.

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.query_planning.agent_chain.create_adaptive_planning_chain(documents, llm_config=None)

Adaptive planning based on query complexity.

Parameters:
  • documents (list[langchain_core.documents.Document])

  • llm_config (haive.core.models.llm.base.LLMConfig | None)

Return type:

haive.agents.chain.ChainAgent

agents.rag.query_planning.agent_chain.create_query_planning_chain(documents, llm_config=None, name='Query Planning RAG')

Create query planning RAG using ChainAgent.

Parameters:
  • documents (list[langchain_core.documents.Document])

  • llm_config (haive.core.models.llm.base.LLMConfig | None)

  • name (str)

Return type:

haive.agents.chain.ChainAgent

agents.rag.query_planning.agent_chain.create_simple_decomposition_chain(documents, llm_config=None)

Even simpler version - just decompose and answer.

Parameters:
  • documents (list[langchain_core.documents.Document])

  • llm_config (haive.core.models.llm.base.LLMConfig | None)

Return type:

haive.agents.chain.ChainAgent

agents.rag.query_planning.agent_chain.get_query_planning_chain_io_schema()

Get I/O schema for query planning chain.

Return type:

dict[str, list[str]]