-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
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
Both the ChatCompletionStream and AssistantStream classes have a fromReadableStream method that the new ResponseStream class is missing.
I'm looking for something similar to allow my client side web application to request a response stream from my server and convert that to a ResponseStream instance.
For example:
const sendMessage = async (input) => {
controller.current = new AbortController();
const response = await fetch(`${API_URL}/responses`, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
input,
}),
signal: controller.current.signal,
})
const stream = ResponseStream.fromReadableStream(response.body)
handleReadableStream(stream)
};
Also open to alternative recommendations if this is not the pattern to use moving forward. There is currently a lack of guidance in the docs on how to integrate with the new responses API when it comes to frontend applications.
Additional context
No response