test(metrics): add overlapping-chunk regression fixtures for ContextualPrecisionMetric (rebased on #2743)#2787
Draft
Ruthwik-Data wants to merge 9 commits into
Conversation
…Data source grouping This test suite validates the functionality of ContextualPrecisionMetric in handling overlapping chunks, ensuring that source grouping and weighted cumulative precision calculations are correctly implemented.
|
@Ruthwik-Data is attempting to deploy a commit to the Confident AI Team on Vercel. A member of the Team first needs to authorize it. |
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
Adds
tests/test_metrics/test_contextual_precision_overlapping_chunks.py— a focused regression test suite forContextualPrecisionMetricbehaviour under overlapping-chunk retrieval scenarios.This supersedes the test file from PR #2692 and is rebased on the merged changes from PR #2743 (
RetrievedContextData._group_retrieval_contexts+ WCP formula fix). The fixtures now use the newRetrievedContextDatawith asourcefield, which is the correct API post-merge.Closes #2594 (test coverage aspect).
Motivation
PR #2743 fixed two root causes:
_group_retrieval_contexts()merges multipleRetrievedContextDatachunks sharing the samesourcestring before LLM scoring, preventing redundant-chunk penalisation._calculate_score()now correctly implements weighted cumulative precision (binary verdicts, rank-discounted).Without regression tests, these fixes can silently regress. This PR adds four targeted tests that each guard one failure mode from issue #2594.
What this PR adds
Test fixtures
overlapping_narrative_chunksnon_overlapping_mixed_chunkstable_cell_overlap_chunksTest cases
test_same_source_overlap_does_not_penalisetest_cross_source_chunks_scored_independentlytest_table_boundary_overlap_not_penalisedtest_wcp_formula_monotone_with_relevant_rankDesign notes
RetrievedContextData(content=..., source=...)— the post-feat(contextual-precision): add RetrievedContextData source grouping and fix weighted precision score #2743 API.threshold=0.0in the WCP monotonicity test isolates formula logic from pass/fail cutoffs.conftest.py.Type of change