Conversation
A tool parameter declared as a free-form object (`type = "object"` with
no `properties`, or `properties = {}`) no longer gets the whole request
rejected by OpenAI with `Invalid schema for function ...: Extra required
key 'body' supplied`. Strict mode requires every object to be closed with
a fixed set of keys, and a free-form object or a map type (one that sets
`additionalProperties` to `true` or to a schema) cannot be expressed that
way. JP used to close such objects anyway, which either failed the
request or left the model able to send only `{}` and silently dropped a
map type's extra keys.
Tools with an open object are now sent with `strict: false` on OpenAI,
OpenRouter, the OpenAI-compatible providers (llama.cpp, vLLM), and
Anthropic, with the schema passed through as declared. Structured output
follows the same rule on OpenAI, OpenRouter and Cerebras. Anthropic has
no unconstrained structured output mode, so a `--schema` containing an
open object is refused with a clear error instead of being answered with
`{}`.
The check also follows `anyOf`, `oneOf` and `allOf` branches. A nullable
free-form object (`Optional[dict]`) is detected as open, while a
nullable typed object (`Optional[Model]`) no longer knocks its tool out
of strict mode just because the wrapper declares no `type` of its own.
Signed-off-by: Jean Mertz <git@jeanmertz.com>
This branch has not been deployed
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.
A tool parameter declared as a free-form object (
type = "object"with noproperties, orproperties = {}) no longer gets the whole request rejected by OpenAI withInvalid schema for function ...: Extra required key 'body' supplied. Strict mode requires every object to be closed with a fixed set of keys, and a free-form object or a map type (one that setsadditionalPropertiestotrueor to a schema) cannot be expressed that way. JP used to close such objects anyway, which either failed the request or left the model able to send only{}and silently dropped a map type's extra keys.Tools with an open object are now sent with
strict: falseon OpenAI, OpenRouter, the OpenAI-compatible providers (llama.cpp, vLLM), and Anthropic, with the schema passed through as declared. Structured output follows the same rule on OpenAI, OpenRouter and Cerebras. Anthropic has no unconstrained structured output mode, so a--schemacontaining an open object is refused with a clear error instead of being answered with{}.The check also follows
anyOf,oneOfandallOfbranches. A nullable free-form object (Optional[dict]) is detected as open, while a nullable typed object (Optional[Model]) no longer knocks its tool out of strict mode just because the wrapper declares notypeof its own.