Repository navigation
fix(ai): 🐛 Drop response_format when the provider refuses json_object too - #163
Merged
Merged
Conversation
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.
Insights failed on Claude Haiku 5.5 right after #162: every request ended in a 400.
Anthropic's OpenAI-compatible endpoint accepts
response_formatonly as strictjson_schema, and it refusesBookInsightPayloadunder strict mode because the schema has a free-form map (additionalProperties: object). The client then fell back to{"type": "json_object"}as designed (#102), and Anthropic refuses that type outright ("response_format.type: Input should be 'json_schema'").The fallback now has one more step. If
json_objectis refused the same way, the request goes withoutresponse_format, with the schema already in the prompt, and the client remembers that shape for later calls. Providers that acceptjson_schemaorjson_objectbehave exactly as before.Checked live: two insight calls against
claude-haiku-5-5both validated againstBookInsightPayload(13 s each). A new unit test replays Anthropic's two rejection messages verbatim.