Feature/trust score metric 17823921494002512507#2625
Open
Danish2op wants to merge 5 commits intoconfident-ai:mainfrom
Open
Feature/trust score metric 17823921494002512507#2625Danish2op wants to merge 5 commits intoconfident-ai:mainfrom
Danish2op wants to merge 5 commits intoconfident-ai:mainfrom
Conversation
This commit introduces a new `TrustScoreMetric` which evaluates the trustworthiness of an LLM response based on the sources used during RAG retrieval. The metric takes a dictionary of source strings mapped to tier values (T1-T5), and scores the sources appropriately. It exports the new metric in the `deepeval/metrics/__init__.py` file and provides comprehensive test cases for varying trust tiers, thresholds, and edge cases.
This commit introduces a new `TrustScoreMetric` which evaluates the trustworthiness of an LLM response based on the sources used during RAG retrieval. The metric takes a dictionary of source strings mapped to tier values (T1-T5), and scores the sources appropriately. It exports the new metric in the `deepeval/metrics/__init__.py` file and provides comprehensive test cases for varying trust tiers, thresholds, and edge cases.
This commit introduces a new `TrustScoreMetric` which evaluates the trustworthiness of an LLM response based on the sources used during RAG retrieval. The metric takes a dictionary of source strings mapped to tier values (T1-T5), and scores the sources appropriately. It exports the new metric in the `deepeval/metrics/__init__.py` file and provides comprehensive test cases for varying trust tiers, thresholds, and edge cases.
|
@Danish2op is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
This commit introduces a new `TrustScoreMetric` which evaluates the trustworthiness of an LLM response based on the sources used during RAG retrieval. The metric takes a dictionary of source strings mapped to tier values (T1-T5), and scores the sources appropriately. It exports the new metric in the `deepeval/metrics/__init__.py` file and provides comprehensive test cases for varying trust tiers, thresholds, and edge cases.
This commit introduces a new `TrustScoreMetric` which evaluates the trustworthiness of an LLM response based on the sources used during RAG retrieval. The metric takes a dictionary of source strings mapped to tier values (T1-T5), and scores the sources appropriately. It exports the new metric in the `deepeval/metrics/__init__.py` file and provides comprehensive test cases for varying trust tiers, thresholds, and edge cases.
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.
Description
This PR addresses issue #2586 by implementing a new
TrustScoreMetric. This metric evaluates the trustworthiness of an LLM's response based on the sources used during RAG retrieval, categorized by customizable trust tiers.DeepEval currently evaluates LLM outputs on dimensions like faithfulness, relevance, and hallucination. However, two responses can score identically on faithfulness but have completely different trust profiles depending on where they sourced their information (e.g., SEC filings vs. unverified blog posts). This new orthogonal dimension ensures users can accurately measure output trust based on their retrieval sources.
What was built
A new
TrustScoreMetricclass that:source_tiersandthreshold: Takes a dictionary mapping source identifiers/keywords to tier numbers (T1=most trusted, T5=least trusted), and a success threshold float (default0.7).measureanda_measurefunctions on anLLMTestCaseexactly like other base metrics and supportsBaseMetricproperties.test_case.retrieval_context.1.0, T2=0.8, T3=0.6, T4=0.4, T5=0.2. Unmatched sources receive a default neutral score of0.5.reasonstring explaining which sources were found and their tiers.Changes Made
deepeval/metrics/trust_scoredirectory with__init__.pyandtrust_score.py.deepeval/metrics/__init__.py.tests/test_trust_score_metric.pyvalidating various scenarios (high/low trust, mixed/unmatched sources, threshold pass/fail, empty retrieval contexts).How to use