Skip to content

fix: Fix TTFT in AI SDK v6#2120

Merged
Luca Forstner (lforst) merged 7 commits into
mainfrom
lforst/validate-github-issue
Jun 16, 2026
Merged

fix: Fix TTFT in AI SDK v6#2120
Luca Forstner (lforst) merged 7 commits into
mainfrom
lforst/validate-github-issue

Conversation

@lforst

Copy link
Copy Markdown
Member

The problem was that we treated literally the first chunk from the stream as the TTFB trigger, however the first chunk is not necessarily (and actually) LLM tokens, but instead bookkeeping stuff so it doesn't make sense to use it for TTFB.

Instead we now wait for the first chunk that can be attributed to LLM output (text-delta, tool-calls, ...)

Fixes #2110

);
case "raw":
return rawValueHasAISDKContent(part.rawValue);
default:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think you're right about file, but not about the others. We only want to track chunks that actually stem from models/generation not any sort of bookkeeping/protocol.

@lforst Luca Forstner (lforst) merged commit c04beca into main Jun 16, 2026
48 checks passed
@lforst Luca Forstner (lforst) deleted the lforst/validate-github-issue branch June 16, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wrapAISDK streaming: time_to_first_token measures stream framing, not first token (two distinct bugs)

2 participants