[PR #11705] tools: support anyOf types #13608

Closed
opened 2026-04-13 00:31:10 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/ollama/ollama/pull/11705

State: closed
Merged: Yes


afaik gpt-oss is the first model that meaningfully transforms tool function definitions in its template. We found that relatively common definitions that include anyOf were not working because the template was assuming that types were always defined via a type field.

anyOf allows for fully recursive types, so I exposed a toTypeScriptType() function to handle this recursive logic in go and keep the templates cleaner. The gpt-oss templates will need to be updated to use this.

We should keep building out our function definition support to more fully support the parts of json schema that make sense for this use case, but in the meantime this will unblock some users (e.g., zed's ollama integration w/ gpt-oss). Probably the most urgent is proper array support

**Original Pull Request:** https://github.com/ollama/ollama/pull/11705 **State:** closed **Merged:** Yes --- afaik gpt-oss is the first model that meaningfully transforms tool function definitions in its template. We found that relatively common definitions that include `anyOf` were not working because the template was assuming that types were always defined via a `type` field. anyOf allows for fully recursive types, so I exposed a `toTypeScriptType()` function to handle this recursive logic in go and keep the templates cleaner. The gpt-oss templates will need to be updated to use this. We should keep building out our function definition support to more fully support the parts of json schema that make sense for this use case, but in the meantime this will unblock some users (e.g., zed's ollama integration w/ gpt-oss). Probably the most urgent is proper array support
GiteaMirror added the pull-request label 2026-04-13 00:31:10 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#13608