types

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSpeechRequestOptions

func NewSpeechRequestOptions(body io.ReadCloser) mo.Result[SpeechRequestOptions]

func NewVoicesRequestOptions added in v0.1.0

func NewVoicesRequestOptions(request *http.Request) mo.Result[VoicesRequestOptions]

Types

type ListVoicesResponse added in v0.1.0

type ListVoicesResponse struct {
	Voices []Voice `json:"voices"`
}

type OpenAISpeechRequestOptions

type OpenAISpeechRequestOptions struct {
	// (required) One of the available TTS models.
	Model string `json:"model"`
	// (required) The text to generate audio for.
	Input string `json:"input"`
	// (required) The voice to use when generating the audio.
	Voice string `json:"voice"`

	// The format to audio in.
	// Supported formats are mp3, opus, aac, flac, wav, and pcm.
	// mp3 is the default.
	ResponseFormat string `json:"response_format,omitempty"`
	// The speed of the generated audio.
	// Select a value from 0.25 to 4.0.
	// 1.0 is the default.
	Speed int `json:"speed,omitempty"`

	// Extension: allows you to add custom content to body.
	ExtraBody map[string]any `json:"extra_body,omitempty"`
}

OpenAISpeechRequestOptions represent API parameters refer to https://platform.openai.com/docs/api-reference/audio/createSpeech

type SpeechRequestOptions

type SpeechRequestOptions struct {
	OpenAISpeechRequestOptions

	Backend string `json:"backend"`
	Model   string `json:"model"`
	// contains filtered or unexported fields
}

func (SpeechRequestOptions) AsBuffer

func (o SpeechRequestOptions) AsBuffer() mo.Option[*bytes.Buffer]

func (SpeechRequestOptions) AsMap

func (o SpeechRequestOptions) AsMap() map[string]any

type Voice added in v0.1.0

type Voice struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`

	Labels map[string]any `json:"labels"`
	Tags   []string       `json:"tags"`

	Languages         []VoiceLanguage `json:"languages"`
	Formats           []VoiceFormat   `json:"formats"`
	CompatibleModels  []string        `json:"compatible_models"`
	PredefinedOptions map[string]any  `json:"predefined_options"`
	PreviewAudioURL   string          `json:"preview_audio_url"`
}

type VoiceCommonLabels added in v0.1.0

type VoiceCommonLabels struct {
	Gender       string `json:"gender"`
	Language     string `json:"language"`
	LanguageCode string `json:"language_code"`
	SampleRate   int    `json:"sample_rate"`
}

type VoiceFormat added in v0.1.0

type VoiceFormat struct {
	Name       string `json:"name"`
	Extension  string `json:"extension"`
	MimeType   string `json:"mime_type"`
	SampleRate int    `json:"sample_rate,omitempty"`
	Bitrate    int    `json:"bitrate,omitempty"`
	FormatCode string `json:"format_code,omitempty"` // For provider-specific format codes
}

type VoiceLabelKey added in v0.1.0

type VoiceLabelKey = string
const (
	VoiceLabelKeyAge    VoiceLabelKey = "age"
	VoiceLabelKeyGender VoiceLabelKey = "gender"
	VoiceLabelKeyAccent VoiceLabelKey = "accent"
	VoiceLabelKeyType   VoiceLabelKey = "type"
)

type VoiceLanguage added in v0.1.0

type VoiceLanguage struct {
	Title string `json:"title"`
	Code  string `json:"code"`
}

type VoicesRequestOptions added in v0.1.0

type VoicesRequestOptions struct {
	Backend string `json:"provider"`

	ExtraQuery url.Values `json:"extra_query"`
}

Jump to

Keyboard shortcuts

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