feat: phase 6 — metric catalogue + threshold scoring - #8
Merged
Conversation
Spec / model layer - CheckSpec gains optional threshold field (min passing score 0-1) - Case gains optional context field (RAG retrieved passages) Check result layer - CheckResult gains threshold field; stored in CaseResult.checks JSON - from_raw(): when threshold set and score present, overrides passed = score >= threshold - registry.run_check(): extracts threshold from spec.with_['threshold'] or spec.threshold Generator - _JUDGE_KEYWORDS table: toxicity 0.90, hallucination 0.85, faithfulness/relevance/ completion 0.80 — matched by regex against requirements text - intents_to_spec(): embeds threshold in check with dict for judge intents - _INTENT_PROMPT updated with full catalogue and threshold guidance - Additional keyword detection: pii_absent, and expanded judge patterns Server - _STARTER_TEMPLATES → _METRIC_CATALOGUE (12 entries with determinism/category/ default_threshold; passed to template as metric_catalogue) - POST /pipelines/preview now returns threshold per check intent Wizard (pipeline_new.html) - Step 1 chips grouped by category with section headers - Active chip colour: blue for deterministic, purple for stochastic - Stochastic chips show threshold hint (≥0.80) - Step 2 preview card shows threshold next to judge check assertions Transcript (_transcript.html) already had score/threshold display from Phase 5 6 new tests in tests/test_phase6.py; all 149 tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
determinism,default_threshold, and the requirement text used to toggle itCheckResultgains athresholdfield;from_raw()overridespassed = score >= thresholdwhen both are present; threshold flows through toCaseResult.checksJSON for display in transcriptswithdict at generation time so they're editable via the existing PATCH endpoint(≥0.80)threshold hint0.72 < 0.80) was stubbed in Phase 5 and is now liveTest plan
pytest -q→ 149 passed/pipelines/new— Step 1 chips should be grouped by category (format, safety, rag, etc.) with section labels; stochastic chips should be purple when active and show threshold hintswithdict containsthresholdon the review pagescore ≥ thresholdorscore < thresholdformat🤖 Generated with Claude Code