agents.rag.modular_chain

Modular RAG using ChainAgent.

Build configurable RAG pipelines with modular components.

Classes

ModularConfig

Configuration for modular RAG.

RAGModule

Available RAG modules.

Functions

create_comprehensive_modular_rag(documents[, llm_config])

Create a comprehensive modular RAG with all modules.

create_custom_modular_rag(documents, modules[, llm_config])

Create a custom modular RAG with specified modules.

create_modular_rag(documents, config[, llm_config, name])

Create a modular RAG system with configurable components.

create_simple_modular_rag(documents[, llm_config])

Create a simple modular RAG with basic modules.

Module Contents

class agents.rag.modular_chain.ModularConfig(/, **data)

Bases: pydantic.BaseModel

Configuration for modular RAG.

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.modular_chain.RAGModule

Bases: str, enum.Enum

Available RAG modules.

Initialize self. See help(type(self)) for accurate signature.

agents.rag.modular_chain.create_comprehensive_modular_rag(documents, llm_config=None)

Create a comprehensive modular RAG with all modules.

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

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

Return type:

haive.agents.chain.ChainAgent

agents.rag.modular_chain.create_custom_modular_rag(documents, modules, llm_config=None)

Create a custom modular RAG with specified modules.

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

  • modules (list[str])

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

Return type:

haive.agents.chain.ChainAgent

agents.rag.modular_chain.create_modular_rag(documents, config, llm_config=None, name='Modular RAG')

Create a modular RAG system with configurable components.

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

  • config (ModularConfig)

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

  • name (str)

Return type:

haive.agents.chain.ChainAgent

agents.rag.modular_chain.create_simple_modular_rag(documents, llm_config=None)

Create a simple modular RAG with basic modules.

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

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

Return type:

haive.agents.chain.ChainAgent