feat(evaluation): Improve summary readability - #1095
Conversation
📝 WalkthroughWalkthroughV2 judge evaluations now calculate weighted overall scores, assign qualitative verdicts to metric traces, generate optional AI summaries, persist these fields, and preserve them during cached or resynchronized score reconstruction. ChangesEvaluation scoring and summary flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant FastEvaluation
participant SummaryGenerator
participant EvaluationRun
participant ScoreStorage
participant EvaluationService
FastEvaluation->>SummaryGenerator: generate AI summary from overall scores
SummaryGenerator-->>FastEvaluation: summary text or None
FastEvaluation->>EvaluationRun: persist summary_scores and overall
FastEvaluation->>ScoreStorage: persist trace scores and overall
EvaluationService->>ScoreStorage: reconstruct cached or merged traces
ScoreStorage-->>EvaluationService: traces with preserved overall
Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 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/crud/evaluations/fast.py`:
- Around line 910-926: Update _resolve_duplication_factor to defensively handle
invalid DATASET_META_DUPLICATION_FACTOR metadata, including None and non-numeric
values, by falling back to 1 while preserving the minimum value of 1 for valid
inputs. Ensure malformed metadata cannot propagate an exception or fail the
evaluation run.
In `@backend/app/crud/evaluations/summary.py`:
- Around line 126-176: Move the `extract_response_text(response).strip()` and
empty-summary handling inside the existing `try` block in
`generate_run_ai_summary`, so malformed Responses payloads are caught by the
broad exception handler and return `None`. Preserve the current logging and
successful non-empty summary behavior.
In `@docs/wiki/modules/evaluations.md`:
- Line 25: Update the EvaluationRun documentation to include the run-level
score["overall"] contract: weighted score, verdict, breakdown, and optional AI
summary. Document EVAL_JUDGE_MODEL and EVAL_SUMMARY_MODEL as configurable
default model settings rather than stating that judging always uses the fixed
gpt-5-mini fallback, while preserving the existing trace-level verdict details.
🪄 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: 164d28d5-1eb1-4208-b6b2-ae82abfae480
📒 Files selected for processing (13)
backend/app/core/config.pybackend/app/crud/evaluations/core.pybackend/app/crud/evaluations/fast.pybackend/app/crud/evaluations/judge.pybackend/app/crud/evaluations/score.pybackend/app/crud/evaluations/summary.pybackend/app/services/evaluations/evaluation.pybackend/app/tests/crud/evaluations/test_fast_judge.pybackend/app/tests/crud/evaluations/test_overall_summary.pybackend/app/tests/crud/evaluations/test_run_ai_summary.pybackend/app/tests/crud/evaluations/test_score.pybackend/app/tests/services/evaluations/test_evaluation_service_s3.pydocs/wiki/modules/evaluations.md
There was a problem hiding this comment.
Caution
Inline review comments failed to post. This is likely due to GitHub's internal server error or limits when posting large numbers of comments. If you are seeing this consistently it is likely a permissions issue. Please check "Moderation" -> "Code review limits" under your organization settings.
Actionable comments posted: 3
🤖 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/crud/evaluations/fast.py`:
- Around line 910-926: Update _resolve_duplication_factor to defensively handle
invalid DATASET_META_DUPLICATION_FACTOR metadata, including None and non-numeric
values, by falling back to 1 while preserving the minimum value of 1 for valid
inputs. Ensure malformed metadata cannot propagate an exception or fail the
evaluation run.
In `@backend/app/crud/evaluations/summary.py`:
- Around line 126-176: Move the `extract_response_text(response).strip()` and
empty-summary handling inside the existing `try` block in
`generate_run_ai_summary`, so malformed Responses payloads are caught by the
broad exception handler and return `None`. Preserve the current logging and
successful non-empty summary behavior.
In `@docs/wiki/modules/evaluations.md`:
- Line 25: Update the EvaluationRun documentation to include the run-level
score["overall"] contract: weighted score, verdict, breakdown, and optional AI
summary. Document EVAL_JUDGE_MODEL and EVAL_SUMMARY_MODEL as configurable
default model settings rather than stating that judging always uses the fixed
gpt-5-mini fallback, while preserving the existing trace-level verdict details.
🪄 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: 164d28d5-1eb1-4208-b6b2-ae82abfae480
📒 Files selected for processing (13)
backend/app/core/config.pybackend/app/crud/evaluations/core.pybackend/app/crud/evaluations/fast.pybackend/app/crud/evaluations/judge.pybackend/app/crud/evaluations/score.pybackend/app/crud/evaluations/summary.pybackend/app/services/evaluations/evaluation.pybackend/app/tests/crud/evaluations/test_fast_judge.pybackend/app/tests/crud/evaluations/test_overall_summary.pybackend/app/tests/crud/evaluations/test_run_ai_summary.pybackend/app/tests/crud/evaluations/test_score.pybackend/app/tests/services/evaluations/test_evaluation_service_s3.pydocs/wiki/modules/evaluations.md
🛑 Comments failed to post (1)
docs/wiki/modules/evaluations.md (1)
25-25: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the run-level
overallcontract and configurable models.This only documents trace verdicts. Add
score["overall"](weighted score, verdict, breakdown, optional AI summary) and describeEVAL_JUDGE_MODEL/EVAL_SUMMARY_MODELas configurable defaults, not an always-fixed fallback model.As per coding guidelines, “When changing a module's routes, tables, models, or services, update that module's wiki page in the same pull request.”
🤖 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 `@docs/wiki/modules/evaluations.md` at line 25, Update the EvaluationRun documentation to include the run-level score["overall"] contract: weighted score, verdict, breakdown, and optional AI summary. Document EVAL_JUDGE_MODEL and EVAL_SUMMARY_MODEL as configurable default model settings rather than stating that judging always uses the fixed gpt-5-mini fallback, while preserving the existing trace-level verdict details.Source: Coding guidelines
Issue
Closes #1093
Summary
In this PR,
API response of
overall:Checklist
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.