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

import enum
import typing

T_Result = typing.TypeVar("T_Result")


class ChatStreamRequestPromptTruncation(str, enum.Enum):
    """
    Defaults to `AUTO` when `connectors` are specified and `OFF` in all other cases.

    Dictates how the prompt will be constructed.

    With `prompt_truncation` set to "AUTO", some elements from `chat_history` and `documents` will be dropped in an attempt to construct a prompt that fits within the model's context length limit.

    With `prompt_truncation` set to "OFF", no elements will be dropped. If the sum of the inputs exceeds the model's context length limit, a `TooManyTokens` error will be returned.
    """

    OFF = "OFF"
    AUTO = "AUTO"

    def visit(self, off: typing.Callable[[], T_Result], auto: typing.Callable[[], T_Result]) -> T_Result:
        if self is ChatStreamRequestPromptTruncation.OFF:
            return off()
        if self is ChatStreamRequestPromptTruncation.AUTO:
            return auto()
