|
|
|
@@ -343,7 +343,24 @@ type ResponsesOutput struct { |
|
|
|
Size string `json:"size"` |
|
|
|
CallId string `json:"call_id,omitempty"` |
|
|
|
Name string `json:"name,omitempty"` |
|
|
|
Arguments string `json:"arguments,omitempty"` |
|
|
|
// Arguments can be a JSON string or a JSON object (e.g. gpt-5.4 returns objects for some tools) |
|
|
|
Arguments json.RawMessage `json:"arguments,omitempty"` |
|
|
|
} |
|
|
|
|
|
|
|
// GetArguments returns the arguments as a plain string. |
|
|
|
// If the upstream sent a JSON string value, the inner string is returned (unescaped). |
|
|
|
// If the upstream sent a JSON object, the raw JSON bytes are returned as a string. |
|
|
|
func (r *ResponsesOutput) GetArguments() string { |
|
|
|
if len(r.Arguments) == 0 { |
|
|
|
return "" |
|
|
|
} |
|
|
|
if r.Arguments[0] == '"' { |
|
|
|
var s string |
|
|
|
if err := json.Unmarshal(r.Arguments, &s); err == nil { |
|
|
|
return s |
|
|
|
} |
|
|
|
} |
|
|
|
return string(r.Arguments) |
|
|
|
} |
|
|
|
|
|
|
|
type ResponsesOutputContent struct { |
|
|
|
|