Skip to content

fix(server): keep input_image parts in /v1/responses input - #359

Open
pcbeingused333 wants to merge 1 commit into
OpenCSGs:mainfrom
pcbeingused333:fix/responses-input-image
Open

pcbeingused333 wants to merge 1 commit into
OpenCSGs:mainfrom
pcbeingused333:fix/responses-input-image

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

POST /v1/responses silently drops input_image content parts. The model receives only the text, with no error. /v1/chat/completions already passes image_url parts through, and /v1/messages converts image blocks, so this is the remaining endpoint.

The cause is that both input converters (responsesInputItemToOpenAIMessage for the tool path and responsesInputToMessages for the plain path) build message content with responsesContentText, which returns an empty string for an input_image part.

User messages that contain input_image parts with an image_url (http(s) or data URL) are now converted to OpenAI content parts: text and image_url, in their original order, keeping detail when present. Messages without images still use plain string content, as do system, developer and assistant messages. Images referenced only by file_id are still skipped, since there is no file store to resolve them.

Testing

go test ./internal/server -run TestResponses -count=1 passes. The new TestResponsesInputPreservesInputImageParts covers both converters and fails without the fix because the content is the text-only string.

AI assistance was used to prepare the patch and regression test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant