fix: use output for python faithfulness statements#201
Open
Janhavi Sathe (invocan-jsathe) wants to merge 1 commit into
Open
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
|
Abhijeet Prasad (@AbhiPrasad) - Took a look a this one and it lgtm but wanted to run it past you |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Faithfulnesswhere statements were extracted fromexpectedinstead ofoutput, causing the scorer to evaluate the wrong text.Faithfulnesspaths inpy/autoevals/ragas.pyto route statement extraction throughoutput.py/autoevals/test_ragas.pythat uses mismatchedoutput/expectedand input-driven mocks so the final score depends on correct routing.Bug
Faithfulnessshould score whether claims in the generated answer are supported by context.In Python, it incorrectly passed
expectedto statement extraction, so claims were taken from ground truth rather than model output.Fix
Faithfulness._run_eval_async(...): changeanswer=expected->answer=output.Faithfulness._run_eval_sync(...): changeanswer=expected->answer=output.outputas well.Test
Added
test_faithfulness_extracts_statements_from_output:outputandexpected.extract_statementsto derive statements from passedanswer.extract_faithfulnessto derive verdicts from context containment.Validation
uv run --extra dev --extra scipy pytest py/autoevals/test_ragas.py -k faithfulness_extracts_statements_from_outputpassed.