2024-01-02 23:42:00 +08:00
|
|
|
import enum
|
2024-04-15 00:23:42 +08:00
|
|
|
from typing import Any
|
2024-01-02 23:42:00 +08:00
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class PromptMessageFileType(enum.Enum):
|
2024-09-10 17:00:20 +08:00
|
|
|
IMAGE = "image"
|
2024-01-02 23:42:00 +08:00
|
|
|
|
|
|
|
@staticmethod
|
|
|
|
def value_of(value):
|
|
|
|
for member in PromptMessageFileType:
|
|
|
|
if member.value == value:
|
|
|
|
return member
|
|
|
|
raise ValueError(f"No matching enum found for value '{value}'")
|
|
|
|
|
|
|
|
|
|
|
|
class PromptMessageFile(BaseModel):
|
|
|
|
type: PromptMessageFileType
|
2024-06-14 01:05:37 +08:00
|
|
|
data: Any = None
|
2024-01-02 23:42:00 +08:00
|
|
|
|
|
|
|
|
|
|
|
class ImagePromptMessageFile(PromptMessageFile):
|
|
|
|
class DETAIL(enum.Enum):
|
2024-09-10 17:00:20 +08:00
|
|
|
LOW = "low"
|
|
|
|
HIGH = "high"
|
2024-01-02 23:42:00 +08:00
|
|
|
|
|
|
|
type: PromptMessageFileType = PromptMessageFileType.IMAGE
|
|
|
|
detail: DETAIL = DETAIL.LOW
|