router

package
v0.0.0-...-94216e4 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio struct {
	Waveform   []float32 `json:"waveform"`
	SampleRate int       `json:"sample_rate"`
}

type CapturedAudio

type CapturedAudio struct {
	ID string `json:"id"`

	PCM   []float32 `json:"-"`
	Final bool      `json:"final"`

	StartTimestamp uint64 `json:"start"`
	EndTimestamp   uint64 `json:"end"`
}

type CapturedSample

type CapturedSample struct {
	PCM          []float32
	EndTimestamp uint32
}

type Document

type Document struct {
	Transcriptions []*Transcription `json:"transcriptions"`
	StartedAt      int64            `json:"startedAt"`
}

func (*Document) Clone

func (d *Document) Clone() *Document

func (*Document) CloneFinal

func (d *Document) CloneFinal() *Document

func (*Document) Update

func (d *Document) Update(transcription *Transcription)

type Emitters

type Emitters struct {
	CapturedSample chan<- *CapturedSample
	CapturedAudio  chan<- *CapturedAudio
	Transcription  chan<- *Transcription
}

type Listeners

type Listeners struct {
	DraftDocument  chan<- Document
	FinalDocument  chan<- Document
	CapturedAudio  chan<- *CapturedAudio
	CapturedSample chan<- *CapturedSample
	Status         chan<- *Status
}

type MiddlewareFunc

type MiddlewareFunc func(ctx context.Context, emit Emitters) (Listeners, error)

type Participant

type Participant struct {
	Label       string `json:"label"`
	IsAssistant bool   `json:"isAssistent"`
}

type Router

type Router struct {
	// contains filtered or unexported fields
}

func New

func New(parentCtx context.Context) *Router

func (*Router) InstallMiddleware

func (r *Router) InstallMiddleware(middlewares ...MiddlewareFunc) error

func (*Router) Start

func (r *Router) Start() error

func (*Router) WaitForDone

func (r *Router) WaitForDone()

type Status

type Status struct {
	Participants *[]Participant
}

type Transcription

type Transcription struct {
	ID string `json:"id"`

	AudioSources []*CapturedAudio `json:"audio"`

	Final bool `json:"final"`

	StartTimestamp uint64 `json:"start"`
	EndTimestamp   uint64 `json:"end"`

	TranscriptSources []*Transcription `json:"-"`

	Language            string              `json:"language"`
	LanguageProbability float32             `json:"language_prob"`
	Duration            float32             `json:"duration"`
	AllLanguageProbs    *map[string]float32 `json:"all_language_probs,omitempty"`

	Segments []TranscriptionSegment `json:"segments"`
}

type TranscriptionRequest

type TranscriptionRequest struct {
	Audio *Audio  `json:"audio,omitempty"`
	Text  *string `json:"text,omitempty"`

	Task           string  `json:"task"`
	SourceLanguage *string `json:"source_language,omitempty"`
	TargetLanguage *string `json:"target_language,omitempty"`

	Segments *[]TranscriptionSegment `json:"segments,omitempty"`
}

type TranscriptionResponse

type TranscriptionResponse struct {
	TargetLanguage            string              `json:"target_language"`
	SourceLanguage            string              `json:"source_language"`
	SourceLanguageProbability float32             `json:"source_language_prob"`
	Duration                  float32             `json:"duration"`
	AllLanguageProbs          *map[string]float32 `json:"all_language_probs,omitempty"`

	Segments []TranscriptionSegment `json:"segments"`
}

type TranscriptionSegment

type TranscriptionSegment struct {
	ID               uint32  `json:"id"`
	Seek             uint32  `json:"seek"`
	Start            float32 `json:"start"`
	End              float32 `json:"end"`
	Text             string  `json:"text"`
	Temperature      float32 `json:"temperature"`
	AvgLogprob       float32 `json:"avg_logprob"`
	CompressionRatio float32 `json:"compression_ratio"`
	NoSpeechProb     float32 `json:"no_speech_prob"`
	Words            []Word  `json:"words"`

	Speaker     string `json:"speaker"`
	IsAssistant bool   `json:"is_assistant"`
}

type Word

type Word struct {
	Start       float32 `json:"start"`
	End         float32 `json:"end"`
	Word        string  `json:"word"`
	Probability float32 `json:"prob"`
}

Jump to

Keyboard shortcuts

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