test24 / api /models.py
Niansuh's picture
Update api/models.py
3415e39 verified
raw
history blame
808 Bytes
# api/models.py
from typing import List, Optional, Union
from pydantic import BaseModel
class Message(BaseModel):
role: str
content: Union[str, List[dict]]
class ChatRequest(BaseModel):
model: str
messages: List[Message]
proxy: Optional[str] = None # Assuming proxy might be needed
stream: Optional[bool] = False
temperature: Optional[float] = 0.7
top_p: Optional[float] = 0.9
max_tokens: Optional[int] = 99999999
class ImageResponseModel(BaseModel):
images: List[str]
alt: str
class ChatCompletionChoice(BaseModel):
index: int
message: dict
finish_reason: Optional[str]
class ChatCompletionResponse(BaseModel):
id: str
object: str
created: int
model: str
choices: List[ChatCompletionChoice]
usage: Optional[dict] = None