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

feature request: Audio splitter

Open JFixby opened this issue 1 year ago • 0 comments

By default, the Whisper API only supports files that are less than 25 MB. If you have an audio file that is longer than that, you will need to break it up into chunks of 25 MB's or less or used a compressed audio format. To get the best performance, it is required to avoid breaking the audio up mid-sentence as this may cause some context to be lost.

Good solution would be to add flag AutoSplit to the AudioRequest struct:

req := openai.AudioRequest{
		Model:    openai.Whisper1,
		FilePath: file,
                Autosplit: true,  
	}
	resp, err := c.CreateTranscription(ctx, req)
	if err != nil {
		fmt.Printf("Transcription error: %v\n", err)
		return
	}

JFixby avatar Dec 20 '23 15:12 JFixby