-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Confirm this is a feature request for the Node library and not the underlying OpenAI API.
- This is a feature request for the Node library
Describe the feature or improvement you're requesting
When using the Response API in streaming mode, it seems like many developers have to re-implement their own function that aggregate the chunks into a Response object, so they can then handle this object to display the response in the UI.
It is easy to rebuilt the text part, but when you want to manage all the differents parts, it becomes quite a big function.
And I see in the code that there is the complete function that is already written by the openai team, taking care of accumulating all the chunks into a well former Response object.
#accumulateResponse(event: ResponseStreamEvent): Response
line 203-288: https://github.com/openai/openai-node/blob/master/src/lib/responses/ResponseStream.ts
Would it be possible to make the accumulatedObject accessible on every received chunk?
Or at least to make a utils function that we can reuse to aggregate every chunk into a Response object?
(or perhaps I am wrong in trying to recompose a Response Object ?)
Additional context
No response