OmniVoice API Reference¶
The omnivoice subpackage provides STT and TTS provider adapters.
STT Provider¶
NewSTTProvider¶
Creates a new STT provider with the given API key.
NewSTTProviderFromEnv¶
Creates a new STT provider using OPENAI_API_KEY.
NewSTTProviderFromClient¶
Creates a provider from an existing OpenAI client.
Methods¶
Name¶
Transcribe¶
func (p *STTProvider) Transcribe(ctx context.Context, audio []byte, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)
TranscribeFile¶
func (p *STTProvider) TranscribeFile(ctx context.Context, filePath string, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)
TranscribeURL¶
Returns ErrURLTranscriptionNotSupported (OpenAI doesn't support URL transcription).
func (p *STTProvider) TranscribeURL(ctx context.Context, url string, config stt.TranscriptionConfig) (*stt.TranscriptionResult, error)
TTS Provider¶
NewTTSProvider¶
Creates a new TTS provider with the given API key.
NewTTSProviderFromEnv¶
Creates a new TTS provider using OPENAI_API_KEY.
NewTTSProviderFromClient¶
Creates a provider from an existing OpenAI client.
Methods¶
Name¶
ListVoices¶
GetVoice¶
Synthesize¶
func (p *TTSProvider) Synthesize(ctx context.Context, text string, config tts.SynthesisConfig) (*tts.SynthesisResult, error)
SynthesizeStream¶
func (p *TTSProvider) SynthesizeStream(ctx context.Context, text string, config tts.SynthesisConfig) (<-chan tts.StreamChunk, error)
Constants¶
Voice Constants¶
const (
VoiceAlloy = "alloy"
VoiceAsh = "ash"
VoiceBallad = "ballad"
VoiceCoral = "coral"
VoiceEcho = "echo"
VoiceFable = "fable"
VoiceOnyx = "onyx"
VoiceNova = "nova"
VoiceSage = "sage"
VoiceShimmer = "shimmer"
VoiceVerse = "verse"
VoiceMarin = "marin"
VoiceCedar = "cedar"
)