feat(evals): Added verdict categorization system - #1094
Conversation
📝 WalkthroughWalkthroughNumeric v2 judge metric trace scores now include verdict bands derived from rounded scores. The score module defines thresholds and enum values, fast evaluation populates verdicts, tests cover boundaries and exclusions, and evaluation documentation describes the contract. ChangesEvaluation verdict bands
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
OpenAPI changes ⚪ No API surface changesNote This PR does not modify the API contract.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
backend/app/crud/evaluations/score.py (1)
14-14: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winUse
StrEnumto satisfy Ruff UP042.Line 14 triggers the configured Ruff rule;
StrEnumpreserves the existing string serialization and is available with the required Python 3.11+ baseline.Proposed fix
-from enum import Enum +from enum import StrEnum -class VerdictEnum(str, Enum): +class VerdictEnum(StrEnum):🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@backend/app/crud/evaluations/score.py` at line 14, Update VerdictEnum to inherit from the standard library StrEnum instead of combining str with Enum, preserving its existing members and string serialization behavior while satisfying Ruff UP042.Sources: Coding guidelines, Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@backend/app/tests/crud/evaluations/test_fast_judge.py`:
- Around line 1091-1185: Add return annotations to the three test methods in
backend/app/tests/crud/evaluations/test_fast_judge.py lines 1091-1185, and
annotate the nested _judge(params) callback parameter and return type. In
backend/app/tests/crud/evaluations/test_score.py lines 25-42, add self:
TestVerdictFromScore to each TestVerdictFromScore test method.
---
Nitpick comments:
In `@backend/app/crud/evaluations/score.py`:
- Line 14: Update VerdictEnum to inherit from the standard library StrEnum
instead of combining str with Enum, preserving its existing members and string
serialization behavior while satisfying Ruff UP042.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 16cc1f72-0090-4fdf-b809-aab74f6fb049
📒 Files selected for processing (5)
backend/app/crud/evaluations/fast.pybackend/app/crud/evaluations/score.pybackend/app/tests/crud/evaluations/test_fast_judge.pybackend/app/tests/crud/evaluations/test_score.pydocs/wiki/modules/evaluations.md
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Issue
Closes #1092
Summary
pass / borderline / fail) instead of forcing users to interpret raw 0–1 scores.Adherence to Ground Truth / Prompt / Knowledge Base) now carries a verdict derived from that score:0 ≤ score < 0.3--> Needs Improvement0.3 ≤ score < 0.6--> Needs Refinement0.6 ≤ score ≤ 1--> GoodChecklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.