Documentation
¶
Index ¶
- Constants
- Variables
- func WriteJSONTrailer(w io.Writer)
- func WriteTextTrailer(w io.Writer)
- type DownloadModelRequest
- type Event
- type Model
- type Segment
- type SegmentWriter
- type Timestamp
- type TranscribeMultipartRequest
- type TranscribeRequest
- type Transcription
- type TranscriptionSummary
- type TranslateMultipartRequest
- type TranslateRequest
Constants ¶
const ( DownloadStreamProgressType = "download.progress" DownloadStreamErrorType = "download.error" DownloadStreamDoneType = "download.done" )
const ( TranscribeStreamDeltaType = "transcript.text.delta" TranscribeStreamDoneType = "transcript.text.done" TranscribeStreamErrorType = "transcript.text.error" TranscribeStreamLanguageType = "transcript.text.language" TranscribeStreamSegmentType = "transcript.text.segment" // Diarized segment event )
const ( ContentTypeSRT = "text/subrip" ContentTypeVTT = "text/vtt" )
Variables ¶
var ( ContentTypeSRTVariants = []string{ ContentTypeSRT, "application/x-subrip", "text/srt", } ContentTypeVTTVariants = []string{ ContentTypeVTT, "application/vtt", } )
Functions ¶
func WriteJSONTrailer ¶ added in v0.0.36
func WriteTextTrailer ¶ added in v0.0.36
Types ¶
type DownloadModelRequest ¶ added in v0.0.26
type DownloadModelRequest struct {
Model string `json:"model" help:"Model ID to download"`
}
DownloadModelRequest represents a request to download a model
func (*DownloadModelRequest) String ¶ added in v0.0.26
func (r *DownloadModelRequest) String() string
type Event ¶ added in v0.0.26
type Event struct {
Type string `json:"type"`
Delta string `json:"delta,omitempty"` // transcript.text.delta
Text string `json:"text,omitempty"` // transcript.text.done and transcript.text.language
JSON json.RawMessage `json:"json,omitempty"` // transcript.text.delta and transcript.text.done when format = json or verbose_json
Id string `json:"id,omitempty"` // Segment ID (for transcript.text.segment)
Start Timestamp `json:"start,omitempty"` // Segment start time
End Timestamp `json:"end,omitempty"` // Segment end time
Speaker string `json:"speaker,omitempty"` // Speaker label (for diarized segments)
}
type Model ¶
type Segment ¶
type Segment struct {
Id int32 `json:"id"`
Start Timestamp `json:"start"`
End Timestamp `json:"end"`
Text string `json:"text"`
Tokens []string `json:"tokens,omitempty"` // TODO
Speaker string `json:"speaker,omitempty"` // TODO
SpeakerTurn bool `json:"speaker_turn,omitempty"` // TODO
}
type SegmentWriter ¶ added in v0.0.36
type SegmentWriter interface {
Write(seg *Segment)
}
SegmentWriter defines an interface for writing segments in realtime
type Timestamp ¶
func SecToTimestamp ¶ added in v0.0.23
func (Timestamp) MarshalJSON ¶
func (*Timestamp) UnmarshalJSON ¶ added in v0.0.23
type TranscribeMultipartRequest ¶ added in v0.0.26
type TranscribeMultipartRequest struct {
TranscribeRequest
Audio gomultipart.File `json:"audio"`
}
TranscribeMultipartRequest wraps TranscribeRequest with an audio file for multipart form handling
type TranscribeRequest ¶ added in v0.0.26
type TranscribeRequest struct {
TranslateRequest
Diarize *bool `json:"diarize,omitempty" help:"Identify and separate speakers"`
Language *string `json:"language,omitempty" help:"Language of the audio (two-letter code)"`
}
TranscribeRequest represents a request to transcribe audio
func (*TranscribeRequest) String ¶ added in v0.0.26
func (r *TranscribeRequest) String() string
type Transcription ¶
type Transcription struct {
TranscriptionSummary
Text string `json:"text,omitempty" writer:",width:60,wrap"`
Segments []*Segment `json:"segments,omitempty" writer:",width:40,wrap"`
}
func (*Transcription) String ¶
func (t *Transcription) String() string
func (*Transcription) Summary ¶ added in v0.0.36
func (t *Transcription) Summary() *TranscriptionSummary
Summary returns a TranscriptionSummary suitable for streaming done events
type TranscriptionSummary ¶ added in v0.0.36
type TranscriptionSummary struct {
Task string `json:"task,omitempty"`
Language string `json:"language,omitempty"`
Duration Timestamp `json:"duration,omitempty"`
}
TranscriptionSummary is a lightweight version of Transcription for streaming done events. It excludes segments since they are sent individually during streaming. This prevents the SSE event from exceeding bufio.Scanner's buffer limit.
type TranslateMultipartRequest ¶ added in v0.0.26
type TranslateMultipartRequest struct {
TranslateRequest
Audio gomultipart.File `json:"audio"`
}
TranslateMultipartRequest wraps TranslateRequest with an audio file for multipart form handling
type TranslateRequest ¶ added in v0.0.26
type TranslateRequest struct {
Model string `json:"model" help:"Model ID to use for translation"`
Prompt *string `json:"prompt,omitempty" help:"Text to guide the model's style"`
Temperature *float64 `json:"temperature,omitempty" help:"Sampling temperature (0-1)"`
Filename *string `json:"filename,omitempty" help:"Optional filename with extension for the audio file"`
}
TranslateRequest represents a request to translate audio to English
func (*TranslateRequest) String ¶ added in v0.0.26
func (r *TranslateRequest) String() string