# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class TranscribeResponse(UniversalBaseModel):
    """
    Response from the transcription endpoint.
    """

    language: str = pydantic.Field()
    """
    Detected or specified language code
    """

    language_probability: float = pydantic.Field()
    """
    Confidence of language detection (0.0-1.0)
    """

    duration_seconds: float = pydantic.Field()
    """
    Audio duration in seconds
    """

    text: str = pydantic.Field()
    """
    Full transcript text
    """

    segments: typing.List[typing.Dict[str, typing.Any]] = pydantic.Field()
    """
    Timestamped segments with text, start, end, and optional word timings
    """

    word_count: int = pydantic.Field()
    """
    Total number of words in the transcript
    """

    processing_time_seconds: float = pydantic.Field()
    """
    Server-side processing time in seconds
    """

    model: str = pydantic.Field()
    """
    Model used for transcription
    """

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
