Documentation
¶
Index ¶
- type AudioSettings
- type Provider
- func (p *Provider) Close() error
- func (p *Provider) ConfigureAudio(s AudioSettings)
- func (p *Provider) ConfigureThink(provider, model, endpointURL, apiKey string)
- func (p *Provider) Connect(ctx context.Context, cfg live.LiveConfig) error
- func (p *Provider) Name() string
- func (p *Provider) Receive(ctx context.Context) (*live.LiveMessage, error)
- func (p *Provider) SendAudio(chunk []byte) error
- func (p *Provider) SendAudioStreamEnd() error
- func (p *Provider) SendText(text string) error
- func (p *Provider) SendToolResponse(response live.ToolResponse) error
- func (p *Provider) SessionCapabilities() live.SessionCapabilities
- func (p *Provider) UpdateInstructions(ctx context.Context, cfg live.LiveConfig) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AudioSettings ¶
type AudioSettings struct {
// ListenModel names the STT model (e.g. "flux-general-multi", "nova-3").
ListenModel string
// SpeakModel names the TTS voice. An "aura-*" voice uses the v1 speak leg;
// a "flux-*" voice uses the v2 (Flux TTS) leg and is only honoured for
// English-pinned sessions — see resolveSpeakModel.
SpeakModel string
// SpeakSpeed sets the delivery pace (Flux accepts 0.85–1.15 in 0.05 steps).
SpeakSpeed float64
// EOTThreshold, EagerEOTThreshold, and EOTTimeoutMs tune Flux's
// model-integrated end-of-turn detection.
EOTThreshold float64
EagerEOTThreshold float64
EOTTimeoutMs int
}
AudioSettings carries the deployment's listen/speak leg selection for ConfigureAudio. Zero values keep the kernel defaults, so a caller can set only the fields its config actually specifies.
type Provider ¶
type Provider struct {
// Optional overrides; zero values fall back to the package defaults.
ListenModel string
SpeakModel string
ThinkProvider string
ThinkModel string
// Flux listen turn-detection tuning. Zero leaves Deepgram's defaults in
// place; non-zero values are clamped to the documented ranges and are only
// sent when the listen model is a Flux model (Nova rejects them).
EOTThreshold float64
EagerEOTThreshold float64
EOTTimeoutMs int
// SpeakSpeed adjusts delivery pace on the speak leg. Zero keeps the
// provider default.
SpeakSpeed float64
// ThinkEndpointURL + ThinkAPIKey switch the think leg to a bring-your-own
// LLM deployment. When ThinkEndpointURL is set, the Settings message carries
// an agent.think.endpoint block so Deepgram calls the operator's own LLM
// instead of a Deepgram-managed model; ThinkAPIKey (when set) is sent as an
// "Authorization: Bearer <key>" header on that endpoint. Leave both empty to
// use Deepgram's managed LLM for ThinkProvider/ThinkModel (no key needed).
ThinkEndpointURL string
ThinkAPIKey string
// contains filtered or unexported fields
}
Provider implements live.LiveProvider against the Deepgram Voice Agent API (WebSocket). It mirrors GeminiLive/OpenAILive's surface so callers don't need to know which backend is active.
The think (LLM) leg is configurable: Deepgram drives the LLM server-side, so ThinkProvider/ThinkModel select which model reasons over the transcript. Defaults target a widely-available option; the wiring layer overrides them from deployment config. Listen defaults to Deepgram Flux for turn-aware conversational STT and speak defaults to a Deepgram Aura-2 voice.
func (*Provider) Close ¶ added in v0.64.3
Close terminates the WebSocket and stops the keepalive loop. Idempotent.
func (*Provider) ConfigureAudio ¶ added in v0.64.3
func (p *Provider) ConfigureAudio(s AudioSettings)
ConfigureAudio applies the deployment's listen/speak selection and Flux turn-detection tuning to the provider. Empty/zero fields keep the kernel defaults. Both Targets call this from their Voice Agent wiring alongside ConfigureThink.
func (*Provider) ConfigureThink ¶ added in v0.64.3
ConfigureThink applies the deployment's think-LLM selection to the provider. Non-empty provider/model override the package defaults; empty values keep the Deepgram-managed default. endpointURL/apiKey select a bring-your-own think LLM (see ThinkEndpointURL/ThinkAPIKey) and are cleared when empty. Both Targets call this from their Voice Agent wiring with values resolved from config.
func (*Provider) Connect ¶ added in v0.64.3
Connect dials the Deepgram Voice Agent WebSocket and sends the initial Settings message describing listen/think/speak and the audio formats. The SettingsApplied acknowledgement is consumed asynchronously by Receive().
func (*Provider) Receive ¶ added in v0.64.3
Receive translates the next server frame into a live.LiveMessage. Binary frames are agent audio; text frames are JSON control events. Events that don't map to live.LiveMessage fields are swallowed and the loop fetches the next frame.
func (*Provider) SendAudio ¶ added in v0.64.3
SendAudio forwards a 16 kHz PCM16 mic chunk as a binary frame. Deepgram accepts the mic rate directly (declared in the Settings input config), so no resample is needed. Empty chunks are no-ops.
func (*Provider) SendAudioStreamEnd ¶ added in v0.64.3
SendAudioStreamEnd is a no-op for Deepgram: the Voice Agent performs its own endpointing/turn-detection server-side and responds when the user stops speaking. There is no client-side commit in the protocol.
func (*Provider) SendText ¶ added in v0.64.3
SendText injects a text user turn (e.g. an idle reminder) and lets the agent respond. Empty text is a no-op.
func (*Provider) SendToolResponse ¶ added in v0.64.3
func (p *Provider) SendToolResponse(response live.ToolResponse) error
SendToolResponse returns a host-side function result to the agent.
func (*Provider) SessionCapabilities ¶ added in v0.64.3
func (p *Provider) SessionCapabilities() live.SessionCapabilities
func (*Provider) UpdateInstructions ¶ added in v0.64.3
UpdateInstructions refreshes the agent's system prompt without a reconnect. Implements live.LiveInstructionUpdater.