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

import datetime as dt
import typing

from ..core.datetime_utils import serialize_datetime
from ..core.pydantic_utilities import deep_union_pydantic_dicts, pydantic_v1
from .hosted_by_enum import HostedByEnum
from .ml_model_developer_enum_value_label import MlModelDeveloperEnumValueLabel
from .ml_model_display_config_labelled import MlModelDisplayConfigLabelled
from .ml_model_exec_config import MlModelExecConfig
from .ml_model_family_enum_value_label import MlModelFamilyEnumValueLabel
from .ml_model_parameter_config import MlModelParameterConfig
from .visibility_enum import VisibilityEnum


class MlModelRead(pydantic_v1.BaseModel):
    """
    An ML Model that your Workspace has access to.
    """

    id: str
    name: str = pydantic_v1.Field()
    """
    The unique name of the ML Model.
    """

    family: MlModelFamilyEnumValueLabel = pydantic_v1.Field()
    """
    The family of the ML Model.
    """

    hosted_by: HostedByEnum = pydantic_v1.Field()
    """
    The organization hosting the ML Model.
    
    - `ANTHROPIC` - Anthropic
    - `AWS_BEDROCK` - AWS Bedrock
    - `AZURE_OPENAI` - Azure OpenAI
    - `COHERE` - Cohere
    - `CUSTOM` - Custom
    - `FIREWORKS_AI` - Fireworks AI
    - `GOOGLE` - Google
    - `GOOGLE_VERTEX_AI` - Google Vertex AI
    - `GROQ` - Groq
    - `HUGGINGFACE` - HuggingFace
    - `IBM_WATSONX` - IBM WatsonX
    - `MOSAICML` - MosaicML
    - `MYSTIC` - Mystic
    - `OPENAI` - OpenAI
    - `OPENPIPE` - OpenPipe
    - `PYQ` - Pyq
    - `REPLICATE` - Replicate
    """

    developed_by: MlModelDeveloperEnumValueLabel = pydantic_v1.Field()
    """
    The organization that developed the ML Model.
    """

    visibility: typing.Optional[VisibilityEnum] = pydantic_v1.Field(default=None)
    """
    The visibility of the ML Model.
    
    - `DEFAULT` - Default
    - `PUBLIC` - Public
    - `PRIVATE` - Private
    - `DISABLED` - Disabled
    """

    exec_config: MlModelExecConfig = pydantic_v1.Field()
    """
    Configuration for how to execute the ML Model.
    """

    parameter_config: MlModelParameterConfig = pydantic_v1.Field()
    """
    Configuration for the ML Model's parameters.
    """

    display_config: MlModelDisplayConfigLabelled = pydantic_v1.Field()
    """
    Configuration for how to display the ML Model.
    """

    def json(self, **kwargs: typing.Any) -> str:
        kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        return super().json(**kwargs_with_defaults)

    def dict(self, **kwargs: typing.Any) -> typing.Dict[str, typing.Any]:
        kwargs_with_defaults_exclude_unset: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
        kwargs_with_defaults_exclude_none: typing.Any = {"by_alias": True, "exclude_none": True, **kwargs}

        return deep_union_pydantic_dicts(
            super().dict(**kwargs_with_defaults_exclude_unset), super().dict(**kwargs_with_defaults_exclude_none)
        )

    class Config:
        frozen = True
        smart_union = True
        extra = pydantic_v1.Extra.allow
        json_encoders = {dt.datetime: serialize_datetime}
