Spaces:
Running
Running
File size: 1,374 Bytes
a2e3298 cde2f6e a2e3298 | 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 | from typing import List, Optional, Any
from pydantic import BaseModel, Field
class Message(BaseModel):
role: str = Field(..., description="Role of the message sender (user/assistant/system)")
content: str = Field(..., description="Content of the message")
class ChatRequest(BaseModel):
messages: List[Message] = Field(..., description="List of messages in the conversation")
temperature: Optional[float] = Field(0.6, ge=0.0, le=2.0, description="Sampling temperature")
max_tokens: Optional[int] = Field(512, ge=1, le=4096, description="Maximum tokens to generate")
stream: Optional[bool] = Field(False, description="Enable streaming response")
returnJson: Optional[bool] = Field(False, description="Extract and return JSON from response")
class VisionRequest(BaseModel):
prompt: str = Field(..., description="Text prompt/question about the image")
temperature: Optional[float] = Field(0.6, ge=0.0, le=2.0, description="Sampling temperature")
max_tokens: Optional[int] = Field(512, ge=1, le=4096, description="Maximum tokens to generate")
return_json: Optional[bool] = Field(False, description="Extract and return JSON from response")
class ErrorResponse(BaseModel):
error: str
detail: Optional[str] = None
class HealthResponse(BaseModel):
status: str
text_model: bool
vision_model: bool
timestamp: str |