backend

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewJSONResponseError

func NewJSONResponseError(statusCode int, responseBody io.Reader) mo.Result[*JSONResponseError]

func NewSpeechRequestOptions added in v0.0.3

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

func NewTextResponseError

func NewTextResponseError(statusCode int, responseBody io.Reader) mo.Result[*TextResponseError]

func Speech

func Speech(c echo.Context) mo.Result[any]

Types

type JSONResponseError

type JSONResponseError struct {
	StatusCode int    `json:"status_code"`
	Message    string `json:"message"`
	// contains filtered or unexported fields
}

func (*JSONResponseError) Error

func (r *JSONResponseError) Error() string

type OpenAISpeechRequestOptions added in v0.0.3

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"`
}

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

type SpeechRequestOptions added in v0.0.3

type SpeechRequestOptions struct {
	OpenAISpeechRequestOptions

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

func (SpeechRequestOptions) AsBuffer added in v0.0.3

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

func (SpeechRequestOptions) AsMap added in v0.0.3

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

type TextResponseError

type TextResponseError struct {
	StatusCode int    `json:"status_code"`
	Body       string `json:"body"`
}

func (*TextResponseError) Error

func (r *TextResponseError) Error() string

Jump to

Keyboard shortcuts

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