local

package
v0.69.2 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const MinWhisperModelBytes = 50_000_000

MinWhisperModelBytes is the minimum file size we expect for a valid ggml model. ggml-base.bin is ~150 MB; anything under 50 MB is clearly corrupt/truncated.

Variables

This section is empty.

Functions

func FindWhisperBinary

func FindWhisperBinary() (string, error)

FindWhisperBinary exposes the local whisper runtime lookup for callers that need to reflect runtime readiness without starting the subprocess.

func SetSubprocessPriorityLowered

func SetSubprocessPriorityLowered(bool)

SetSubprocessPriorityLowered is a no-op outside Windows; subprocess priority classes are a Windows scheduling concept.

func ValidateModelPath

func ValidateModelPath(path string) error

ValidateModelPath verifies that path points at a whisper.cpp ggml model file with a safe filename. It rejects path traversal, non-absolute paths, and filenames that don't match the ggml-*.bin pattern.

Types

type InstallStatus

type InstallStatus struct {
	BinaryFound bool     `json:"binaryFound"`
	BinaryPath  string   `json:"binaryPath"`
	ModelFound  bool     `json:"modelFound"`
	ModelPath   string   `json:"modelPath"`
	ModelBytes  int64    `json:"modelBytes"`
	ServerReady bool     `json:"serverReady"`
	Problems    []string `json:"problems,omitempty"`
}

InstallStatus describes what's present and what's missing for local STT.

type Provider

type Provider struct {
	BaseURL    string // e.g. "http://127.0.0.1:8080"
	Port       int
	ModelPath  string
	GPU        string
	Validation netsec.ValidationOptions
	// LowerSubprocessPriority overrides the process-wide default set via
	// SetSubprocessPriorityLowered for this provider only. nil keeps the
	// default (true on Windows). Ignored outside Windows.
	LowerSubprocessPriority *bool
	// contains filtered or unexported fields
}

Provider implements stt.STTProvider for Tier 1: localhost whisper.cpp server.

func New

func New(port int, modelPath, gpu string) *Provider

New creates the built-in whisper.cpp provider. The process is not started; lifecycle stays with the host.

func (*Provider) Capabilities added in v0.64.3

func (*Provider) Capabilities() []speechkit.Capability

Capabilities reports the speech-to-text baseline every provider satisfies.

func (*Provider) Health added in v0.64.3

func (p *Provider) Health(ctx context.Context) error

func (*Provider) IsReady added in v0.64.3

func (p *Provider) IsReady() bool

IsReady returns true if the whisper-server subprocess is running and responding.

func (*Provider) Name added in v0.64.3

func (p *Provider) Name() string

func (*Provider) RuntimeDone added in v0.64.3

func (p *Provider) RuntimeDone() <-chan struct{}

RuntimeDone closes whenever the owned whisper-server subprocess exits. RuntimeError then reports an unexpected exit and stays nil for an explicit StopServer call or process-context cancellation.

func (*Provider) RuntimeError added in v0.64.3

func (p *Provider) RuntimeError() error

func (*Provider) StartServer added in v0.64.3

func (p *Provider) StartServer(ctx context.Context) error

StartServer starts the whisper.cpp server subprocess. Blocks until ready or context cancelled.

func (*Provider) StopServer added in v0.64.3

func (p *Provider) StopServer()

StopServer terminates the whisper-server subprocess.

func (*Provider) Transcribe added in v0.64.3

func (p *Provider) Transcribe(ctx context.Context, audioData []byte, opts stt.TranscribeOpts) (*stt.Result, error)

func (*Provider) VerifyInstallation added in v0.64.3

func (p *Provider) VerifyInstallation() InstallStatus

VerifyInstallation checks binary and model availability without starting the server.

Jump to

Keyboard shortcuts

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