audioproviders

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package audioproviders implements audio.tts.Generation and audio.stt.SpeechToText for supported providers. Add a new file per provider (elevenlabs_tts.go, deepgram_stt.go, …) — no other package needs updating.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAISTT

type OpenAISTT struct {
	// contains filtered or unexported fields
}

OpenAISTT transcribes audio using OpenAI Whisper.

func NewOpenAISTT

func NewOpenAISTT(apiKey string, opts ...OpenAISTTOption) *OpenAISTT

NewOpenAISTT creates an OpenAI Whisper STT client. audioData passed to Transcribe may be MP3, MP4, MPEG, MPGA, M4A, WAV, or WebM.

func (*OpenAISTT) Provider

func (c *OpenAISTT) Provider() string

func (*OpenAISTT) Transcribe

func (c *OpenAISTT) Transcribe(ctx context.Context, audioData []byte) (*stt.Response, error)

type OpenAISTTOption

type OpenAISTTOption func(*OpenAISTT)

OpenAISTTOption configures an OpenAISTT client.

func WithSTTBaseURL

func WithSTTBaseURL(url string) OpenAISTTOption

func WithSTTHTTPClient

func WithSTTHTTPClient(hc *http.Client) OpenAISTTOption

func WithSTTLanguage

func WithSTTLanguage(lang string) OpenAISTTOption

func WithSTTModel

func WithSTTModel(model string) OpenAISTTOption

type OpenAITTS

type OpenAITTS struct {
	// contains filtered or unexported fields
}

OpenAITTS generates speech using the OpenAI TTS API.

func NewOpenAITTS

func NewOpenAITTS(apiKey string, opts ...OpenAITTSOption) *OpenAITTS

NewOpenAITTS creates an OpenAI TTS client. Supported models: tts-1, tts-1-hd. Voices: alloy, echo, fable, onyx, nova, shimmer.

func (*OpenAITTS) GenerateAudio

func (c *OpenAITTS) GenerateAudio(ctx context.Context, text string) (*tts.Response, error)

func (*OpenAITTS) ListVoices

func (c *OpenAITTS) ListVoices(_ context.Context) ([]tts.Voice, error)

func (*OpenAITTS) Provider

func (c *OpenAITTS) Provider() string

type OpenAITTSOption

type OpenAITTSOption func(*OpenAITTS)

OpenAITTSOption configures an OpenAITTS client.

func WithTTSBaseURL

func WithTTSBaseURL(url string) OpenAITTSOption

func WithTTSFormat

func WithTTSFormat(fmt string) OpenAITTSOption

func WithTTSHTTPClient

func WithTTSHTTPClient(hc *http.Client) OpenAITTSOption

func WithTTSModel

func WithTTSModel(model string) OpenAITTSOption

func WithTTSVoice

func WithTTSVoice(voice string) OpenAITTSOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL