schema

package
v0.0.39 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DownloadStreamProgressType = "download.progress"
	DownloadStreamErrorType    = "download.error"
	DownloadStreamDoneType     = "download.done"
)
View Source
const (
	TranscribeStreamDeltaType    = "transcript.text.delta"
	TranscribeStreamDoneType     = "transcript.text.done"
	TranscribeStreamErrorType    = "transcript.text.error"
	TranscribeStreamLanguageType = "transcript.text.language"
	TranscribeStreamSegmentType  = "transcript.text.segment" // Diarized segment event
)
View Source
const (
	ContentTypeSRT = "text/subrip"
	ContentTypeVTT = "text/vtt"
)

Variables

View Source
var (
	ContentTypeSRTVariants = []string{
		ContentTypeSRT, "application/x-subrip", "text/srt",
	}
	ContentTypeVTTVariants = []string{
		ContentTypeVTT, "application/vtt",
	}
)

Functions

func WriteJSONTrailer added in v0.0.36

func WriteJSONTrailer(w io.Writer)

func WriteTextTrailer added in v0.0.36

func WriteTextTrailer(w io.Writer)

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)
}

func (Event) String added in v0.0.26

func (e Event) String() string

type Model

type Model struct {
	Id      string `json:"id" writer:",width:28,wrap"`
	Object  string `json:"object,omitempty" writer:"-"`
	Path    string `json:"path,omitempty" writer:",width:40,wrap"`
	Created int64  `json:"created,omitempty"`
	OwnedBy string `json:"owned_by,omitempty"`
}

func (*Model) String

func (m *Model) String() string

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
}

func (*Segment) String

func (s *Segment) String() string

func (*Segment) WriteJSON added in v0.0.36

func (seg *Segment) WriteJSON(w io.Writer)

func (*Segment) WriteSRT added in v0.0.23

func (seg *Segment) WriteSRT(w io.Writer, offset time.Duration)

func (*Segment) WriteText added in v0.0.23

func (seg *Segment) WriteText(w io.Writer)

func (*Segment) WriteVTT added in v0.0.23

func (seg *Segment) WriteVTT(w io.Writer, offset time.Duration)

type SegmentWriter added in v0.0.36

type SegmentWriter interface {
	Write(seg *Segment)
}

SegmentWriter defines an interface for writing segments in realtime

type Timestamp

type Timestamp time.Duration

func SecToTimestamp added in v0.0.23

func SecToTimestamp(sec float64) Timestamp

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON added in v0.0.23

func (t *Timestamp) UnmarshalJSON(data []byte) error

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

func (*Transcription) Unmarshal added in v0.0.37

func (t *Transcription) Unmarshal(header http.Header, reader io.Reader) error

Unmarshal implements the client.Unmarshaler interface for transcriptions, which can accept JSON, SRT, VTT or plain text formats.

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

Jump to

Keyboard shortcuts

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