Skip to content

Commit 8b2e4c3

Browse files
authored
Update HallucinationDetectionOutput in line with documentation (#63)
1 parent 8487c09 commit 8b2e4c3

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

src/guardrails/checks/text/hallucination_detection.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,30 @@ class HallucinationDetectionOutput(LLMOutput):
9494
Extends the base LLM output with hallucination-specific details.
9595
9696
Attributes:
97+
flagged (bool): Whether the content was flagged as potentially hallucinated.
98+
confidence (float): Confidence score (0.0 to 1.0) that the input is hallucinated.
99+
reasoning (str): Detailed explanation of the analysis.
97100
hallucination_type (str | None): Type of hallucination detected.
98-
hallucinated_statements (list[str] | None): Specific statements flagged as potentially hallucinated.
99-
verified_statements (list[str] | None): Specific statements that are supported by the documents.
101+
hallucinated_statements (list[str] | None): Specific statements flagged as
102+
potentially hallucinated.
103+
verified_statements (list[str] | None): Specific statements that are supported
104+
by the documents.
100105
"""
101106

107+
flagged: bool = Field(
108+
...,
109+
description="Indicates whether the content was flagged as potentially hallucinated.",
110+
)
111+
confidence: float = Field(
112+
...,
113+
description="Confidence score (0.0 to 1.0) that the input is hallucinated.",
114+
ge=0.0,
115+
le=1.0,
116+
)
117+
reasoning: str = Field(
118+
...,
119+
description="Detailed explanation of the hallucination analysis.",
120+
)
102121
hallucination_type: str | None = Field(
103122
None,
104123
description="Type of hallucination detected (e.g., 'factual_error', 'unsupported_claim').",

0 commit comments

Comments
 (0)