fix(backend): default improvementSuggestions to avoid false QA failures

Review of the structured-output change found that requiring improvementSuggestions
reintroduced the failure-row problem: for good answers with nothing to suggest, the
model omits the field, which would throw NoObjectGeneratedError and store a false
'needs human review' verdict. Verified live: the model omits it ~5/6 of the time on
clean answers. Default it to "" so omission is tolerated, matching the old code's
lenient handling.
This commit is contained in:
Bilal Godil 2026-06-29 16:45:17 -07:00
parent ef9b4034cc
commit 72ae71017f

View File

@ -40,7 +40,9 @@ const qaReviewSchema = z.object({
severity: z.string(),
explanation: z.string(),
})),
improvementSuggestions: z.string(),
// Optional in practice: the model omits this for good answers with nothing to suggest.
// Defaulting (rather than requiring) avoids turning those into structured-output failures.
improvementSuggestions: z.string().default(""),
overallScore: z.number(),
});