Documentation
¶
Index ¶
- Constants
- func AddContextHeaders(headers http.Header)
- func CreateAccessToken(apiKey, apiSecret string, ttl time.Duration) (string, error)
- func InferenceHeaders() http.Header
- func ModelLanguagesPath(modelType ModelType) (string, error)
- func ModelLanguagesPathIn(rootDir string, modelType ModelType) string
- func ModelONNXPath(modelType ModelType) (string, error)
- func ModelONNXPathIn(rootDir string, modelType ModelType) string
- func ModelTokenizerPath(modelType ModelType) (string, error)
- func ModelTokenizerPathIn(rootDir string, modelType ModelType) string
- func RemoteInferenceURL(urlBase string) string
- func SetContextHeadersProvider(provider func() map[string]string) func()
- type APIConnectOptions
- type FallbackModel
- type LiveKitInferenceLLM
- func (l *LiveKitInferenceLLM) Chat(ctx context.Context, chatCtx *llm.ChatContext, opts ...llm.ChatOption) (llm.LLMStream, error)
- func (l *LiveKitInferenceLLM) Model() string
- func (l *LiveKitInferenceLLM) Provider() string
- func (l *LiveKitInferenceLLM) UpdateOptions(opts ...LiveKitInferenceLLMOption)
- type LiveKitInferenceLLMOption
- func WithLiveKitInferenceLLMClass(inferenceClass string) LiveKitInferenceLLMOption
- func WithLiveKitInferenceLLMExtraParams(params map[string]any) LiveKitInferenceLLMOption
- func WithLiveKitInferenceLLMModel(model string) LiveKitInferenceLLMOption
- func WithLiveKitInferenceLLMProvider(provider string) LiveKitInferenceLLMOption
- type LocalTurnDetectorRunner
- type Model
- func (m *Model) InferenceMethod() string
- func (m *Model) InferencePayload(chatCtx *llm.ChatContext) ([]byte, error)
- func (m *Model) Model() ModelType
- func (m *Model) ModelRevision() string
- func (m *Model) PredictEndOfTurn(ctx context.Context, chatCtx *llm.ChatContext) (float64, error)
- func (m *Model) Provider() string
- func (m *Model) RemoteInferenceURL() string
- func (m *Model) UnlikelyThreshold(language string) (float64, bool)
- type ModelOption
- func WithHTTPClient(client *http.Client) ModelOption
- func WithLanguageThresholds(thresholds map[string]float64) ModelOption
- func WithLanguagesPath(path string) ModelOption
- func WithRemoteInferenceBaseURL(urlBase string) ModelOption
- func WithTurnDetectorRunner(runner TurnDetectorRunner) ModelOption
- func WithUnlikelyThreshold(threshold float64) ModelOption
- type ModelType
- type Plugin
- type STT
- func (s *STT) Capabilities() stt.STTCapabilities
- func (s *STT) Close() error
- func (s *STT) InputSampleRate() uint32
- func (s *STT) Label() string
- func (s *STT) Model() string
- func (s *STT) Provider() string
- func (s *STT) Recognize(ctx context.Context, frames []*model.AudioFrame, language string) (*stt.SpeechEvent, error)
- func (s *STT) Stream(ctx context.Context, language string) (stt.RecognizeStream, error)
- func (s *STT) UpdateOptions(opts ...STTOption)
- type STTOption
- func WithSTTConnectOptions(options APIConnectOptions) STTOption
- func WithSTTEncoding(encoding string) STTOption
- func WithSTTExtraKwargs(extra map[string]any) STTOption
- func WithSTTFallbackModels(models ...FallbackModel) STTOption
- func WithSTTLanguage(language string) STTOption
- func WithSTTModel(model string) STTOption
- func WithSTTSampleRate(sampleRate int) STTOption
- type TTS
- func (t *TTS) Capabilities() tts.TTSCapabilities
- func (t *TTS) Close() error
- func (t *TTS) Label() string
- func (t *TTS) Model() string
- func (t *TTS) NumChannels() int
- func (t *TTS) Prewarm()
- func (t *TTS) Provider() string
- func (t *TTS) SampleRate() int
- func (t *TTS) Stream(ctx context.Context) (tts.SynthesizeStream, error)
- func (t *TTS) Synthesize(ctx context.Context, text string) (tts.ChunkedStream, error)
- func (t *TTS) UpdateOptions(opts ...TTSOption)
- type TTSOption
- func WithSentenceTokenizer(tokenizer tokenize.SentenceTokenizer) TTSOption
- func WithTTSConnectOptions(options APIConnectOptions) TTSOption
- func WithTTSEncoding(encoding string) TTSOption
- func WithTTSExtraKwargs(extra map[string]any) TTSOption
- func WithTTSFallbackModels(models ...FallbackModel) TTSOption
- func WithTTSLanguage(language string) TTSOption
- func WithTTSModel(model string) TTSOption
- func WithTTSSampleRate(sampleRate int) TTSOption
- func WithTTSVoice(voice string) TTSOption
- type TurnDetectorInputRunner
- type TurnDetectorONNXOptions
- type TurnDetectorRunner
- type TurnDetectorTokenizer
Constants ¶
View Source
const ( HGModel = "livekit/turn-detector" ONNXFilename = "model_q8.onnx" MaxHistoryTokens = 128 MaxHistoryTurns = 6 RemoteInferenceTimeout = 2 * time.Second )
View Source
const ( PluginTitle = "rtp-agent.plugins.livekit" PluginVersion = "v0.1.7" PluginPackage = "rtp-agent.plugins.livekit" )
View Source
const ( InferenceAccessTokenTTL = 10 * time.Minute HeaderUserAgent = "User-Agent" HeaderRoomID = inference.HeaderRoomID HeaderJobID = inference.HeaderJobID HeaderInferenceProvider = inference.HeaderInferenceProvider HeaderInferencePriority = inference.HeaderInferencePriority )
Variables ¶
This section is empty.
Functions ¶
func AddContextHeaders ¶
func CreateAccessToken ¶
func InferenceHeaders ¶
func ModelLanguagesPath ¶
func ModelLanguagesPathIn ¶
func ModelONNXPath ¶
func ModelONNXPathIn ¶
func ModelTokenizerPath ¶
func ModelTokenizerPathIn ¶
func RemoteInferenceURL ¶
Types ¶
type APIConnectOptions ¶
type APIConnectOptions = llm.APIConnectOptions
type FallbackModel ¶
type LiveKitInferenceLLM ¶
type LiveKitInferenceLLM struct {
// contains filtered or unexported fields
}
func NewLiveKitInferenceLLM ¶
func NewLiveKitInferenceLLM(model string, apiKey, apiSecret string, opts ...LiveKitInferenceLLMOption) (*LiveKitInferenceLLM, error)
func (*LiveKitInferenceLLM) Chat ¶
func (l *LiveKitInferenceLLM) Chat(ctx context.Context, chatCtx *llm.ChatContext, opts ...llm.ChatOption) (llm.LLMStream, error)
func (*LiveKitInferenceLLM) Model ¶
func (l *LiveKitInferenceLLM) Model() string
func (*LiveKitInferenceLLM) Provider ¶
func (l *LiveKitInferenceLLM) Provider() string
func (*LiveKitInferenceLLM) UpdateOptions ¶
func (l *LiveKitInferenceLLM) UpdateOptions(opts ...LiveKitInferenceLLMOption)
type LiveKitInferenceLLMOption ¶
type LiveKitInferenceLLMOption func(*LiveKitInferenceLLM)
func WithLiveKitInferenceLLMClass ¶
func WithLiveKitInferenceLLMClass(inferenceClass string) LiveKitInferenceLLMOption
func WithLiveKitInferenceLLMExtraParams ¶
func WithLiveKitInferenceLLMExtraParams(params map[string]any) LiveKitInferenceLLMOption
func WithLiveKitInferenceLLMModel ¶
func WithLiveKitInferenceLLMModel(model string) LiveKitInferenceLLMOption
func WithLiveKitInferenceLLMProvider ¶
func WithLiveKitInferenceLLMProvider(provider string) LiveKitInferenceLLMOption
type LocalTurnDetectorRunner ¶
type LocalTurnDetectorRunner struct {
// contains filtered or unexported fields
}
func NewLocalTurnDetectorRunner ¶
func NewLocalTurnDetectorRunner(tokenizer TurnDetectorTokenizer, runner TurnDetectorInputRunner) *LocalTurnDetectorRunner
func (*LocalTurnDetectorRunner) RunTurnDetector ¶
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
func NewEnglishModel ¶
func NewEnglishModel(opts ...ModelOption) *Model
func NewLocalEnglishModel ¶
func NewLocalEnglishModel(opts ...ModelOption) (*Model, error)
func NewLocalMultilingualModel ¶
func NewLocalMultilingualModel(opts ...ModelOption) (*Model, error)
func NewMultilingualModel ¶
func NewMultilingualModel(opts ...ModelOption) *Model
func (*Model) InferenceMethod ¶
func (*Model) InferencePayload ¶
func (m *Model) InferencePayload(chatCtx *llm.ChatContext) ([]byte, error)
func (*Model) ModelRevision ¶
func (*Model) PredictEndOfTurn ¶
func (*Model) RemoteInferenceURL ¶
type ModelOption ¶
type ModelOption func(*Model)
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ModelOption
func WithLanguageThresholds ¶
func WithLanguageThresholds(thresholds map[string]float64) ModelOption
func WithLanguagesPath ¶
func WithLanguagesPath(path string) ModelOption
func WithRemoteInferenceBaseURL ¶
func WithRemoteInferenceBaseURL(urlBase string) ModelOption
func WithTurnDetectorRunner ¶
func WithTurnDetectorRunner(runner TurnDetectorRunner) ModelOption
func WithUnlikelyThreshold ¶
func WithUnlikelyThreshold(threshold float64) ModelOption
type STT ¶
type STT struct {
// contains filtered or unexported fields
}
func (*STT) Capabilities ¶
func (s *STT) Capabilities() stt.STTCapabilities
func (*STT) InputSampleRate ¶
func (*STT) Recognize ¶
func (s *STT) Recognize(ctx context.Context, frames []*model.AudioFrame, language string) (*stt.SpeechEvent, error)
func (*STT) UpdateOptions ¶
type STTOption ¶
type STTOption func(*STT)
func WithSTTConnectOptions ¶
func WithSTTConnectOptions(options APIConnectOptions) STTOption
func WithSTTEncoding ¶
func WithSTTExtraKwargs ¶
func WithSTTFallbackModels ¶
func WithSTTFallbackModels(models ...FallbackModel) STTOption
func WithSTTLanguage ¶
func WithSTTModel ¶
func WithSTTSampleRate ¶
type TTS ¶
type TTS struct {
// contains filtered or unexported fields
}
func (*TTS) Capabilities ¶
func (t *TTS) Capabilities() tts.TTSCapabilities
func (*TTS) NumChannels ¶
func (*TTS) SampleRate ¶
func (*TTS) Synthesize ¶
func (*TTS) UpdateOptions ¶
type TTSOption ¶
type TTSOption func(*TTS)
func WithSentenceTokenizer ¶
func WithSentenceTokenizer(tokenizer tokenize.SentenceTokenizer) TTSOption
func WithTTSConnectOptions ¶
func WithTTSConnectOptions(options APIConnectOptions) TTSOption
func WithTTSEncoding ¶
func WithTTSExtraKwargs ¶
func WithTTSFallbackModels ¶
func WithTTSFallbackModels(models ...FallbackModel) TTSOption
func WithTTSLanguage ¶
func WithTTSModel ¶
func WithTTSSampleRate ¶
func WithTTSVoice ¶
type TurnDetectorInputRunner ¶
type TurnDetectorInputRunner interface {
RunTurnDetectorInputIDs(ctx context.Context, inputIDs []int64) (float64, error)
}
func NewTurnDetectorONNXInputRunner ¶
func NewTurnDetectorONNXInputRunner(options TurnDetectorONNXOptions) (TurnDetectorInputRunner, error)
type TurnDetectorONNXOptions ¶
type TurnDetectorRunner ¶
type TurnDetectorTokenizer ¶
type TurnDetectorTokenizer interface {
TokenizeTurnDetectorPayload(ctx context.Context, payload []byte) ([]int64, error)
}
func NewHuggingFaceTurnDetectorTokenizer ¶
func NewHuggingFaceTurnDetectorTokenizer(modelType ModelType, tokenizerPath string) (TurnDetectorTokenizer, error)
Click to show internal directories.
Click to hide internal directories.