Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle missing verdicts in Faithfulness eval #612

Conversation

andreaslillebo
Copy link
Contributor

Description:

The count_verified_statements method currently fails with an undefined method 'captures' for nil error when the expected string "Final verdict for each statement in order:" is absent from the LLMs response. This typically occurs if the provided context is either blank or not relevant to the question/answer.

Proposed Change:

This pull request introduces a guard clause in the count_verified_statements method to handle cases where the LLMs output does not contain the expected verdict format. I think returning a score of 0.0 makes sense given that this would be the correct score in most of these failure cases.

Code Changes:

  • A conditional check is added to return 0.0 immediately if no match is found in the verifications string.

@andreibondarev andreibondarev merged commit ff7392c into patterns-ai-core:main May 15, 2024
5 checks passed
@andreibondarev
Copy link
Collaborator

@andreaslillebo Thank you for the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants