pub fn parse_response(
raw: &str,
candidates: &[&Memory],
) -> Result<SynthesisResponse>Expand description
Parse a model response into a SynthesisResponse, validating
that:
- The response decodes as JSON containing the
verdictsarray. - Every verdict’s
candidate_idmatches one of the supplied candidate ids (no fabricated ids — Gemma 4 occasionally hallucinates ids when over-eager). - Every
verb=updatecarries non-emptymerged_content. - Every supplied candidate id is covered by exactly one verdict.
On any validation failure returns Err; the caller falls back to
the legacy code path (a structurally-degraded LLM does NOT block
the store).