File size: 808 Bytes
3415e39 440cf7f 3415e39 440cf7f 3415e39 440cf7f 3415e39 440cf7f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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
|