fix: add automatic text-start and text-end events#13
Open
titanism2197 wants to merge 1 commit intoHelicone:mainfrom
Open
fix: add automatic text-start and text-end events#13titanism2197 wants to merge 1 commit intoHelicone:mainfrom
titanism2197 wants to merge 1 commit intoHelicone:mainfrom
Conversation
|
@juliettech13 please have a look, need to fix broken streams |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Automatically emit text-start and text-end events for proper stream lifecycle management.
Solves the "text part text-0 not found" error by eliminating the need for manual stream wrapping.
Problem
Users encountered "text part text-0 not found" errors in production:
Root Cause: text-delta events were emitted without preceding text-start events, causing the AI SDK to fail when tracking text parts.
Previous Workaround: Users had to manually wrap streams:
Solution
Text lifecycle events are now emitted automatically following AI SDK standards:
Changes
Event Flow
All tests passing: 77/77 ✅
Files Changed
src/helicone-language-model.ts(+36/-1 lines)src/tests/tool-calling.test.ts(+2/-2 lines)Total: 38 insertions(+), 3 deletions(-) ✨
Breaking Changes
This matches AI SDK's expected event flow and is the correct behavior.
Migration
No code changes needed for end users. Events are added automatically.
If you were using a custom ensureTextParts wrapper, you can now remove it!
Fixes