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

from ..core.pydantic_utilities import UniversalBaseModel
import typing
import pydantic
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Prediction(UniversalBaseModel):
    id: typing.Optional[int] = None
    result: typing.List[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field()
    """
    List of prediction results for the task
    """

    model_version: typing.Optional[str] = pydantic.Field(default=None)
    """
    Model version - tag for predictions that can be used to filter tasks in Data Manager, as well as select specific model version for showing preannotations in the labeling interface
    """

    created_ago: typing.Optional[str] = pydantic.Field(default=None)
    """
    Delta time from creation time
    """

    score: typing.Optional[float] = pydantic.Field(default=None)
    """
    Prediction score
    """

    cluster: typing.Optional[int] = pydantic.Field(default=None)
    """
    Cluster for the current prediction
    """

    neighbors: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    Array of task IDs of the closest neighbors
    """

    mislabeling: typing.Optional[float] = pydantic.Field(default=None)
    """
    Related task mislabeling score
    """

    created_at: typing.Optional[dt.datetime] = None
    updated_at: typing.Optional[dt.datetime] = None
    model: typing.Optional[int] = pydantic.Field(default=None)
    """
    An ML Backend instance that created the prediction.
    """

    model_run: typing.Optional[int] = pydantic.Field(default=None)
    """
    A run of a ModelVersion that created the prediction.
    """

    task: int
    project: typing.Optional[int] = 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
