agents.rag.hallucination_grading.agent¶
Hallucination Grading Agents.
Modular agents for detecting and grading hallucinations in RAG responses. Can be plugged into any workflow with compatible I/O schemas.
Classes¶
Advanced hallucination assessment with detailed analysis. |
|
Advanced hallucination grading with detailed analysis. |
|
Single hallucination assessment. |
|
Basic hallucination grading agent. |
|
Quick hallucination check for real-time applications. |
|
Fast hallucination checker for real-time applications. |
Functions¶
|
Create a hallucination grader agent. |
Get I/O schema for hallucination graders for compatibility checking. |
Module Contents¶
- class agents.rag.hallucination_grading.agent.AdvancedHallucinationGrade(/, **data)¶
Bases:
pydantic.BaseModel
Advanced hallucination assessment with detailed analysis.
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.hallucination_grading.agent.AdvancedHallucinationGraderAgent(llm_config=None, enable_context_expansion=True, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Advanced hallucination grading with detailed analysis.
Initialize advanced hallucination grader.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
enable_context_expansion (bool) – Whether to use additional context sources
**kwargs – Additional agent arguments
- build_graph()¶
Build advanced hallucination analysis graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.hallucination_grading.agent.HallucinationGrade(/, **data)¶
Bases:
pydantic.BaseModel
Single hallucination assessment.
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.hallucination_grading.agent.HallucinationGraderAgent(llm_config=None, threshold=0.7, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Basic hallucination grading agent.
Initialize hallucination grader.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
threshold (float) – Confidence threshold for flagging hallucinations
**kwargs – Additional agent arguments
- build_graph()¶
Build hallucination grading graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- class agents.rag.hallucination_grading.agent.RealtimeHallucinationCheck(/, **data)¶
Bases:
pydantic.BaseModel
Quick hallucination check for real-time applications.
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.hallucination_grading.agent.RealtimeHallucinationGraderAgent(llm_config=None, safety_threshold=0.8, **kwargs)¶
Bases:
haive.agents.base.agent.Agent
Fast hallucination checker for real-time applications.
Initialize realtime hallucination grader.
- Parameters:
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
safety_threshold (float) – Threshold for considering response safe
**kwargs – Additional agent arguments
- build_graph()¶
Build realtime hallucination check graph.
- Return type:
haive.core.graph.state_graph.base_graph2.BaseGraph
- agents.rag.hallucination_grading.agent.create_hallucination_grader(grader_type='basic', llm_config=None, **kwargs)¶
Create a hallucination grader agent.
- Parameters:
grader_type (Literal['basic', 'advanced', 'realtime']) – Type of grader to create
llm_config (haive.core.models.llm.base.LLMConfig | None) – LLM configuration
**kwargs – Additional arguments
- Returns:
Configured hallucination grader agent
- Return type:
haive.agents.base.agent.Agent