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

import datetime as dt
import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .error_info import ErrorInfo
from .json_list_string import JsonListString
from .trace_update_source import TraceUpdateSource


class TraceUpdate(UniversalBaseModel):
    project_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    If null and project_id not specified, Default Project is assumed
    """

    project_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    If null and project_name not specified, Default Project is assumed
    """

    name: typing.Optional[str] = None
    end_time: typing.Optional[dt.datetime] = None
    input: typing.Optional[JsonListString] = None
    output: typing.Optional[JsonListString] = None
    metadata: typing.Optional[JsonListString] = None
    tags: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Tags
    """

    tags_to_add: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Tags to add
    """

    tags_to_remove: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Tags to remove
    """

    error_info: typing.Optional[ErrorInfo] = None
    thread_id: typing.Optional[str] = None
    ttft: typing.Optional[float] = None
    source: typing.Optional[TraceUpdateSource] = 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
