use tool calls for json_object compatability with chat completions#174
Merged
Ken Jiang (knjiang) merged 1 commit intomainfrom Apr 2, 2026
Conversation
d3b5472 to
75c2619
Compare
75c2619 to
95b7883
Compare
Comment on lines
-1285
to
-1292
| ResponseFormatType::JsonObject => Ok(JsonOutputFormat { | ||
| schema: serde_json::from_value(json!({ | ||
| "type": "object", | ||
| "additionalProperties": false | ||
| })) | ||
| .expect("static JSON object is always a valid Map"), | ||
| json_output_format_type: JsonOutputFormatType::JsonSchema, | ||
| }), |
Contributor
Author
There was a problem hiding this comment.
in practice:
JsonOutputFormat {
schema: serde_json::from_value(json!({
"type": "object",
"additionalProperties": false
}))
.expect("static JSON object is always a valid Map"),
json_output_format_type: JsonOutputFormatType::JsonSchema,
}),always emits an empty dictionary of {}, i thought we could set it like the above but no it doesn't work :(
see the transforms JSON showing we now produce abritrary json
aswink
approved these changes
Apr 2, 2026
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.

This takes a similar approach to what we do in the proxy -> https://github.com/braintrustdata/braintrust-proxy/blob/main/packages/proxy/src/proxy.ts#L2791
i made the change and then ran
make regenerate-failed-transformswhich resulted in all the updated JSON files.