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

from .base_search_response_dto import BaseSearchResponseDto
from .clustered_articles_dto import ClusteredArticlesDto
import typing
from .user_input_dto import UserInputDto
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class ClusteredSearchResponseDto(BaseSearchResponseDto, ClusteredArticlesDto):
    """
    The response model when clustering is enabled, grouping similar articles into clusters. Applies to the `Search` and `Latest headlines` requests. Response field behavior:
    - Required fields are guaranteed to be present and non-null.
    - Optional fields may be `null`/`undefined` if the data couldn't be extracted
    during processing.
    - To access article properties in the `articles` response array,
    use array index notation. For example, `articles[n].title`, where `n`
    is the zero-based index of the article object (0, 1, 2, etc.).
    - The `nlp` property within the article object `articles[n].nlp`
    is only available with NLP-enabled subscription plans.
    """

    user_input: typing.Optional[UserInputDto] = None

    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
