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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .audio_input_request_embedding_option_item import AudioInputRequestEmbeddingOptionItem
from .audio_input_request_embedding_scope_item import AudioInputRequestEmbeddingScopeItem
from .audio_input_request_embedding_type_item import AudioInputRequestEmbeddingTypeItem
from .audio_segmentation import AudioSegmentation
from .media_source import MediaSource


class AudioInputRequest(UniversalBaseModel):
    """
    This field is required if the `input_type` parameter is `audio`.
    """

    media_source: MediaSource
    start_sec: typing.Optional[float] = pydantic.Field(default=None)
    """
    The start time in seconds for processing the audio file.
    
    Use this parameter to process a portion of the audio file starting from a specific time.
    
    **Default**: 0 (start from the beginning).
    """

    end_sec: typing.Optional[float] = pydantic.Field(default=None)
    """
    The end time in seconds for processing the audio file.
    
    Use this parameter to process a portion of the audio file ending at a specific time. The end time must be greater than the start time.
    
    **Default**: End of the audio file
    """

    segmentation: typing.Optional[AudioSegmentation] = None
    embedding_option: typing.Optional[typing.List[AudioInputRequestEmbeddingOptionItem]] = pydantic.Field(default=None)
    """
    The types of embeddings you wish to generate.
    
    **Values**:
    - `audio`: Generates embeddings based on audio content (sounds, music, effects)
    - `transcription`: Generates embeddings based on transcribed speech
    
    You can specify multiple values to generate different types of embeddings for the same audio.
    """

    embedding_scope: typing.Optional[typing.List[AudioInputRequestEmbeddingScopeItem]] = pydantic.Field(default=None)
    """
    The scope for which you wish to generate embeddings.
    
    **Values**:
    - `clip`: Generates one embedding for each segment
    - `asset`: Generates one embedding for the entire audio file
    
    You can specify multiple scopes to generate embeddings at different levels.
    """

    embedding_type: typing.Optional[typing.List[AudioInputRequestEmbeddingTypeItem]] = pydantic.Field(default=None)
    """
    Specifies how to structure the embedding. Include this parameter only when the `embedding_option` parameter contains at least two values.
    
    **Values**:
    - `separate_embedding`: Returns separate embeddings for each modality specified in the `embedding_option` parameter.
    - `fused_embedding`: Returns a single combined embedding that integrates all modalities into one vector.
    
    Specify both values to receive separate and fused embeddings in the same response.
    
    **Default**: `separate_embedding`.
    """

    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
