Unified · Split
| @@ -211,6 +211,8 @@ func ConvertClaudeRequestToAntigravity(modelName string, inputRawJSON []byte, _ · 210 unmodified lines | |||
| 211 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) | 211 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) |
| 212 | tool, _ = sjson.Delete(tool, "strict") | 212 | tool, _ = sjson.Delete(tool, "strict") |
| 213 | tool, _ = sjson.Delete(tool, "input_examples") | 213 | tool, _ = sjson.Delete(tool, "input_examples") |
| 214 | tool, _ = sjson.Delete(tool, "type") | ||
| 215 | tool, _ = sjson.Delete(tool, "cache_control") | ||
| 214 | toolsJSON, _ = sjson.SetRaw(toolsJSON, "0.functionDeclarations.-1", tool) | 216 | toolsJSON, _ = sjson.SetRaw(toolsJSON, "0.functionDeclarations.-1", tool) |
| 215 | toolDeclCount++ | 217 | toolDeclCount++ |
| 216 | } | 218 | } |
| @@ -95,7 +95,7 @@ func ConvertClaudeResponseToOpenAIResponses(ctx context.Context, modelName strin · 94 unmodified lines | |||
| 95 | } | 95 | } |
| 96 | } | 96 | } |
| 97 | // response.created | 97 | // response.created |
| 98 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null,"instructions":""}}` | 98 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null,"output":[]}}` |
| 99 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) | 99 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) |
| 100 | created, _ = sjson.Set(created, "response.id", st.ResponseID) | 100 | created, _ = sjson.Set(created, "response.id", st.ResponseID) |
| 101 | created, _ = sjson.Set(created, "response.created_at", st.CreatedAt) | 101 | created, _ = sjson.Set(created, "response.created_at", st.CreatedAt) |
| @@ -197,11 +197,11 @@ func ConvertClaudeResponseToOpenAIResponses(ctx context.Context, modelName strin · 95 unmodified lines | |||
| 197 | if st.ReasoningActive { | 197 | if st.ReasoningActive { |
| 198 | if t := d.Get("thinking"); t.Exists() { | 198 | if t := d.Get("thinking"); t.Exists() { |
| 199 | st.ReasoningBuf.WriteString(t.String()) | 199 | st.ReasoningBuf.WriteString(t.String()) |
| 200 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"text":""}` | 200 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"delta":""}` |
| 201 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) | 201 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) |
| 202 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningItemID) | 202 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningItemID) |
| 203 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) | 203 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) |
| 204 | msg, _ = sjson.Set(msg, "text", t.String()) | 204 | msg, _ = sjson.Set(msg, "delta", t.String()) |
| 205 | out = append(out, emitEvent("response.reasoning_summary_text.delta", msg)) | 205 | out = append(out, emitEvent("response.reasoning_summary_text.delta", msg)) |
| 206 | } | 206 | } |
| 207 | } | 207 | } |
| @@ -134,6 +134,8 @@ func ConvertClaudeRequestToCLI(modelName string, inputRawJSON []byte, _ bool) [] · 133 unmodified lines | |||
| 134 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) | 134 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) |
| 135 | tool, _ = sjson.Delete(tool, "strict") | 135 | tool, _ = sjson.Delete(tool, "strict") |
| 136 | tool, _ = sjson.Delete(tool, "input_examples") | 136 | tool, _ = sjson.Delete(tool, "input_examples") |
| 137 | tool, _ = sjson.Delete(tool, "type") | ||
| 138 | tool, _ = sjson.Delete(tool, "cache_control") | ||
| 137 | var toolDeclaration any | 139 | var toolDeclaration any |
| 138 | if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { | 140 | if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { |
| 139 | tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) | 141 | tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) |
| @@ -127,6 +127,8 @@ func ConvertClaudeRequestToGemini(modelName string, inputRawJSON []byte, _ bool) · 126 unmodified lines | |||
| 127 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) | 127 | tool, _ = sjson.SetRaw(tool, "parametersJsonSchema", inputSchema) |
| 128 | tool, _ = sjson.Delete(tool, "strict") | 128 | tool, _ = sjson.Delete(tool, "strict") |
| 129 | tool, _ = sjson.Delete(tool, "input_examples") | 129 | tool, _ = sjson.Delete(tool, "input_examples") |
| 130 | tool, _ = sjson.Delete(tool, "type") | ||
| 131 | tool, _ = sjson.Delete(tool, "cache_control") | ||
| 130 | var toolDeclaration any | 132 | var toolDeclaration any |
| 131 | if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { | 133 | if err := json.Unmarshal([]byte(tool), &toolDeclaration); err == nil { |
| 132 | tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) | 134 | tools[0].FunctionDeclarations = append(tools[0].FunctionDeclarations, toolDeclaration) |
| @@ -117,7 +117,7 @@ func ConvertGeminiResponseToOpenAIResponses(_ context.Context, modelName string, · 116 unmodified lines | |||
| 117 | st.CreatedAt = time.Now().Unix() | 117 | st.CreatedAt = time.Now().Unix() |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null}}` | 120 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null,"output":[]}}` |
| 121 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) | 121 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) |
| 122 | created, _ = sjson.Set(created, "response.id", st.ResponseID) | 122 | created, _ = sjson.Set(created, "response.id", st.ResponseID) |
| 123 | created, _ = sjson.Set(created, "response.created_at", st.CreatedAt) | 123 | created, _ = sjson.Set(created, "response.created_at", st.CreatedAt) |
| @@ -160,11 +160,11 @@ func ConvertGeminiResponseToOpenAIResponses(_ context.Context, modelName string, · 36 unmodified lines | |||
| 160 | } | 160 | } |
| 161 | if t := part.Get("text"); t.Exists() && t.String() != "" { | 161 | if t := part.Get("text"); t.Exists() && t.String() != "" { |
| 162 | st.ReasoningBuf.WriteString(t.String()) | 162 | st.ReasoningBuf.WriteString(t.String()) |
| 163 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"text":""}` | 163 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"delta":""}` |
| 164 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) | 164 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) |
| 165 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningItemID) | 165 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningItemID) |
| 166 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) | 166 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) |
| 167 | msg, _ = sjson.Set(msg, "text", t.String()) | 167 | msg, _ = sjson.Set(msg, "delta", t.String()) |
| 168 | out = append(out, emitEvent("response.reasoning_summary_text.delta", msg)) | 168 | out = append(out, emitEvent("response.reasoning_summary_text.delta", msg)) |
| 169 | } | 169 | } |
| 170 | return true | 170 | return true |
| @@ -143,7 +143,7 @@ func ConvertOpenAIChatCompletionsResponseToOpenAIResponses(ctx context.Context, · 142 unmodified lines | |||
| 143 | st.ReasoningTokens = 0 | 143 | st.ReasoningTokens = 0 |
| 144 | st.UsageSeen = false | 144 | st.UsageSeen = false |
| 145 | // response.created | 145 | // response.created |
| 146 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null}}` | 146 | created := `{"type":"response.created","sequence_number":0,"response":{"id":"","object":"response","created_at":0,"status":"in_progress","background":false,"error":null,"output":[]}}` |
| 147 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) | 147 | created, _ = sjson.Set(created, "sequence_number", nextSeq()) |
| 148 | created, _ = sjson.Set(created, "response.id", st.ResponseID) | 148 | created, _ = sjson.Set(created, "response.id", st.ResponseID) |
| 149 | created, _ = sjson.Set(created, "response.created_at", st.Created) | 149 | created, _ = sjson.Set(created, "response.created_at", st.Created) |
| @@ -216,11 +216,11 @@ func ConvertOpenAIChatCompletionsResponseToOpenAIResponses(ctx context.Context, · 66 unmodified lines | |||
| 216 | } | 216 | } |
| 217 | // Append incremental text to reasoning buffer | 217 | // Append incremental text to reasoning buffer |
| 218 | st.ReasoningBuf.WriteString(rc.String()) | 218 | st.ReasoningBuf.WriteString(rc.String()) |
| 219 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"text":""}` | 219 | msg := `{"type":"response.reasoning_summary_text.delta","sequence_number":0,"item_id":"","output_index":0,"summary_index":0,"delta":""}` |
| 220 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) | 220 | msg, _ = sjson.Set(msg, "sequence_number", nextSeq()) |
| 221 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningID) | 221 | msg, _ = sjson.Set(msg, "item_id", st.ReasoningID) |
| 222 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) | 222 | msg, _ = sjson.Set(msg, "output_index", st.ReasoningIndex) |
| 223 | msg, _ = sjson.Set(msg, "text", rc.String()) | 223 | msg, _ = sjson.Set(msg, "delta", rc.String()) |
| 224 | out = append(out, emitRespEvent("response.reasoning_summary_text.delta", msg)) | 224 | out = append(out, emitRespEvent("response.reasoning_summary_text.delta", msg)) |
| 225 | } | 225 | } |
| 226 | 226 | ||