RAGFaithfulness
RAGFaithfulness
Evaluator to assess if an LLM response is faithful to the provided context.
The RAGFaithfulness evaluator measures whether a response is grounded in and consistent with the provided reference documents. This is crucial for RAG (Retrieval-Augmented Generation) pipelines to detect hallucinations and ensure responses don't include information not present in the context.
Key Features:
Faithfulness Assessment: Determines if the response is supported by context
Binary Scoring: Returns 1.0 (faithful) or 0.0 (not faithful)
Hallucination Detection: Identifies when responses include unsupported claims
Detailed Reasoning: Provides explanation for the faithfulness assessment
Fiddler API Integration: Uses Fiddler's built-in faithfulness evaluation model
Use Cases:
RAG Systems: Detecting hallucinations in generated responses
Document Q&A: Ensuring answers are grounded in source documents
Customer Support: Verifying responses align with knowledge base
Legal/Medical AI: Critical applications requiring factual accuracy
Content Generation: Ensuring generated content matches source material
Scoring Logic:
1.0 (Faithful): Response is fully supported by the reference documents
0.0 (Not Faithful): Response contains information not in the documents : or contradicts the documents
Parameters
user_query
str
✗
None
The question or query being asked.
rag_response
str
✗
None
The LLM's response to evaluate.
retrieved_documents
list[str]
✗
None
The reference documents to check against.
Returns
A Score object containing: : - value: 1.0 if faithful, 0.0 if not faithful
label: "yes" or "no"
reasoning: Detailed explanation of the assessment
Return type: Score
Example
This evaluator uses Fiddler's built-in faithfulness assessment model and requires an active connection to the Fiddler API. The evaluator checks if the response is supported by the documents, not whether the response correctly answers the question.
name = 'rag_faithfulness'
score()
Score the faithfulness of a response to the provided context.
Parameters
user_query
str
✗
None
The question or query being asked.
rag_response
str
✗
None
The LLM's response to evaluate.
retrieved_documents
list[str]
✗
None
The reference documents to check against.
Returns
A Score object containing: : - value: 1.0 if faithful, 0.0 if not faithful
label: "yes" or "no"
reasoning: Detailed explanation of the assessment
Return type: Score
Last updated
Was this helpful?