types: allow tool function parameters with a single type or an array of types (#9434)

This commit is contained in:
Alex Rozgo 2025-04-07 15:27:01 -06:00 committed by GitHub
parent 249fbbe52f
commit 2f723ac2d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 149 additions and 27 deletions

View file

@ -372,24 +372,24 @@ func TestGenerateChat(t *testing.T) {
Type string `json:"type"`
Required []string `json:"required"`
Properties map[string]struct {
Type string `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
Type api.PropertyType `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
} `json:"properties"`
}{
Type: "object",
Required: []string{"location"},
Properties: map[string]struct {
Type string `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
Type api.PropertyType `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
}{
"location": {
Type: "string",
Type: api.PropertyType{"string"},
Description: "The city and state",
},
"unit": {
Type: "string",
Type: api.PropertyType{"string"},
Enum: []string{"celsius", "fahrenheit"},
},
},
@ -469,24 +469,24 @@ func TestGenerateChat(t *testing.T) {
Type string `json:"type"`
Required []string `json:"required"`
Properties map[string]struct {
Type string `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
Type api.PropertyType `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
} `json:"properties"`
}{
Type: "object",
Required: []string{"location"},
Properties: map[string]struct {
Type string `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
Type api.PropertyType `json:"type"`
Description string `json:"description"`
Enum []string `json:"enum,omitempty"`
}{
"location": {
Type: "string",
Type: api.PropertyType{"string"},
Description: "The city and state",
},
"unit": {
Type: "string",
Type: api.PropertyType{"string"},
Enum: []string{"celsius", "fahrenheit"},
},
},