Skip to content

fix(ai): doStream should reflect transformed values#13113

Merged
aayush-kapoor merged 4 commits intomainfrom
aayush/stream-transform
Mar 5, 2026
Merged

fix(ai): doStream should reflect transformed values#13113
aayush-kapoor merged 4 commits intomainfrom
aayush/stream-transform

Conversation

@aayush-kapoor
Copy link
Collaborator

@aayush-kapoor aayush-kapoor commented Mar 5, 2026

Background

when a user uses experimental_transform, the doStream telemetry span ai.streamText.doStream was recording untransformed values for ai.response.text and ai.response.providerMetadata

this is also so that with the new telemetry approach, we have feature parity with how the new flow works when setting the spans. see comment

Summary

essentially split the doStreamSpan so that we set ai.response.text, reasoning and providerMetadata by reading from the fully-processed recordedSteps

Manual Verification

na

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/telemetry bug Something isn't working as documented labels Mar 5, 2026
@aayush-kapoor aayush-kapoor merged commit 5ceed7d into main Mar 5, 2026
18 checks passed
@aayush-kapoor aayush-kapoor deleted the aayush/stream-transform branch March 5, 2026 20:53
@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 5, 2026
vercel-ai-sdk bot pushed a commit that referenced this pull request Mar 5, 2026
## Background

when a user uses `experimental_transform`, the doStream telemetry span
`ai.streamText.doStream` was recording untransformed values for
`ai.response.text` and `ai.response.providerMetadata`

this is also so that with the new telemetry approach, we have feature
parity with how the new flow works when setting the spans. see
[comment](https://github.com/vercel/ai/pull/13051/changes/#r2885652481)

## Summary

essentially split the doStreamSpan so that we set ai.response.text,
reasoning and providerMetadata by reading from the fully-processed
recordedSteps

## Manual Verification

na

## 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 5, 2026
@vercel-ai-sdk
Copy link
Contributor

vercel-ai-sdk bot commented Mar 5, 2026

✅ Backport PR created: #13133

vercel-ai-sdk bot added a commit that referenced this pull request Mar 5, 2026
This is an automated backport of #13113 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 5, 2026

🚀 Published in:

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

@gr2m gr2m removed the ai/telemetry label Mar 6, 2026
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. bug Something isn't working as documented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants