From fed3665c708b99bd283658ef8436fa28ff79b095 Mon Sep 17 00:00:00 2001 From: jmorganca Date: Thu, 6 Nov 2025 13:49:17 -0800 Subject: [PATCH] fix tests --- middleware/openai_test.go | 8 +------- server/routes_debug_test.go | 2 +- server/routes_generate_test.go | 16 ++-------------- server/routes_harmony_streaming_test.go | 16 ++-------------- 4 files changed, 6 insertions(+), 36 deletions(-) diff --git a/middleware/openai_test.go b/middleware/openai_test.go index a78ee8b91d..e5cb245b0e 100644 --- a/middleware/openai_test.go +++ b/middleware/openai_test.go @@ -484,13 +484,7 @@ func TestChatMiddleware(t *testing.T) { Function: api.ToolFunction{ Name: "get_weather", Description: "Get the current weather", - Parameters: struct { - Type string `json:"type"` - Defs any `json:"$defs,omitempty"` - Items any `json:"items,omitempty"` - Required []string `json:"required"` - Properties map[string]api.ToolProperty `json:"properties"` - }{ + Parameters: api.ToolFunctionParameters{ Type: "object", Required: []string{"location"}, Properties: map[string]api.ToolProperty{ diff --git a/server/routes_debug_test.go b/server/routes_debug_test.go index bf822c68b6..6f9104c393 100644 --- a/server/routes_debug_test.go +++ b/server/routes_debug_test.go @@ -363,7 +363,7 @@ func TestChatDebugRenderOnly(t *testing.T) { DebugRenderOnly: true, }, expectDebug: true, - expectTemplate: "[{\"type\":\"function\",\"function\":{\"name\":\"get_weather\",\"description\":\"Get weather information\",\"parameters\":{\"type\":\"\",\"required\":null,\"properties\":null}}}]user: Get the weather\n", + expectTemplate: "[{\"type\":\"function\",\"function\":{\"name\":\"get_weather\",\"description\":\"Get weather information\",\"parameters\":{\"type\":\"\",\"properties\":null}}}]user: Get the weather\n", }, } diff --git a/server/routes_generate_test.go b/server/routes_generate_test.go index ecd1d2d632..ed5922f2d2 100644 --- a/server/routes_generate_test.go +++ b/server/routes_generate_test.go @@ -485,13 +485,7 @@ func TestGenerateChat(t *testing.T) { Function: api.ToolFunction{ Name: "get_weather", Description: "Get the current weather", - Parameters: struct { - Type string `json:"type"` - Defs any `json:"$defs,omitempty"` - Items any `json:"items,omitempty"` - Required []string `json:"required"` - Properties map[string]api.ToolProperty `json:"properties"` - }{ + Parameters: api.ToolFunctionParameters{ Type: "object", Required: []string{"location"}, Properties: map[string]api.ToolProperty{ @@ -585,13 +579,7 @@ func TestGenerateChat(t *testing.T) { Function: api.ToolFunction{ Name: "get_weather", Description: "Get the current weather", - Parameters: struct { - Type string `json:"type"` - Defs any `json:"$defs,omitempty"` - Items any `json:"items,omitempty"` - Required []string `json:"required"` - Properties map[string]api.ToolProperty `json:"properties"` - }{ + Parameters: api.ToolFunctionParameters{ Type: "object", Required: []string{"location"}, Properties: map[string]api.ToolProperty{ diff --git a/server/routes_harmony_streaming_test.go b/server/routes_harmony_streaming_test.go index 8e58ad9629..1fb41ff48c 100644 --- a/server/routes_harmony_streaming_test.go +++ b/server/routes_harmony_streaming_test.go @@ -26,13 +26,7 @@ func getTestTools() []api.Tool { Function: api.ToolFunction{ Name: "get_weather", Description: "Get the current weather in a given location", - Parameters: struct { - Type string `json:"type"` - Defs any `json:"$defs,omitempty"` - Items any `json:"items,omitempty"` - Required []string `json:"required"` - Properties map[string]api.ToolProperty `json:"properties"` - }{ + Parameters: api.ToolFunctionParameters{ Type: "object", Required: []string{"location"}, Properties: map[string]api.ToolProperty{ @@ -49,13 +43,7 @@ func getTestTools() []api.Tool { Function: api.ToolFunction{ Name: "calculate", Description: "Calculate a mathematical expression", - Parameters: struct { - Type string `json:"type"` - Defs any `json:"$defs,omitempty"` - Items any `json:"items,omitempty"` - Required []string `json:"required"` - Properties map[string]api.ToolProperty `json:"properties"` - }{ + Parameters: api.ToolFunctionParameters{ Type: "object", Required: []string{"expression"}, Properties: map[string]api.ToolProperty{