ollama/template
Devon Rifkin 30f8a68c4c tools: support anyOf types
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
2025-08-05 16:46:24 -07:00
..
testdata
alfred.gotmpl
alfred.json
alpaca.gotmpl
alpaca.json
chatml.gotmpl
chatml.json
chatqa.gotmpl
chatqa.json
codellama-70b-instruct.gotmpl
codellama-70b-instruct.json
command-r.gotmpl
command-r.json
falcon-instruct.gotmpl
falcon-instruct.json
gemma-instruct.gotmpl
gemma-instruct.json
gemma3-instruct.gotmpl
gemma3-instruct.json
granite-instruct.gotmpl
granite-instruct.json
index.json
llama2-chat.gotmpl
llama2-chat.json
llama3-instruct.gotmpl
llama3-instruct.json
magicoder.gotmpl
magicoder.json
mistral-instruct.gotmpl
mistral-instruct.json
openchat.gotmpl
openchat.json
phi-3.gotmpl
phi-3.json
solar-instruct.gotmpl
solar-instruct.json
starcoder2-instruct.gotmpl
starcoder2-instruct.json
template.go tools: support anyOf types 2025-08-05 16:46:24 -07:00
template_test.go template: add tool result compatibility (#11294) 2025-07-07 15:53:42 -07:00
vicuna.gotmpl
vicuna.json
zephyr.gotmpl
zephyr.json