openai / openai-node

Official JavaScript / TypeScript library for the OpenAI API
https://www.npmjs.com/package/openai
Apache License 2.0
7.97k stars 870 forks source link

Add streaming support for Audio #1048

Closed NinoSkopac closed 1 month ago

NinoSkopac commented 2 months ago

Confirm this is a feature request for the Node library and not the underlying OpenAI API.

Describe the feature or improvement you're requesting

Currently, it's easy to stream in Python as per docs, but I haven't been able to pull it off in Node. Concurrency works just great, tho.

we need a response.stream_to_file("output.mp3")

Additional context

No response

RobertCraigie commented 2 months ago

we need a response.stream_to_file("output.mp3")

Unfortunately it's unlikely that we can add something like that as JS doesn't always have file system access or a runtime independent way of writing files.

Currently, it's easy to stream in Python as per docs, but I haven't been able to pull it off in Node.

I'm curious what you've tried so far in case there's any docs we could update?

We do have an example script here that shows how to stream the response to a file.

RobertCraigie commented 1 month ago

I'm going to close this due to the above mentioned reasons, please let us know if there are any docs we could improve here!