# 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_experiment_item_bulk_write_view import ErrorInfoExperimentItemBulkWriteView
from .json_list_string_experiment_item_bulk_write_view import JsonListStringExperimentItemBulkWriteView
from .span_experiment_item_bulk_write_view_source import SpanExperimentItemBulkWriteViewSource
from .span_experiment_item_bulk_write_view_type import SpanExperimentItemBulkWriteViewType


class SpanExperimentItemBulkWriteView(UniversalBaseModel):
    id: typing.Optional[str] = None
    parent_span_id: typing.Optional[str] = None
    name: typing.Optional[str] = None
    type: typing.Optional[SpanExperimentItemBulkWriteViewType] = None
    start_time: dt.datetime
    end_time: typing.Optional[dt.datetime] = None
    input: typing.Optional[JsonListStringExperimentItemBulkWriteView] = None
    output: typing.Optional[JsonListStringExperimentItemBulkWriteView] = None
    metadata: typing.Optional[JsonListStringExperimentItemBulkWriteView] = None
    model: typing.Optional[str] = None
    provider: typing.Optional[str] = None
    tags: typing.Optional[typing.List[str]] = None
    usage: typing.Optional[typing.Dict[str, int]] = None
    error_info: typing.Optional[ErrorInfoExperimentItemBulkWriteView] = None
    last_updated_at: typing.Optional[dt.datetime] = None
    total_estimated_cost: typing.Optional[float] = None
    total_estimated_cost_version: typing.Optional[str] = None
    ttft: typing.Optional[float] = pydantic.Field(default=None)
    """
    Time to first token in milliseconds
    """

    source: typing.Optional[SpanExperimentItemBulkWriteViewSource] = 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
