stt/interface.go

clawbench · internal/stt/interface.go · go · MIT
voice, Voice / Speech

Defines an abstract STT provider interface for speech-to-text services.

// Source: https://github.com/clawbench-dev/clawbench | License: MIT | Copyright 2025 xulongzhe
// Provided via justclaw.it.com; keep this notice with the code.
// Package stt provides speech-to-text (ASR) providers.
package stt

import (
	"context"
	"io"
)

// STTProvider abstracts speech recognition. Implementations can be
// swapped (vLLM Whisper, etc.).
type STTProvider interface {
	// Transcribe recognizes speech from audioReader and returns the text.
	// language is a language code (e.g. "zh", "en") — implementations that
	// support language-specific recognition should use it; others may ignore it.
	// Streaming vs non-streaming is controlled by the handler layer; the
	// provider only does "given an audio segment → return text".
	Transcribe(ctx context.Context, audioReader io.Reade

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key