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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .remote_auth import RemoteAuth


class CreateOpenAiEncoderRequest(UniversalBaseModel):
    """
    Configuration for an OpenAI-compatible encoder
    """

    type: typing.Literal["openai-compatible"] = "openai-compatible"
    name: str = pydantic.Field()
    """
    A unique name for the encoder
    """

    description: str = pydantic.Field()
    """
    A description of what this encoder does
    """

    output_dimensions: typing.Optional[int] = pydantic.Field(default=None)
    """
    The number of dimensions in the output embedding vector. If provided and the model supports truncation,
    the response will be truncated to this number of dimensions.
    """

    uri: str = pydantic.Field()
    """
    The URI endpoint for the embedding API (can be OpenAI or any compatible embedding API endpoint)
    """

    model: str = pydantic.Field()
    """
    The model name to use for embeddings
    """

    auth: typing.Optional[RemoteAuth] = 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
