Skip to content

chore (ai): Add finishReason as a promise on StreamObjectResult to match StreamTextResult #6161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

danielamitay
Copy link

@lgrammel Please take a look! This pull request simply adds Promise<FinishReason> to the StreamObject result to match how it is in StreamText, for parity/to make it easier to use the finish reason when streaming an object.

Background

  • Promise<FinishReason> is an available property on StreamText API, but not StreamObject API.
  • Without this change, devs need to observe the full stream instead of just await'ing a promise

Summary

  • Update StreamObjectResult interface
  • Add implementation bookkeeping for finishReasonPromise

Verification

  • Finish reason promise is implemented exactly the same as other promises for streamObject
  • Finish reason promise logic is the same as the promise in streamText
  • Using this new promise, it resolves as expected with the other promises

@danielamitay
Copy link
Author

Let me know if there is something I am missing or if there is a process to getting reviewed that I am unaware of 🙏

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.

1 participant