stt
stt ¶
STT evaluation client — httpx + httpx-ws + httpx-sse under the hood.
AudioEncoding ¶
Bases: StrEnum
Wire encoding for WebSocket audio frames.
STTResult
dataclass
¶
STTSession ¶
Active WebSocket session for STT evaluation.
send_sample
async
¶
send_sample(
sample: AudioSample,
*,
chunk_ms: int = 200,
encoding: AudioEncoding = AudioEncoding.FLOAT32,
) -> None
Stream sample in chunks with realistic pacing.
encoding controls wire format
FLOAT32 → binary frame, raw float32 (default) PCM16 → binary frame, raw int16 PCM16_BASE64 → text frame, base64-encoded int16
receive_text
async
¶
Receive text frame and accumulate as fragment.
STTClient ¶
STT evaluation client — HTTP batch + WebSocket streaming.
post
async
¶
Batch POST audio to STT endpoint (e.g. OpenAI Whisper API). Returns raw httpx.Response.
stream
async
¶
Chunked streaming POST. Yields httpx.Response for aiter_bytes/aiter_lines.
sse
async
¶
SSE streaming POST. Yields EventSource for aiter_sse().
ws
async
¶
Open WebSocket session for STT streaming (e.g. WhisperLive).