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

fix groundedness with no supporting evidence #1193

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

nicoloboschi
Copy link
Contributor

@nicoloboschi nicoloboschi commented Jun 11, 2024

Items to add to release announcement:

  • Heading: fix groundedness feedback with no supporting evidence

Currently if you use feedback groundedness_measure_with_cot_reasons and one of the hypothesis is returning no supporting evidence, the feedback is completely broken and not even the score is visible. This is due to the fact this feedback implies to always have a "reason" behind the score.


🚀 This description was created by Ellipsis for commit 1c9a729

Summary:

This PR fixes an issue in the groundedness_measure_with_cot_reasons feedback function to handle cases with no supporting evidence without breaking.

Key points:

  • Modified evaluate_hypothesis function in Provider class to handle missing 'reason' key gracefully.
  • Ensures feedback system remains operational even when no supporting evidence is provided.

Generated with ❤️ by ellipsis.dev

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 11, 2024
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Looks good to me! Reviewed everything up to 1c9a729 in 33 seconds

More details
  • Looked at 15 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. trulens_eval/trulens_eval/feedback/provider/base.py:1225
  • Draft comment:
    The change effectively handles cases where no 'reason' is provided, preventing potential KeyErrors and ensuring the feedback system remains robust. This is a necessary fix for the groundedness feedback functionality.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR aims to address a bug where the feedback system breaks if no supporting evidence is provided for a statement's groundedness. The change checks if the 'reason' key exists in the 'reason' dictionary before attempting to access it, which prevents a KeyError and allows the feedback system to handle cases where no reason is provided. This is a crucial fix for robustness in feedback generation.

Workflow ID: wflow_x9g9iRRlgxs4Fudq


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@epinzur
Copy link
Contributor

epinzur commented Jun 11, 2024

i wonder if when running in deferred mode, this change would prevent trulens from seeing this as a failed evaluation and then would not re-run it.

@nicoloboschi
Copy link
Contributor Author

i wonder if when running in deferred mode, this change would prevent trulens from seeing this as a failed evaluation and then would not re-run it.

It might be as side effect. Anyway all other feedback providers don't fail if the reason can't be found so I think it's better to align to the others' behaviour

@sfc-gh-jreini sfc-gh-jreini merged commit f24aeb2 into truera:main Jun 13, 2024
9 checks passed
@sfc-gh-jreini sfc-gh-jreini mentioned this pull request Jun 21, 2024
sfc-gh-dhuang pushed a commit that referenced this pull request Jun 28, 2024
* fix groundedness with no supporting evidence

* use reason not generated

---------

Co-authored-by: Josh Reini <josh.reini@snowflake.com>
sfc-gh-dhuang pushed a commit that referenced this pull request Jul 1, 2024
* fix groundedness with no supporting evidence

* use reason not generated

---------

Co-authored-by: Josh Reini <josh.reini@snowflake.com>
sfc-gh-chu pushed a commit that referenced this pull request Sep 25, 2024
* fix groundedness with no supporting evidence

* use reason not generated

---------

Co-authored-by: Josh Reini <josh.reini@snowflake.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants