File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -31,9 +31,9 @@ type ClaudeMessage struct {
31
31
}
32
32
33
33
type Tool struct {
34
- Name string `json:"name"`
35
- Description string `json:"description,omitempty"`
36
- InputSchema InputSchema `json:"input_schema"`
34
+ Name string `json:"name"`
35
+ Description string `json:"description,omitempty"`
36
+ InputSchema map [ string ] interface {} `json:"input_schema"`
37
37
}
38
38
39
39
type InputSchema struct {
Original file line number Diff line number Diff line change @@ -63,15 +63,21 @@ func RequestOpenAI2ClaudeMessage(textRequest dto.GeneralOpenAIRequest) (*ClaudeR
63
63
64
64
for _ , tool := range textRequest .Tools {
65
65
if params , ok := tool .Function .Parameters .(map [string ]any ); ok {
66
- claudeTools = append ( claudeTools , Tool {
66
+ claudeTool := Tool {
67
67
Name : tool .Function .Name ,
68
68
Description : tool .Function .Description ,
69
- InputSchema : InputSchema {
70
- Type : params ["type" ].(string ),
71
- Properties : params ["properties" ],
72
- Required : params ["required" ],
73
- },
74
- })
69
+ }
70
+ claudeTool .InputSchema = make (map [string ]interface {})
71
+ claudeTool .InputSchema ["type" ] = params ["type" ].(string )
72
+ claudeTool .InputSchema ["properties" ] = params ["properties" ]
73
+ claudeTool .InputSchema ["required" ] = params ["required" ]
74
+ for s , a := range params {
75
+ if s == "type" || s == "properties" || s == "required" {
76
+ continue
77
+ }
78
+ claudeTool .InputSchema [s ] = a
79
+ }
80
+ claudeTools = append (claudeTools , claudeTool )
75
81
}
76
82
}
77
83
You can’t perform that action at this time.
0 commit comments