Spaces:
Running
Running
| 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 |