Skip to content

fix(ai-sdk-provider): support image file parts in Responses converter - #835

Open
akshatshahh wants to merge 1 commit into
databricks:mainfrom
akshatshahh:fix/806-responses-input-image
Open

akshatshahh wants to merge 1 commit into
databricks:mainfrom
akshatshahh:fix/806-responses-input-image

Conversation

@akshatshahh

Copy link
Copy Markdown

Fixes #806.

The Responses converter rejected every non-text user content part, so an image file part threw UnsupportedFunctionalityError before any request was sent, even though responses-api-types.ts already declares input_image.

User-message file parts with an image/* media type now map to { type: 'input_image', image_url }, mirroring the FMAPI converter. The URL helper passes through URL objects, http(s) strings, and existing data URLs, builds a base64 data URL from a plain base64 string, and base64-encodes byte arrays in chunks. Non-image file parts still throw, now naming the media type.

Test plan:

  • Added three tests in tests/responses-convert.test.ts: base64 image part, URL / URL string / byte-array parts, and the non-image throw. All three failed on the original code and pass with the fix.
  • Full ai-sdk-provider suite: 248 passed. npm run typecheck clean. npm run lint: 0 errors.

AI assistance was used to implement this change; I reviewed and tested every change.

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.

ai-sdk-provider: Responses converter rejects image file parts (no input_image support)

1 participant