Repository navigation
fix: collect the answer from assistant stream events - #19
Conversation
The stream loop kept the text of thinking events, so a cancelled run published the model's reasoning as its summary. Read the text blocks of assistant events instead.
The mock streams yielded bare text objects that the SDK never emits, which hid the thinking-versus-assistant mix-up. Add assistant and thinking event factories and a cancelled-run case where only assistant text may reach the summary.
🦋 Changeset detectedLatest commit: 410bb3c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
Description
The stream loop in the runner kept every event with a string
textfield, but in the SDK's event vocabulary those arethinkingandtaskevents; the answer arrives asassistantevents with the text nested inmessage.content[]. On finished runsrun.wait().resultmasked this, but a cancelled run (which is whattimeoutproduces) has noresult, so the step published the model's reasoning assummary. The loop now concatenates the text blocks ofassistantevents and ignores everything else.Related Issues
None.
Checklist
.github/–only changes).github/–only community or template updates)Screenshots (if applicable)
N/A
Additional Notes
The test mocks now yield the SDK's real
SDKMessageshapes instead of{ text }objects, and two new tests cover a cancelled run with mixedthinking,assistantandtaskevents, and the path whereresultwins over the streamed text.dist/is rebuilt.Summary by CodeRabbit