File size: 699 Bytes
12fd5f2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""
Pydantic schemas for API request/response validation.
"""

from pydantic import BaseModel, Field
from typing import Optional, Dict


class CorrectionRequest(BaseModel):
    text: str = Field(..., min_length=10, max_length=5000, description="Raw dyslectic text to correct.")
    master_copy: Optional[str] = Field(None, description="Optional master copy to match style toward.")
    style_alpha: float = Field(0.6, ge=0.0, le=1.0, description="Weight given to user's own style (0=full master, 1=full user).")


class CorrectionResponse(BaseModel):
    original: str
    corrected: str
    style_similarity: float
    awl_coverage: float
    readability: Dict[str, float]
    changes_summary: str