haive.agents.rag.document_grading.agent¶

Document Grading RAG Agent.

Iterative document grading with structured output.

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 haive.agents.rag.document_grading.agent.DocumentGradingAgent¶

Bases: haive.agents.base.agent.Agent

Agent that iterates over documents and grades each one.

build_graph()¶

Build document grading graph.

Return type:

haive.core.graph.state_graph.base_graph2.BaseGraph

class haive.agents.rag.document_grading.agent.DocumentGradingRAGAgent¶

Bases: haive.agents.multi.base.SequentialAgent

RAG with document grading and filtering.

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 haive.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)