cloud

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 25 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func ChatGPT(ctx context.Context, opts Options, pcm <-chan []byte, ev Events)

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.

func OpenAI

func OpenAI(ctx context.Context, opts Options, pcm <-chan []byte, ev Events)

OpenAI streams the PCM to OpenAI's Realtime transcription API and reports the text through ev.

func Yandex

func Yandex(ctx context.Context, opts Options, pcm <-chan []byte, ev Events)

Yandex recognizes pcm with SpeechKit STT v3 over one bidirectional gRPC stream. Hints are not sent: v3 streaming has no vocabulary support, the runtime applies the dictionary to the text afterwards.

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

type Func func(ctx context.Context, opts Options, pcm <-chan []byte, ev Events)

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.

Jump to

Keyboard shortcuts

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