fix(ai-proxy): preserve empty Claude tool inputs (#3799)

Signed-off-by: Betula-L <6059935+Betula-L@users.noreply.github.com>
Co-authored-by: Betula-L <6059935+Betula-L@users.noreply.github.com>
This commit is contained in:
Betula-L
2026-05-09 06:35:35 -07:00
committed by GitHub
parent b77a074831
commit 6d50e2da42
4 changed files with 77 additions and 5 deletions

View File

@@ -70,9 +70,9 @@ type claudeChatMessageContent struct {
Source *claudeChatMessageContentSource `json:"source,omitempty"`
CacheControl map[string]interface{} `json:"cache_control,omitempty"`
// Tool use fields
Id string `json:"id,omitempty"` // For tool_use
Name string `json:"name,omitempty"` // For tool_use
Input map[string]interface{} `json:"input,omitempty"` // For tool_use
Id string `json:"id,omitempty"` // For tool_use
Name string `json:"name,omitempty"` // For tool_use
Input *map[string]interface{} `json:"input,omitempty"` // For tool_use
// Tool result fields
ToolUseId string `json:"tool_use_id,omitempty"` // For tool_result
Content *claudeChatMessageContentWr `json:"content,omitempty"` // For tool_result - can be string or array
@@ -622,7 +622,7 @@ func (c *claudeProvider) buildClaudeTextGenRequest(origRequest *chatCompletionRe
Type: "tool_use",
Id: tc.Id,
Name: tc.Function.Name,
Input: inputMap,
Input: &inputMap,
})
}