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

from __future__ import annotations
from ..core.pydantic_utilities import UniversalBaseModel
from .metadata_filters import MetadataFilters
import pydantic
import typing
import datetime as dt
from .pipeline_type import PipelineType
from .pipeline_embedding_config import PipelineEmbeddingConfig
from .configured_transformation_item import ConfiguredTransformationItem
from .pipeline_configuration_hashes import PipelineConfigurationHashes
from .pipeline_transform_config import PipelineTransformConfig
from .preset_retrieval_params import PresetRetrievalParams
from .eval_execution_params import EvalExecutionParams
from .llama_parse_parameters import LlamaParseParameters
from .data_sink import DataSink
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.pydantic_utilities import update_forward_refs


class Pipeline(UniversalBaseModel):
    """
    Schema for a pipeline.
    """

    id: str = pydantic.Field()
    """
    Unique identifier
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Creation datetime
    """

    updated_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Update datetime
    """

    name: str
    project_id: str
    embedding_model_config_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the EmbeddingModelConfig this pipeline is using.
    """

    pipeline_type: typing.Optional[PipelineType] = pydantic.Field(default=None)
    """
    Type of pipeline. Either PLAYGROUND or MANAGED.
    """

    managed_pipeline_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    The ID of the ManagedPipeline this playground pipeline is linked to.
    """

    embedding_config: PipelineEmbeddingConfig
    configured_transformations: typing.Optional[typing.List[ConfiguredTransformationItem]] = pydantic.Field(
        default=None
    )
    """
    Deprecated don't use it, List of configured transformations.
    """

    config_hash: typing.Optional[PipelineConfigurationHashes] = pydantic.Field(default=None)
    """
    Hashes for the configuration of the pipeline.
    """

    transform_config: typing.Optional[PipelineTransformConfig] = pydantic.Field(default=None)
    """
    Configuration for the transformation.
    """

    preset_retrieval_parameters: typing.Optional[PresetRetrievalParams] = pydantic.Field(default=None)
    """
    Preset retrieval parameters for the pipeline.
    """

    eval_parameters: typing.Optional[EvalExecutionParams] = pydantic.Field(default=None)
    """
    Eval parameters for the pipeline.
    """

    llama_parse_parameters: typing.Optional[LlamaParseParameters] = pydantic.Field(default=None)
    """
    Settings that can be configured for how to use LlamaParse to parse files within a LlamaCloud pipeline.
    """

    data_sink: typing.Optional[DataSink] = pydantic.Field(default=None)
    """
    The data sink for the pipeline. If None, the pipeline will use the fully managed data sink.
    """

    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


update_forward_refs(MetadataFilters, Pipeline=Pipeline)
