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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.unchecked_base_model import UncheckedBaseModel
from .audio_ref_chunk import AudioRefChunk
from .generation_chunk_input_condition_strength import GenerationChunkInputConditionStrength
from .generation_chunk_input_context_adherence import GenerationChunkInputContextAdherence


class GenerationChunkInput(UncheckedBaseModel):
    text: str = pydantic.Field()
    """
    The text config to be generated for this chunk. Can contain section name in square brackets, e.g. [Verse 1], lyrics lines, and inline directions in curly braces, e.g. {scratching}.
    """

    duration_ms: int = pydantic.Field()
    """
    The duration of the chunk in milliseconds. Must be between 3000ms and 120000ms.
    """

    positive_styles: typing.List[str] = pydantic.Field()
    """
    The styles and musical directions that should be present in this chunk. Use English language for best results. The styles for the first chunk are the most important as they set the overall tone and genre. Styles for subsequent chunks can be used to add nuance, progression, emphasis, or change the direction of the song. Aim to have at least 6-7 styles in early chunks until the direction is established. Generic styles like 'great production quality' are good default styles to append to the list.
    """

    negative_styles: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The styles and musical directions that should not be present in this chunk. Use English language for best results. Leaving empty is a good default, only use this field if you want to explicitly avoid a particular style or direction.
    """

    context_adherence: typing.Optional[GenerationChunkInputContextAdherence] = pydantic.Field(default=None)
    """
    How much the model adheres to the context of its surrounding chunks. Low adherence means the model can deviate from the context and be more creative. High adherence means the model will be more consistent with the context.
    """

    conditioning_ref: typing.Optional[AudioRefChunk] = pydantic.Field(default=None)
    """
    The audio reference to condition the generation on. The first chunk is the most important as it will influence the generation of all subsequent chunks. Thus, if you want to apply conditioning to the entire song, start conditioning from the first chunk.
    """

    condition_strength: typing.Optional[GenerationChunkInputConditionStrength] = pydantic.Field(default=None)
    """
    How strongly the model adheres to the conditioning reference. Low strength means the model will be more creative and deviate from the reference. High strength means the model will be more consistent with the reference.
    """

    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
