| 15 | name: Optional[str] = Field(None, description="The name of the author of this message") |
| 16 | |
| 17 | class ChatCompletionRequest(BaseModel): |
| 18 | model: str = Field(..., description="ID of the model to use") |
| 19 | messages: List[ChatMessage] = Field(..., description="A list of messages comprising the conversation so far") |
| 20 | temperature: Optional[float] = Field(1.0, ge=0, le=2, description="Sampling temperature") |
| 21 | max_tokens: Optional[int] = Field(None, gt=0, description="Maximum number of tokens to generate") |
| 22 | top_p: Optional[float] = Field(1.0, ge=0, le=1, description="Nucleus sampling parameter") |
| 23 | n: Optional[int] = Field(1, ge=1, le=128, description="Number of chat completion choices to generate") |
| 24 | stream: Optional[bool] = Field(False, description="Whether to stream back partial progress") |
| 25 | stop: Optional[Union[str, List[str]]] = Field(None, description="Up to 4 sequences where the API will stop generating") |
| 26 | presence_penalty: Optional[float] = Field(0, ge=-2, le=2, description="Presence penalty parameter") |
| 27 | frequency_penalty: Optional[float] = Field(0, ge=-2, le=2, description="Frequency penalty parameter") |
| 28 | user: Optional[str] = Field(None, description="A unique identifier representing your end-user") |
| 29 | |
| 30 | class CompletionRequest(BaseModel): |
| 31 | model: str = Field(..., description="ID of the model to use") |