Documentation
¶
Overview ¶
Package sttclient calls a whisper.cpp whisper-server (over llama-swap's /upstream/<model>/inference passthrough) to transcribe a 16 kHz mono WAV. It requests response_format=verbose_json so the reply carries per-segment timestamps (the {gist, segments[]} citation pattern). Audio bytes go straight to whisper-server and NEVER touch the text Gemma cascade. Pure net/http + mime/multipart; no cgo, no cloud.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client posts audio to whisper-server through llama-swap on base (e.g. http://127.0.0.1:11436). Every inference is serialized by the process-global inferMu (whisper-server is single-slot and crashes on overlapping requests).
func (*Client) Transcribe ¶
Transcribe uploads wavPath to the whisper upstream `model` and returns the parsed verbose_json. The multipart body is built in memory (wavs are 16 kHz mono — ~2 MB/min — comfortable in 64 GB RAM).
type Params ¶
type Params struct {
Language string // "" => auto-detect (sent as language=auto)
BeamSize int // -bs; default greedy in whisper, so 5 is set explicitly
BestOf int // -bo; candidates for temperature fallback
MaxContext int // -mc; condition-on-previous-text cap (kills repetition loops)
EntropyThold float64 // -et; raise to fire the repetition detector sooner
NoSpeechThold float64 // -nth
Temperature float64 // base decode temperature (fallback steps up from here)
VAD bool // enable Silero VAD (server loaded with -vm)
VADThreshold float64 // -vt
MaxLen int // -ml; subtitle-sized segments (chars)
SplitOnWord bool // -sow; split at word boundaries for clean SRT
}
Params are the per-request decode knobs whisper-server accepts as form fields. Defaults (DefaultParams) are the research-tuned profile for noisy EN/ES field audio; Language is set by the caller per call.
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns the tuned profile for noisy EN/ES field audio.
func (Params) ResponseFormat ¶
ResponseFormat is fixed: verbose_json is the ONLY format that returns segments.
type Result ¶
type Result struct {
Language string `json:"language"`
Duration float64 `json:"duration"`
Text string `json:"text"`
Segments []Segment `json:"segments"`
}
Result is the parsed whisper-server verbose_json response.
type Segment ¶
type Segment struct {
ID int `json:"id"`
Start float64 `json:"start"`
End float64 `json:"end"`
Text string `json:"text"`
Words []Word `json:"words"`
AvgLogprob float64 `json:"avg_logprob"`
NoSpeechProb float64 `json:"no_speech_prob"`
}
Segment is one timestamped span of the transcript (start/end in seconds), plus the per-word array and decode-confidence fields whisper-server already returns. These flow through to the on-disk .segments.json (pipeline writes the full tr.Segments) for downstream consumers that need word-accurate timing and per-word confidence.
type Word ¶
type Word struct {
Word string `json:"word"`
Start float64 `json:"start"`
End float64 `json:"end"`
Probability float64 `json:"probability"`
}
Word is one timestamped word with whisper's per-word confidence. whisper-server emits words[] in verbose_json BY DEFAULT (no extra request field needed — adding token_timestamps can segfault this build); the dataset/segmentation tooling uses these to cut only at whole-word boundaries and to drop low-confidence stumbles.