Repository navigation
Read JSON literals the argument schema admits under combinators - #535
Merged
Merged
Conversation
XML parameter values are unquoted text. Under a schema with no single
non-string type, such as {"not": {"type": "string"}}, an
if/then/else that picks integer or string, a type union, or no type at
all, a value such as -2500 should read as the number the schema admits.
A quoted JSON string should change only when the schema rejects every
string.
ToolArgumentNormalization kept the text of any value whose schema had
no single non-string type: not, if/then/else, a union that admits a
string, or no type. So an XML value -2500 under {"not": {"type":
"string"}} stayed the string "-2500", which the schema rejects.
A three-valued check now reads whether the schema admits a scalar
(type, nullable, enum, const, numeric and string bounds, pattern, not,
allOf, anyOf, oneOf, if/then/else, local references within the existing
budget). A text that spells a JSON literal becomes that literal when the
schema admits it and rejects the text as a string. In the XML dialects,
where every value is text, a number also wins when both readings are
admitted and the text is its exact JSON spelling, so 001 or +5 stay
text. Anything the check cannot decide keeps the text. keepsText now
agrees, so a streamed value is held whenever a literal could replace it.
6 of 7 tasks
Gemma marks a string value explicitly, and its numeric typing of those values is opt-in (DARKBLOOM_GEMMA_SCHEMA_COERCION). The literal reading added for combinator and untyped schemas also reached Gemma through numericReading and convertParameterValue, so with the switch on a quoted "3" under anyOf integer or boolean became 3. Gemma now passes a policy that never reads such a literal, as before, and a test pins its values under string-rejecting schemas.
jonathan308
added a commit
to Layr-Labs/d-inference
that referenced
this pull request
Nov 24, 2026
Moves the SDK pin from 689f2f00bf to cba8c22177, the merge commit that landed Layr-Labs/mlx-swift-lm#535 on main. Its tree is #535's tree on main 52f81662a6.
This was referenced Nov 24, 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.
Summary
ToolArgumentNormalizationkept the text of any value whose schema had no single non-string type:not,if/then/else, a union that admits a string, or no type. So an XML parameter value-2500under{"not": {"type": "string"}}stayed the string"-2500", which the schema rejects.A three-valued check now reads whether the schema admits a scalar:
type,nullable,enum,const, numeric and string bounds,pattern,not,allOf,anyOf,oneOf,if/then/else, and local references within the existing budget.001or+5stay text.keepsTextagrees, so a streamed value is held whenever a literal could replace it.4a736b32c2689f2f00bfTest plan
main): fails the new tests.AI usage
accurately describes the code changes.