types: include the 'items' and '$defs' fields to properly handle "array" types (#10091)

---------

Co-authored-by: Parth Sareen <parth.sareen@ollama.com>
This commit is contained in:
Tom Sheffler 2025-04-09 17:45:49 -07:00 committed by GitHub
parent 42ecb9f138
commit ef65174df2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View file

@ -163,6 +163,7 @@ func (t *ToolCallFunctionArguments) String() string {
type Tool struct {
Type string `json:"type"`
Items any `json:"items,omitempty"`
Function ToolFunction `json:"function"`
}
@ -213,9 +214,12 @@ type ToolFunction struct {
Description string `json:"description"`
Parameters struct {
Type string `json:"type"`
Defs any `json:"$defs,omitempty"`
Items any `json:"items,omitempty"`
Required []string `json:"required"`
Properties map[string]struct {
Type PropertyType `json:"type"`
Items any `json:"items,omitempty"`
Description string `json:"description"`
Enum []any `json:"enum,omitempty"`
} `json:"properties"`