Defines immutable data classes and types for real-time speech-to-text transcript segments and events. Reuse when handling live audio transcription outputs.
# Source: https://github.com/openai/openai-python | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
from __future__ import annotations
from dataclasses import dataclass
from typing_extensions import Literal
TranscriptSegmentCloseReason = Literal["speaker_change", "inactivity", "timestamp_reset", "session_closed", "manual"]
@dataclass(frozen=True)
class TranscriptSegment:
"""An immutable display snapshot, not a server conversation item or turn.
Replace the displayed text on each update. IDs are local to this projection;
start/end times describe public transcript intervals, not audio playback.
"""
id: str
previous_id: str | None
speaker: Literal["user"
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key