Documentation
¶
Overview ¶
Package cloud holds the streaming recognizers that send the audio to a provider (OpenAI Realtime transcription, Yandex SpeechKit v3). They are used only when the person picked that model in Settings. Each is a function over a channel of PCM and a set of callbacks, so internal/voice can drive it like the machine's own recognition service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChatGPT ¶ added in v0.16.154
ChatGPT sends the whole recording, once it ends, to the transcription behind the ChatGPT plan, on the Codex CLI's sign-in (opts.Key is its token, opts.Folder its account). It has no stream, so no partial text comes while the person speaks, and it takes no prompt, so opts.Hints go unused.
Types ¶
type Events ¶
type Events struct {
Ready func()
Partial func(text string)
Final func(text string)
Fail func(message string)
}
Events are what a recognition reports. Ready is called once, when the provider accepted the session and audio may flow; Partial carries the whole text so far; Final the whole text, once, after the audio ended (the last call); Fail ends the recognition with a message in the person's words (the last call, instead of Final).
type Func ¶
Func recognizes the PCM (mono, 16 kHz, 16-bit little-endian) that comes on pcm until it is closed, and returns when it called Final or Fail. A cancelled ctx stops it at once without either call.
type Options ¶
type Options struct {
// Lang is "ru", "en" or "auto".
Lang string
// Key is the provider's API key (for ChatGPT, the Codex sign-in's token); Folder is Yandex's folder id ("" when the
// key needs none) or the ChatGPT account.
Key string
Folder string
// Hints are the person's dictionary words, passed to a provider that takes them as a prompt.
Hints []string
// Endpoint overrides the provider's address; for tests only (the runtime never takes it from a person).
Endpoint string
}
Options is what a recognition is started with.