From 4184059707b9cc1f38f97ee5374630a023fa5067 Mon Sep 17 00:00:00 2001 From: "40005415C\\Administrator" Date: Wed, 15 Apr 2026 14:24:00 +0800 Subject: [PATCH] fix: use json.RawMessage for Instructions field in OpenAIResponsesResponse The Instructions field in OpenAIResponsesResponse was defined as string, but upstream providers may return null or non-string JSON values for this field. This causes json.Unmarshal to fail, resulting in HTTP 500 on /v1/responses endpoint. Other fields in the same struct (Status, ToolChoice, Truncation, etc.) already use json.RawMessage. The request-side DTO (openai_request.go) also defines Instructions as json.RawMessage. This fix aligns the response-side with both patterns. Co-Authored-By: Claude Opus 4.6 --- dto/openai_response.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dto/openai_response.go b/dto/openai_response.go index b5bc7b0dabf..c3673bb4f0d 100644 --- a/dto/openai_response.go +++ b/dto/openai_response.go @@ -272,7 +272,7 @@ type OpenAIResponsesResponse struct { Status json.RawMessage `json:"status"` Error any `json:"error,omitempty"` IncompleteDetails *IncompleteDetails `json:"incomplete_details,omitempty"` - Instructions string `json:"instructions"` + Instructions json.RawMessage `json:"instructions"` MaxOutputTokens int `json:"max_output_tokens"` Model string `json:"model"` Output []ResponsesOutput `json:"output"`