agents.rag.document_grading.agent

Document Grading RAG Agent.

from typing import Any Iterative document grading with structured output. Uses CallableNodeConfig to iterate over retrieved documents.

Classes

DocumentGradingAgent

Agent that iterates over documents and grades each one.

DocumentGradingRAGAgent

RAG with document grading and filtering.

SingleDocumentGrade

Grade for a single document.

Module Contents

class agents.rag.document_grading.agent.DocumentGradingAgent(llm_config=None, **kwargs)

Bases: haive.agents.base.agent.Agent

Agent that iterates over documents and grades each one.

Initialize with LLM config.

Parameters:

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

build_graph()

Build graph with document grading using CallableNode iteration.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

class agents.rag.document_grading.agent.DocumentGradingRAGAgent(config)

Bases: haive.agents.multi.base.SequentialAgent

RAG with document grading and filtering.

Init .

Parameters:

config (SequentialAgentConfig) – [TODO: Add description]

classmethod from_documents(documents, llm_config=None, relevance_threshold=0.7, **kwargs)

Create Document Grading RAG from documents.

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

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

  • relevance_threshold (float)

class agents.rag.document_grading.agent.SingleDocumentGrade(/, **data)

Bases: pydantic.BaseModel

Grade for a single document.

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)