Commit Graph

9 Commits

Author SHA1 Message Date
Devon Rifkin c9304f161a
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-12-29 06:39:49 -06:00
Jeffrey Morgan d9a78742ad
tools: loosen tool argument parsing (#11509) 2025-12-29 06:39:45 -06:00
Jeffrey Morgan 30ec10cb05
tools: fix parsing issue when a tool name is a substring of another (#11456)
Co-authored-by: frob <rick+github@frob.com.au>
2025-12-29 06:39:44 -06:00
Jeffrey Morgan 9cf8ef9371
tools: fix parsing tool calls with empty arguments, missing required fields (#11233) 2025-12-29 06:39:39 -06:00
Jeffrey Morgan 829e77105a
tools: return empty arguments object instead of null (#11113) 2025-12-29 06:38:16 -06:00
Jeffrey Morgan 1dc12706c5
tools: fix parsing tool calls without any parameters (#11101)
Fixes issue where tool calls that don't expect any parameters were
not being parsed. This also fixes two additional issues: one where
2+ tool calls would not be correctly parsed, and cases where tool calls
with invalid parameters would still get parsed
2025-12-29 06:38:15 -06:00
Jeffrey Morgan 2d86651985
tools: loosen tool parsing to allow for more formats (#11030) 2025-12-29 06:38:14 -06:00
Parth Sareen 75e3b372a1
tools: relax JSON parse constraints for tool calling (#10872) 2025-12-29 06:38:09 -06:00
Parth Sareen 8cd2b6478e
tools: refactor tool call parsing and enable streaming (#10415) 2025-12-29 06:38:07 -06:00