Llm

  • Published on
    Use Pydantic as your LLM contract: prompt with the actual schema, validate every boundary (including strict tool-call args), and turn ValidationErrors into structured retries rather than brittle prompt hacks; keep models provider-agnostic via thin wrappers (OpenAI structured outputs, Instructor, Pydantic AI), log like a flight recorder with prompts/model IDs/retry counts/versioned schemas, and evolve safely with explicit schema_version and migration validators, so rogue enums and bad JSON never touch production.