Documentation
¶
Overview ¶
Copyright (c) Roman Atachiants and contributors. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for details. Package audio contains the optional service contracts used by llmux's transcription and speech endpoints.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Speaker ¶
type Speaker interface {
// Speak synthesizes speech audio for the request text.
Speak(context.Context, SpeechRequest) (Speech, error)
}
Speaker is the optional service behind POST /audio/speech.
type SpeakerFunc ¶
type SpeakerFunc func(context.Context, SpeechRequest) (Speech, error)
SpeakerFunc adapts a function to Speaker.
func (SpeakerFunc) Speak ¶
func (f SpeakerFunc) Speak(ctx context.Context, req SpeechRequest) (Speech, error)
Speak implements Speaker.
type Speech ¶
type Speech struct {
Data []byte // Encoded audio bytes.
MIMEType string // Declared content type when known.
Format string // Container format when MIMEType is empty.
}
Speech is the complete audio returned by a Speaker. The handler applies the configured output limit before writing it to the client.
type SpeechRequest ¶
type SpeechRequest struct {
Model string // Target model or voice backend from the JSON body.
Input string // Text to synthesize.
Voice string // Selected voice identifier.
Instructions string // Optional delivery instructions.
ResponseFormat string // Audio container format, such as mp3 or wav.
StreamFormat string // Delivery mode: audio or sse.
Speed float64 // Playback speed multiplier between 0.25 and 4.
}
SpeechRequest is the normalized JSON input for a Speaker.
type Transcriber ¶
type Transcriber interface {
// Transcribe turns uploaded audio into a transcript.
Transcribe(context.Context, TranscriptionRequest) (Transcription, error)
}
Transcriber is the optional service behind POST /audio/transcriptions. It is deliberately separate from Agent because transcription does not have conversational event semantics.
type TranscriberFunc ¶
type TranscriberFunc func(context.Context, TranscriptionRequest) (Transcription, error)
TranscriberFunc adapts a function to Transcriber.
func (TranscriberFunc) Transcribe ¶
func (f TranscriberFunc) Transcribe(ctx context.Context, req TranscriptionRequest) (Transcription, error)
Transcribe implements Transcriber.
type TranscriptSegment ¶
type TranscriptSegment struct {
ID int `json:"id"` // Segment index in the verbose transcript.
Start float64 `json:"start"` // Segment start time in seconds.
End float64 `json:"end"` // Segment end time in seconds.
Text string `json:"text"` // Transcript text for the segment.
}
TranscriptSegment is the portion of a verbose transcription with timing.
type Transcription ¶
type Transcription struct {
Text string // Full transcript text.
Language string // Detected or declared source language.
Duration float64 // Audio duration in seconds for verbose responses.
Segments []TranscriptSegment // Timed segments for verbose_json responses.
}
Transcription is the normalized result of a transcription service.
type TranscriptionRequest ¶
type TranscriptionRequest struct {
Model string // Target model or voice name from the multipart form.
Filename string // Original uploaded filename, when provided.
MIMEType string // Declared content type of the uploaded file.
Data []byte // Raw audio bytes read from the uploaded file.
Prompt string // Optional transcription prompt.
Language string // Optional source language hint.
ResponseFormat string // Requested wire format: json, text, or verbose_json.
Temperature *float64 // Optional sampling temperature between 0 and 1.
}
TranscriptionRequest is the normalized multipart input for a Transcriber. Data is owned by the request and must be treated as immutable by the service after Transcribe returns.