Skip to content

Commit 4576f99

Browse files
committed
feat(translator): map Claude web search tool type to Codex web_search - Added special handling to replace `web_search_20250305` tool type with `{"type":"web_search"}` in Claude request processing.
1 parent c945e35 commit 4576f99

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/translator/codex/claude/codex_claude_request.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,12 @@ func ConvertClaudeRequestToCodex(modelName string, inputRawJSON []byte, _ bool)
186186
shortMap := buildShortNameMap(names)
187187
for i := 0; i < len(toolResults); i++ {
188188
toolResult := toolResults[i]
189+
// Special handling: map Claude web search tool to Codex web_search
190+
if toolResult.Get("type").String() == "web_search_20250305" {
191+
// Replace the tool content entirely with {"type":"web_search"}
192+
template, _ = sjson.SetRaw(template, "tools.-1", `{"type":"web_search"}`)
193+
continue
194+
}
189195
tool := toolResult.Raw
190196
tool, _ = sjson.Set(tool, "type", "function")
191197
// Apply shortened name if needed

0 commit comments

Comments
 (0)