Skip to content

feat(ai): pass result provider metadata across the stream#13181

Merged
aayush-kapoor merged 4 commits intomainfrom
aayush/ui-result-metadata
Mar 6, 2026
Merged

feat(ai): pass result provider metadata across the stream#13181
aayush-kapoor merged 4 commits intomainfrom
aayush/ui-result-metadata

Conversation

@aayush-kapoor
Copy link
Collaborator

Background

faced the issue while implementing #13157 - for multiturn conversation, the item Ids weren't properly being mapped within aisdk and there was a mismatch between what we were sending to the openai api and what was expected.

we were attching the same tool call id as the tool-call object to the tool-result which caused duplicate ID found errors + incorrect ids sent for certain parts

Summary

  • since the item_id for tool_search_output is propagated via providerMetadata - we ensure the providerMetadata is preserved through the UI stream.
  • similar change needed for generate text as well

Manual Verification

will be done in #13157

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)

@tigent tigent bot added ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/ui anything UI related bug Something isn't working as documented labels Mar 6, 2026

// Bundle size limits in bytes
const LIMIT = 570 * 1024;
const LIMIT = 580 * 1024;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what's our "policy" on bundle size limits - do we just increase this based on demand? cc @lgrammel who just mentioned bundle size in another call earlier today

@aayush-kapoor aayush-kapoor merged commit 210ed3d into main Mar 6, 2026
18 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/ui-result-metadata branch March 6, 2026 20:52
@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 Mar 6, 2026
vercel-ai-sdk bot pushed a commit that referenced this pull request Mar 6, 2026
## Background

faced the issue while implementing #13157 - for multiturn conversation,
the item Ids weren't properly being mapped within aisdk and there was a
mismatch between what we were sending to the openai api and what was
expected.

we were attching the same tool call id as the `tool-call` object to the
`tool-result` which caused duplicate ID found errors + incorrect ids
sent for certain parts

## Summary

- since the item_id for tool_search_output is propagated via
providerMetadata - we ensure the providerMetadata is preserved through
the UI stream.
- similar change needed for generate text as well

## Manual Verification

will be done in #13157 

## Checklist

- [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)
@vercel-ai-sdk vercel-ai-sdk bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label Mar 6, 2026
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Mar 6, 2026

✅ Backport PR created: #13184

vercel-ai-sdk bot added a commit that referenced this pull request Mar 6, 2026
…13184)

This is an automated backport of #13181 to the release-v6.0 branch. FYI
@aayush-kapoor

Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Mar 6, 2026

🚀 Published in:

Package Version
ai 7.0.0-beta.7
@ai-sdk/angular 3.0.0-beta.7
@ai-sdk/langchain 3.0.0-beta.7
@ai-sdk/llamaindex 3.0.0-beta.7
@ai-sdk/react 4.0.0-beta.7
@ai-sdk/rsc 3.0.0-beta.7
@ai-sdk/svelte 5.0.0-beta.7
@ai-sdk/vue 4.0.0-beta.7

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

Labels

ai/core core functions like generateText, streamText, etc. Provider utils, and provider spec. ai/ui anything UI related bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants