#27Parse the Critic's structured verdictMediumAgentic AI
Parse the Critic's structured verdict
Background
The Critic emits machine-readable text so downstream code can branch on it:
GAP: <a sub-question with no useful data>
UNSUPPORTED: <a claim not backed by any finding>
VERDICT: PASS
VERDICT: FAIL
CriticVerdict parses this into three fields with plain string ops — no regex, no JSON.
Problem statement
Implement parse_verdict(raw) returning {"passed", "gaps", "unsupported"}.
Input
raw— the Critic's raw output string.
Output
Returns a dict:
"passed"→Trueiff"VERDICT: PASS"appears inraw,"gaps"→ list of texts from lines starting with"GAP:"(prefix stripped),"unsupported"→ list of texts from lines starting with"UNSUPPORTED:"(prefix stripped).
Examples
Example 1 — clean pass
Input: "VERDICT: PASS"
Output: {"passed": True, "gaps": [], "unsupported": []}
Example 2 — a gap and an unsupported claim
Input: "GAP: impact had no data\nUNSUPPORTED: StarCoder adoption\nVERDICT: FAIL"
Output: {"passed": False, "gaps": ["impact had no data"],
"unsupported": ["StarCoder adoption"]}
Constraints
passedis"VERDICT: PASS" in raw.gaps: each line starting"GAP:", text after the prefix, stripped.unsupported: each line starting"UNSUPPORTED:", text after the prefix, stripped.
Notes
- Note
"GAP:"is 4 characters and"UNSUPPORTED:"is 12 — slice off the right prefix length, then strip.
Python
Loading...
▶ Run executes the 3 visible sample tests below in your browser. Submit runs the full suite — including hidden tests — on the server for an official verdict.
- •Reference example: clean verdict pass
- •Sample: a gap and an unsupported claim on a fail
- •Example: multiple gaps, prefixes stripped