File size: 1,064 Bytes
ed3a9a0 | 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 | """Pydantic request models for the RASAD API."""
from __future__ import annotations
from typing import Optional
from pydantic import BaseModel, Field, HttpUrl
class VerifyURLRequest(BaseModel):
"""Verify a news article by URL."""
url: HttpUrl
priority: str = Field(default="normal", pattern="^(low|normal|high)$")
language: str = Field(default="auto", pattern="^(auto|ar|en)$")
include_breakdown: bool = True
class VerifyTextRequest(BaseModel):
"""Verify a free-text claim."""
text: str = Field(..., min_length=10, max_length=50000)
language: str = Field(default="auto", pattern="^(auto|ar|en)$")
include_breakdown: bool = True
class VerifyMediaRequest(BaseModel):
"""Verify a media file (image/video). Used as JSON metadata alongside the multipart upload."""
context_text: Optional[str] = Field(default=None, max_length=2000)
media_type: str = Field(default="image", pattern="^(image|video|audio)$")
language: str = Field(default="auto", pattern="^(auto|ar|en)$")
include_breakdown: bool = True
|