Skip to content

Accept stringified primitives in Generable conversions - #185

Open
james-333i wants to merge 1 commit into
huggingface:mainfrom
james-333i:fix/tool-argument-string-coercion
Open

Accept stringified primitives in Generable conversions#185
james-333i wants to merge 1 commit into
huggingface:mainfrom
james-333i:fix/tool-argument-string-coercion

Conversation

@james-333i

Copy link
Copy Markdown

Some chat templates stringify every tool-call argument value, so models emit {"count": "5"} where the schema declares an integer. The strict kind checks in the primitive Generable initializers then throw typeMismatch, which makes any non-String tool argument unusable on those backends.

Accept string content in the Bool, Int, Float, Double, and Decimal initializers when it parses unambiguously as the target type. Native kinds decode exactly as before, and unparseable strings still throw typeMismatch. Integer parsing accepts only whole-number values.

Some chat templates stringify every tool-call argument value, so models
emit {"count": "5"} where the schema declares an integer. The strict
kind checks in the primitive Generable initializers then throw
typeMismatch, which makes any non-String tool argument unusable on
those backends.

Accept string content in the Bool, Int, Float, Double, and Decimal
initializers when it parses unambiguously as the target type. Native
kinds decode exactly as before, and unparseable strings still throw
typeMismatch. Integer parsing accepts only whole-number values.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants