diff --git a/pkg/bridge/ai/provider/anthropic/provider.go b/pkg/bridge/ai/provider/anthropic/provider.go index 56eed5aa6..399ff9dc6 100644 --- a/pkg/bridge/ai/provider/anthropic/provider.go +++ b/pkg/bridge/ai/provider/anthropic/provider.go @@ -326,6 +326,7 @@ func (p *Provider) convertMessageNewParams(req openai.ChatCompletionRequest) ant case openai.ChatMessageRoleAssistant: // tool use, check if there are tool calls if len(msg.ToolCalls) > 0 { + ylog.Debug("openai request", "tool_calls", len(msg.ToolCalls)) toolUses := make([]anthropic.ContentBlockParamUnion, 0) for i, toolCall := range msg.ToolCalls { ylog.Debug("openai request", "tool_calls", len(msg.ToolCalls)) diff --git a/pkg/bridge/ai/service_test.go b/pkg/bridge/ai/service_test.go index 23a41de26..e50d106d5 100644 --- a/pkg/bridge/ai/service_test.go +++ b/pkg/bridge/ai/service_test.go @@ -51,12 +51,31 @@ func TestOpSystemPrompt(t *testing.T) { args: args{ prompt: "", op: SystemPromptOpOverwrite, - req: openai.ChatCompletionRequest{}, + req: openai.ChatCompletionRequest{ + Messages: []openai.ChatCompletionMessage{}, + }, }, want: openai.ChatCompletionRequest{ Messages: []openai.ChatCompletionMessage{}, }, }, + { + name: "empty system prompt should not overwrite", + args: args{ + prompt: "", + op: SystemPromptOpOverwrite, + req: openai.ChatCompletionRequest{ + Messages: []openai.ChatCompletionMessage{ + {Role: "system", Content: "hello"}, + }, + }, + }, + want: openai.ChatCompletionRequest{ + Messages: []openai.ChatCompletionMessage{ + {Role: "system", Content: "hello"}, + }, + }, + }, { name: "overwrite with not empty system prompt", args: args{