Skip to content

fix(open-responses): map non-image file parts to input_file - #15212

Merged
aayush-kapoor merged 2 commits into
mainfrom
aayush/openresponses-file
May 13, 2026
Merged

aayush-kapoor merged 2 commits into
mainfrom
aayush/openresponses-file

Conversation

@aayush-kapoor

@aayush-kapoor aayush-kapoor commented May 12, 2026 •

Copy link
Copy Markdown
Collaborator

Background

#13843

file parts that are not images (e.g., application/pdf) are silently dropped from the request body. The SDK logs a warning (unsupported file content type), but the resulting API request is sent without the file data, often causing the model to respond that no document was provided.

The OpenAI Responses API supports non-image files via the input_file part

Summary

adds support for non-image file inputs, especially PDFs, by mapping them to OpenAI Responses input_file parts:

  • URL-backed files become { type: 'input_file', file_url: '...' }
  • base64/data-backed files become { type: 'input_file', filename, file_data: 'data:<mediaType>;base64,...' }

Manual Verification

verified by running the cli examples

Checklist

  • All commits are signed (PRs with unsigned commits cannot be merged)
  • Tests have been added / updated (for bug fixes / features)
  • Documentation has been added / updated (for bug fixes / features)
  • A patch changeset for relevant packages has been added (for bug fixes / features - run pnpm changeset in the project root)
  • I have reviewed this pull request (self-review)

Related Issues

fixes #13843

Co-authored-by: shivamtiwari3 33183708+shivamtiwari3@users.noreply.github.com

@aayush-kapoor aayush-kapoor added the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 12, 2026
@aayush-kapoor
aayush-kapoor merged commit 52d2e30 into main May 13, 2026
19 checks passed
@aayush-kapoor
aayush-kapoor deleted the aayush/openresponses-file branch May 13, 2026 16:08
github-actions Bot added a commit that referenced this pull request May 13, 2026
@github-actions github-actions Bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Backport to release-v6.0 created but has conflicts: #15259

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
@ai-sdk/open-responses 2.0.0-canary.42

aayush-kapoor added a commit that referenced this pull request May 13, 2026
…#15259)

This is an automated backport of #15212 to the release-v6.0 branch. FYI
@aayush-kapoor
This backport has conflicts that need to be resolved manually.

### `git cherry-pick` output

```
Auto-merging packages/open-responses/src/responses/convert-to-open-responses-input.test.ts
Auto-merging packages/open-responses/src/responses/convert-to-open-responses-input.ts
CONFLICT (content): Merge conflict in packages/open-responses/src/responses/convert-to-open-responses-input.ts
Auto-merging packages/open-responses/src/responses/open-responses-language-model.test.ts
error: could not apply 52d2e30... fix(open-responses): map non-image file parts to input_file (#15212)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
```

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
gr2m pushed a commit that referenced this pull request Jun 5, 2026
## Background

#13843

file parts that are not images (e.g., application/pdf) are silently
dropped from the request body. The SDK logs a warning (unsupported file
content type), but the resulting API request is sent without the file
data, often causing the model to respond that no document was provided.

The OpenAI Responses API supports non-image files via the input_file
part

## Summary

adds support for non-image file inputs, especially PDFs, by mapping them
to OpenAI Responses input_file parts:

- URL-backed files become `{ type: 'input_file', file_url: '...' }`
- base64/data-backed files become `{ type: 'input_file', filename,
file_data: 'data:<mediaType>;base64,...' }`

## Manual Verification

verified by running the cli examples

## Checklist

- [x] All commits are signed (PRs with unsigned commits cannot be
merged)
- [x] Tests have been added / updated (for bug fixes / features)
- [ ] Documentation has been added / updated (for bug fixes / features)
- [x] A _patch_ changeset for relevant packages has been added (for bug
fixes / features - run `pnpm changeset` in the project root)
- [x] I have reviewed this pull request (self-review)

## Related Issues

fixes #13843 

Co-authored-by: shivamtiwari3
<33183708+shivamtiwari3@users.noreply.github.com>

This branch was successfully deployed

1 active deployment
Preview — a1ade574 Deployed May 12, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@ai-sdk/open-responses drops non-image file parts (e.g., PDF)

2 participants