Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nlaz
Copy link
Contributor

@nlaz nlaz commented Oct 23, 2025

Background

Now that v6 has image-url and file-url this makes it simple to support pdfs and images in the anthropic tool results blocks.

This PR adds support for url-based PDFs in tool results. This is a pretty common way to fetch and insert PDF without blowing up the context window. Anthropic's API handles this out of the box. Just needed to update the types on the tool result handling.

Summary

Uses the image-url and file-url types to send urls to the provider.

Manual Verification

Used the example files to verify the functionality.

Checklist

  • 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

Hacky Backport: #9503
Related: #9041
Fixes #8014

@nlaz
Copy link
Contributor Author

nlaz commented Oct 23, 2025

@gr2m or @lgrammel mind taking a look when you have time? This is my third attempt to get this in and is pretty important to our team. Appreciate your support 🙏

@lgrammel
Copy link
Collaborator

Lots of lines changed, can you try reverting the lockfile?

@lgrammel
Copy link
Collaborator

changes look good for v6

@nlaz
Copy link
Contributor Author

nlaz commented Oct 23, 2025

@lgrammel All done

@lgrammel lgrammel self-assigned this Oct 23, 2025
@lgrammel
Copy link
Collaborator

@nlaz can you allow changes by maintainers on this PR? i want to make a few minor tweaks to the tests

@lgrammel
Copy link
Collaborator

Or you can update the test file. Ideally in the future edits by maintainers would be allowed.

@lgrammel lgrammel changed the title feat(provider/anthropic) Url support for pdfs and images in tool results feat(provider/anthropic): Url support for pdfs and images in tool results Oct 23, 2025
@nlaz
Copy link
Contributor Author

nlaz commented Oct 23, 2025

Test has been updated. I don't have the option in GH to open it up to edit by maintainers. Maybe its because the fork was made on a org account. Will try PRs via personal account in the future

@lgrammel lgrammel merged commit 7c4328e into vercel:main Oct 23, 2025
17 of 18 checks passed
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.

Unable to pass PDF files from the tool calls

3 participants