-
Notifications
You must be signed in to change notification settings - Fork 3.2k
feat(ai): add convertDataPart option to convertToModelMessages #9720
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
lgrammel
merged 21 commits into
vercel:main
from
Drew-Garratt:feat/custom-context-attachments-9617
Oct 23, 2025
+949
−44
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
69c2184
feat(ai): add convertDataPart option to convertToModelMessages
Drew-Garratt c0af1e1
fix: removed uncessary cast
Drew-Garratt 038b9ca
fix: simplify isDataUIPart logic
Drew-Garratt 2a8d6df
fix: moved type guards to convert-to-model-message and added tools ge…
Drew-Garratt 61bfcd4
fix: removed exports from index
Drew-Garratt 4d7f4d4
fix: restore final filter
Drew-Garratt 59982cc
Merge branch 'main' into feat/custom-context-attachments-9617
lgrammel 6575643
prettier
lgrammel 71dbaaa
inline snapshots. remove redundant test
lgrammel 4252192
simplify
lgrammel 09ea674
reexpose helpers, change generics
lgrammel 9222067
undefined means no convert
lgrammel 057af56
docs and undefined
lgrammel 2db2223
test
lgrammel 3ac9862
assistant
lgrammel bf23fc8
simpler
lgrammel 1cbab60
simpler
lgrammel 2bb0450
comment
lgrammel fe5cd74
docs fix
lgrammel 127e7ef
Update content/docs/07-reference/02-ai-sdk-ui/31-convert-to-model-mes…
lgrammel 2522e00
0prettier
lgrammel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| 'ai': patch | ||
| --- | ||
|
|
||
| feat(ai): add convertDataPart option to convertToModelMessages | ||
|
|
||
| Add optional convertDataPart callback for converting custom data parts (URLs, code files, etc.) to text or file parts that models can process. Fully type-safe using existing UIMessage generics. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love this, thanks for putting this together @Drew-Garratt 👏
Would it be worth to include an example here for toggling on custom tools that a user might turn on when sending the user message? In this way, it can be stored alongside the other user message parts inside the DB and one can easily restore this context when the user wants to edit the message later on.