[codex] Add source grouping parity for contextual precision#2737
Open
cat0825 wants to merge 2 commits into
Open
[codex] Add source grouping parity for contextual precision#2737cat0825 wants to merge 2 commits into
cat0825 wants to merge 2 commits into
Conversation
|
@cat0825 is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
CI note: the
I am not formatting the unrelated 58 files in this PR to keep the contribution focused on #2594/#2669. |
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
RetrievedContextData.sourcegrouping toTurnContextualPrecisionMetricbefore LLM verdict generation, matching the single-turnContextualPrecisionMetricbehaviorsourcegranularity/rank semanticsWhy
This is a focused follow-up to #2594 and #2669. The main branch already supports source-based grouping for single-turn contextual precision, but turn contextual precision accepted
RetrievedContextDatawithout grouping same-source contexts before verdict generation.This PR keeps the schema/source-first direction discussed by maintainers, avoids adding a new
group_bypublic API, and supersedes the draft direction from #2729 with tests and docs around the mergedsourcebehavior.Notes
RetrievedContextDataentries with the samesourceare grouped at the first position where that source appears, preserving best/first-seen rank behavior for fused retrieval lists.sourcecan be a section/span ID for section-level scoring or a chunk hash for exact duplicate/cross-arm hybrid search deduplication.Validation
PYTHONPATH=. poetry run pytest tests/test_metrics/test_contextual_precision_source_grouping.py -qPYTHONPATH=. poetry run pytest tests/test_core/test_imports.py tests/test_core/test_datasets/test_dataset.py -qOPENAI_API_KEY= PYTHONPATH=. poetry run pytest tests/test_metrics/test_contextual_precision_metric.py tests/test_metrics/test_turn_contextual_precision_metric.py -qPYTHONPATH=. poetry run black --check deepeval/metrics/utils.py deepeval/metrics/contextual_precision/contextual_precision.py deepeval/metrics/turn_contextual_precision/turn_contextual_precision.py tests/test_metrics/test_contextual_precision_source_grouping.pyPYTHONPATH=. poetry run ruff check deepeval/metrics/utils.py deepeval/metrics/contextual_precision/contextual_precision.py deepeval/metrics/turn_contextual_precision/turn_contextual_precision.py tests/test_metrics/test_contextual_precision_source_grouping.pyRefs #2594