Skip to content

feat(judge): Add new metrics support - #279

Open
kaapi-agent-bot[bot] wants to merge 1 commit into
mainfrom
agent/ui-fix-269
Open

kaapi-agent-bot[bot] wants to merge 1 commit into
mainfrom
agent/ui-fix-269

Conversation

@kaapi-agent-bot

@kaapi-agent-bot kaapi-agent-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown

Issue

Closes #269

Summary

  • Added support for new metrics in the v2 judge model:
    • Adherence to Ground Truth
    • Adherence to Prompt
    • Adherence to Knowledge Base
  • Metrics reported on a 0–5 scale, applied per row when inputs are present.
  • Updated score-rendering and traffic-light color logic:
    • Introduced thresholds for 0–5 scores.
    • Maintained existing thresholds for 0–1 scores.
  • Enhanced data handling:
    • Added reasoning field to TraceScore for explanations.
    • Updated score tooltips to display reasoning alongside comment.
    • Updated CSV exports to include reasoning and modified headers.

Checklist

Before submitting a pull request, please ensure that you mark these task.

  • Ran npm run dev and npm run build in the repository root and test.
  • If you've fixed a bug or added code that is tested
Original PR description

Closes #269

What changed

The v2 judge model reports three new metrics — Adherence to Ground Truth, Adherence to Prompt, Adherence to Knowledge Base — as integers on a 0–5 scale, applied per row only when the necessary inputs are present. The existing score-rendering code assumed every numeric score was a cosine-similarity-style value on a 0–1 scale, so these new metrics would have rendered with the wrong traffic-light color.

  • app/lib/types/evaluation.ts: added an optional reasoning field to TraceScore for the judge model's per-trace explanation (the v2 counterpart to the existing comment field).
  • app/lib/utils.ts: split formatScoreValue into per-scale helpers and added 0–5 traffic-light thresholds (0–1 red/needs improvement, 2–3 yellow/could improve, 4–5 green/good) for the three named "Adherence to ..." metrics, while keeping the existing 0–1 thresholds for cosine/correctness-style scores. Added a getScoreNote helper that prefers reasoning over comment.
  • app/components/evaluations/DetailedResultsTable.tsx and GroupedResultsTable.tsx: score tooltips now show getScoreNote(score) so the v2 reasoning field surfaces alongside the legacy comment field.
  • app/lib/utils/evaluationExport.ts: CSV exports now include reasoning (falling back to comment) and the column headers were updated to Comment/Reasoning to reflect that.

Assumptions

  • The three new metric names are matched case-insensitively against "adherence to ground truth", "adherence to prompt", "adherence to knowledge base" (from the issue's screenshot/description) to decide which traffic-light scale (0–5 vs. legacy 0–1) applies to a given TraceScore. If the backend uses different exact names, this list in app/lib/utils.ts will need updating.
  • The judge model's explanation is assumed to arrive on a new reasoning field on TraceScore, separate from (but analogous to) the existing comment field. Where both are present, reasoning takes precedence for display purposes.
  • No network/backend access was available in this run, so the exact response shape could not be verified against a live API — the change mirrors the existing TraceScore/scoring patterns already in the codebase.

Test plan

  • npm run lint passes with no new warnings/errors
  • npm run build passes
  • Manually verify against a live v2 judge evaluation run once available (reviewer to confirm metric names/reasoning field shape)

…results

Adds traffic-light coloring for the v2 judge metrics (Adherence to Ground
Truth/Prompt/Knowledge Base) on a 0-5 scale, alongside the existing 0-1
cosine/correctness scale. Also surfaces the new per-trace `reasoning`
field in score tooltips and CSV exports, falling back to the legacy
`comment` field.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (1)
  • ready-for-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 4818e22a-16b4-42c5-8512-b303ffc13c70

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot changed the title fix: support 0-5 judge score scale and reasoning field in evaluation results feat(judge): Add new metrics support Sep 17, 2026
Comment thread app/lib/utils.ts
Comment on lines +261 to +264
/**
* Returns the judge's explanation for a score, preferring the v2 `reasoning`
* field over the legacy `comment` field.
*/

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed this comment.

Comment thread app/lib/utils.ts
return { value: catValue, color, bg };
};

// Traffic light thresholds for v2 judge metrics: 0-1 needs improvement, 2-3 could improve, 4-5 good.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

able to understand via function name. so need to remove this.

Comment thread app/lib/utils.ts
const numValue = Number(score.value);
const formattedValue = numValue.toFixed(2);
const formatCategoricalScore = (value: number | string) => {
const catValue = String(value);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using the catValue variable name, we should use a more descriptive and meaningful name that clearly indicates what the value represents.

Comment thread app/lib/utils.ts
color = "#dc2626";
bg = "#fee2e2";
}
// v2 judge metrics score 0-5 (integers) instead of the legacy 0-1 cosine/correctness scale.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in every function, not needed these types of the comments.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Evaluation: Update score rendering system

1 participant