Documentation
¶
Overview ¶
Package companion provides small composers for hands-free SpeechKit hosts.
Index ¶
- Variables
- type HandsFree
- func (h *HandsFree) Assist() speechkit.AssistService
- func (h *HandsFree) Events() <-chan speechkit.Event
- func (h *HandsFree) HandleWake(ctx context.Context, ev wakeword.DetectionEvent) error
- func (h *HandsFree) ProcessAssist(ctx context.Context, req speechkit.AssistRequest) (speechkit.AssistResult, error)
- func (h *HandsFree) Runtime() *speechkit.Runtime
- func (h *HandsFree) Start(ctx context.Context) error
- func (h *HandsFree) Stop(ctx context.Context) error
- func (h *HandsFree) TTS() *tts.Service
- func (h *HandsFree) VoiceAgent() speechkit.VoiceAgentService
- func (h *HandsFree) WakeSink() wakeword.Sink
- type HandsFreeTarget
- type Options
- type WakeRequestFunc
Constants ¶
This section is empty.
Variables ¶
var ErrMissingAssist = errors.New("speechkit companion: assist service is required")
var ErrMissingContext = errors.New("speechkit companion: context is required")
var ErrMissingRuntime = errors.New("speechkit companion: runtime is required")
Functions ¶
This section is empty.
Types ¶
type HandsFree ¶
type HandsFree struct {
// contains filtered or unexported fields
}
func NewHandsFree ¶
func (*HandsFree) Assist ¶
func (h *HandsFree) Assist() speechkit.AssistService
func (*HandsFree) HandleWake ¶
HandleWake publishes a wake event, forwards it to the optional downstream sink, and starts the configured hands-free target. Assist and Voice Agent can run without a visible UI; Dictation is UI-assisted and dispatches into the host command bus so the host can choose the text target and commit surface.
func (*HandsFree) ProcessAssist ¶
func (h *HandsFree) ProcessAssist(ctx context.Context, req speechkit.AssistRequest) (speechkit.AssistResult, error)
ProcessAssist runs a one-shot Assist request through the configured service and, when TTS is present, synthesizes the spoken response.
func (*HandsFree) VoiceAgent ¶
func (h *HandsFree) VoiceAgent() speechkit.VoiceAgentService
type HandsFreeTarget ¶ added in v0.40.7
type HandsFreeTarget string
HandsFreeTarget identifies which strict SpeechKit mode a hands-free activation should start. Hands-free is a capability layer, not a fourth SpeechKit mode.
const ( // TargetAssist runs a one-shot Assist request and may synthesize spoken // output. This is the Siri/Alexa-style Voice-Companion path. TargetAssist HandsFreeTarget = "assist" // TargetVoiceAgent starts a realtime Voice Agent session for continuous // dialogue such as companion or game-moderator flows. TargetVoiceAgent HandsFreeTarget = "voice_agent" // TargetDictationUIAssisted starts Dictation through the host command bus. // It intentionally does not synthesize audio: text output still belongs to // a visible target or explicit commit surface owned by the host UI. TargetDictationUIAssisted HandsFreeTarget = "dictation_ui_assisted" )
type Options ¶
type Options struct {
Runtime *speechkit.Runtime
TargetMode HandsFreeTarget
WakeSink wakeword.Sink
WakeRequest WakeRequestFunc
Assist speechkit.AssistService
VoiceAgent speechkit.VoiceAgentService
TTS *tts.Service
}
type WakeRequestFunc ¶
type WakeRequestFunc func(context.Context, wakeword.DetectionEvent) (speechkit.AssistRequest, bool)
WakeRequestFunc converts a wake detection into an Assist request. Hosts use it to attach their transcript/capture result to the framework composer.