Files
instructor/instructor/mode.py
T
2024-03-07 02:07:11 -05:00

29 lines
740 B
Python

import enum
import warnings
class Mode(enum.Enum):
"""The mode to use for patching the client"""
FUNCTIONS = "function_call"
PARALLEL_TOOLS = "parallel_tool_call"
TOOLS = "tool_call"
MISTRAL_TOOLS = "mistral_tools"
JSON = "json_mode"
MD_JSON = "markdown_json_mode"
JSON_SCHEMA = "json_schema_mode"
def __new__(cls, value: str) -> "Mode":
member = object.__new__(cls)
member._value_ = value
# Deprecation warning for FUNCTIONS
if value == "function_call":
warnings.warn(
"FUNCTIONS is deprecated and will be removed in future versions",
DeprecationWarning,
stacklevel=2,
)
return member