Repository navigation
feat(core): use native structured output for JSON stages - #413
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 58 minutes. View limit details
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. |
84d3f4b to
53ab3f5
Compare
[Medium impact] The PR appears safe to merge; no blocking issues were found. SummaryThe JSON analysis stages now use each AI provider’s native structured output, with shared Zod checks and one repair attempt.
No new actionable issues found. Tests and live provider calls were not run during this review.
|
a4b3bb8 to
22dc2cd
Compare
- Anthropic output_config.format, OpenAI strict json_schema (anyOf with null for nullable objects and arrays), Gemini responseJsonSchema - JSON Schema generated from the Zod schemas and sanitised to keywords every provider accepts; unrepresentable types fail at load - One repair retry with the Zod issues and the invalid reply, then StructuredOutputError; truncation and refusals are not repaired - Component selection constrained to candidate ids, falling back to the default component on an unusable answer or a rejected request - ADR-014, ADR-002 note, model requirements in the docs
Limit echoed validation issues to 20, each truncated to 200 chars, with an "... and N more issues" line, so a large invalid response cannot blow up the repair request.
22dc2cd to
44b0e92
Compare
Stacked on #412.
What changed
output_config.formatjson_schema. A forced tool call was rejected because it returns 400 on Opus 5.5, Sonnet 5.5 and the Fable/Mythos 5.x models.text.formatjson_schema; nullable objects and arrays useanyOfwith{type: 'null'}, primitives use type arrays.responseMimeType: 'application/json'plusresponseJsonSchema.z.toJSONSchema, input side), sanitised recursively to keywords every provider accepts. Unrepresentable Zod types fail at module load. A test keeps the Anthropic schemas within its documented limits (24 optional, 16 union parameters).StructuredOutputErrorfromerrors.ts. Truncation, refusals and API errors are not repaired.callModel(..., output?)per provider;PromptBuilder.extractJsonremoved; OpenAI strict schema cached per spec.Behaviour changes
gpt-4o-2024-08-06or later, a Gemini model withresponseJsonSchema, any current Claude model.undefinedinstead ofnull.Review follow-ups
Checks
check:ci