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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
from .language import Language
from .individual_search_result import IndividualSearchResult
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class ChatFullResponse(UniversalBaseModel):
    """
    Full response to a chat question when the result is not streamed.
    """

    chat_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    If the chat response was stored, the ID of the chat.
    """

    turn_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    If the chat response was stored, the ID of the turn.
    """

    answer: typing.Optional[str] = pydantic.Field(default=None)
    """
    The message from the chat model for the chat message.
    """

    response_language: typing.Optional[Language] = pydantic.Field(default=None)
    """
    The language that the answer is expected to be.
    """

    search_results: typing.Optional[typing.List[IndividualSearchResult]] = pydantic.Field(default=None)
    """
    The ranked search results that the chat model used.
    """

    factual_consistency_score: typing.Optional[float] = pydantic.Field(default=None)
    """
    The probability that the summary is factually consistent with the results.
    """

    rendered_prompt: typing.Optional[str] = pydantic.Field(default=None)
    """
    The rendered prompt sent to the LLM. Useful when creating customer `prompt_text` templates. Only available
    to Scale customers.
    """

    rephrased_query: typing.Optional[str] = pydantic.Field(default=None)
    """
    If you are on the Scale plan, you can view the actual query made to backend that was rephrased
    by the LLM from the input query.
    """

    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
