openai-java icon indicating copy to clipboard operation
openai-java copied to clipboard

createTranscription needs a stream api

Open xmkevin opened this issue 1 year ago • 1 comments

Now, createTranscription has filePath and Audio parameter to upload audio file. but if I am the server, I just want to forward the client audio stream to chatgpt, I need to save the Multipart input stream to a disk file and then pass it to the sdk, then the sdk read it from the disk, which needs more IO operations. In order to avoid the IO operations, I need another api for createTranscription, thanks.

xmkevin avatar Jan 07 '24 06:01 xmkevin

before I can suggest a solution to this - you are getting the stream in which format? like how are you getting the audio in a stream? @xmkevin

Ideally how you can do it, do the entire process in batches, since there's no stream API by OpenAI, i m sure you can divide your stream into 30 second clip - save it (in memory not disk) - transcribe it (then save to db)- and destroy the file, Yes, it is tacky but certainly doable.

namankhurpia avatar Jan 08 '24 05:01 namankhurpia