diff --git a/relay/channel/claude/dto.go b/relay/channel/claude/dto.go index e2a898e..8f289e3 100644 --- a/relay/channel/claude/dto.go +++ b/relay/channel/claude/dto.go @@ -31,9 +31,9 @@ type ClaudeMessage struct { } type Tool struct { - Name string `json:"name"` - Description string `json:"description,omitempty"` - InputSchema InputSchema `json:"input_schema"` + Name string `json:"name"` + Description string `json:"description,omitempty"` + InputSchema map[string]interface{} `json:"input_schema"` } type InputSchema struct { diff --git a/relay/channel/claude/relay-claude.go b/relay/channel/claude/relay-claude.go index 031f825..47abe31 100644 --- a/relay/channel/claude/relay-claude.go +++ b/relay/channel/claude/relay-claude.go @@ -63,15 +63,21 @@ func RequestOpenAI2ClaudeMessage(textRequest dto.GeneralOpenAIRequest) (*ClaudeR for _, tool := range textRequest.Tools { if params, ok := tool.Function.Parameters.(map[string]any); ok { - claudeTools = append(claudeTools, Tool{ + claudeTool := Tool{ Name: tool.Function.Name, Description: tool.Function.Description, - InputSchema: InputSchema{ - Type: params["type"].(string), - Properties: params["properties"], - Required: params["required"], - }, - }) + } + claudeTool.InputSchema = make(map[string]interface{}) + claudeTool.InputSchema["type"] = params["type"].(string) + claudeTool.InputSchema["properties"] = params["properties"] + claudeTool.InputSchema["required"] = params["required"] + for s, a := range params { + if s == "type" || s == "properties" || s == "required" { + continue + } + claudeTool.InputSchema[s] = a + } + claudeTools = append(claudeTools, claudeTool) } }