Define the schema
from pydantic import BaseModel
class Weather(BaseModel):
location: str
temperature_c: float
condition: str
Weather(location='Berlin', temperature_c=18.3, condition='Sunny')
If the model sends invalid JSON, the helper retries parsing and raises a clear exception if
validation ultimately fails.