from pydantic import BaseModel from typing import List, Optional class Error(BaseModel): """Model for individual grammar errors.""" before: str after: str explanation: str class Grammar(BaseModel): """Model for grammar check results.""" spelling: List[Error] punctuation: List[Error] grammar: List[Error] file_path: Optional[str] = None corrected_text: Optional[str] = None