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

import typing

import typing_extensions
from ..types.listen_v2turn_info_event import ListenV2TurnInfoEvent
from .listen_v2turn_info_words_item import ListenV2TurnInfoWordsItemParams


class ListenV2TurnInfoParams(typing_extensions.TypedDict):
    """
    Describes the current turn and latest state of the turn
    """

    type: typing.Literal["TurnInfo"]
    request_id: str
    """
    The unique identifier of the request
    """

    sequence_id: float
    """
    Starts at `0` and increments for each message the server sends to the client.  This includes messages of other types, like `Connected` messages.
    """

    event: ListenV2TurnInfoEvent
    """
    The type of event being reported.
    
    - **Update** - Additional audio has been transcribed, but the turn state hasn't changed
    - **StartOfTurn** - The user has begun speaking for the first time in the turn
    - **EagerEndOfTurn** - The system has moderate confidence that the user has finished speaking for the turn. This is an opportunity to begin preparing an agent reply
    - **TurnResumed** - The system detected that speech had ended and therefore sent an **EagerEndOfTurn** event, but speech is actually continuing for this turn
    - **EndOfTurn** - The user has finished speaking for the turn
    """

    turn_index: float
    """
    The index of the current turn
    """

    audio_window_start: float
    """
    Start time in seconds of the audio range that was transcribed
    """

    audio_window_end: float
    """
    End time in seconds of the audio range that was transcribed
    """

    transcript: str
    """
    Text that was said over the course of the current turn
    """

    words: typing.Sequence[ListenV2TurnInfoWordsItemParams]
    """
    The words in the `transcript`
    """

    end_of_turn_confidence: float
    """
    Confidence that no more speech is coming in this turn
    """
