Documentation
¶
Overview ¶
Package openaiaudio contains OpenAI-backed audio helpers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeOggOpus ¶
DecodeOggOpus reads an Ogg stream and emits each Opus packet payload.
func NormalizeAudioURL ¶
NormalizeAudioURL appends an OpenAI audio endpoint suffix to an API base URL.
Types ¶
type TTSClient ¶
type TTSClient struct {
// contains filtered or unexported fields
}
TTSClient synthesizes speech through the OpenAI audio speech API.
func NewTTSClient ¶
NewTTSClient constructs a TTS client with sane defaults for missing model values.
func (*TTSClient) Synthesize ¶
Synthesize sends text to the speech API and returns the streamed audio body.
func (*TTSClient) SynthesizeFormat ¶
func (c *TTSClient) SynthesizeFormat(ctx context.Context, text, responseFormat string) (io.ReadCloser, error)
SynthesizeFormat sends text to the speech API using the requested format and returns the streamed audio body.
type WhisperClient ¶
type WhisperClient struct {
// contains filtered or unexported fields
}
WhisperClient transcribes audio through the OpenAI transcription API.
func NewWhisperClient ¶
func NewWhisperClient(apiKey, apiBase, model, prompt string) *WhisperClient
NewWhisperClient constructs a transcription client with sane defaults.
func (*WhisperClient) Transcribe ¶
Transcribe uploads the provided audio file and returns the recognized text.