Skip to content

Fix Tool.Function.Parameters alias serialization - #796

Open
MathewKioko wants to merge 1 commit into
ollama:mainfrom
MathewKioko:fix/defs-alias-serialization
Open

MathewKioko wants to merge 1 commit into
ollama:mainfrom
MathewKioko:fix/defs-alias-serialization

Conversation

@MathewKioko

Copy link
Copy Markdown

Direct Tool.model_dump() serialized the \ field as 'defs' (the field name) instead of '' (the JSON Schema alias), breaking \ targets for anyone serializing tools manually.

Add a wrap serializer on Tool.Function.Parameters that renames 'defs' to '' in the dumped output, matching the request path already used by ChatRequest. Updates existing tests that asserted the old (buggy) 'defs' key.

Fixes #787

Direct Tool.model_dump() serialized the \ field as 'defs' (the field
name) instead of '\' (the JSON Schema alias), breaking \ targets
for anyone serializing tools manually.

Add a wrap serializer on Tool.Function.Parameters that renames 'defs' to
'\' in the dumped output, matching the request path used by
ChatRequest. Updates existing tests that asserted the old (buggy) 'defs'
key.

Fixes ollama#787

This branch has not been deployed

No deployments
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.

Tool.model_dump() serializes the $defs parameter alias as 'defs' (nested-in-request dumps do not)

2 participants