Recent advancements in AI have led to significant improvements in how we interact with language models, particularly in generating and validating structured data using tools like Pydantic and OpenAI. This text explores using Pydantic to define schemas for data classes, which aids in validating and generating JSON schemas for structured data outputs from language models. It highlights the challenges of handling language model outputs that may not initially conform to valid JSON and suggests leveraging OpenAI's tool-calling capabilities to specify desired output formats more effectively. Furthermore, a new library called Instructor is introduced, which enhances the OpenAI client by simplifying the process of data validation and restructuring, allowing for the generation of reliable and semantically meaningful outputs. The text provides practical examples, such as modeling complex search queries with Pydantic, demonstrating how these techniques enable the creation of structured data from language models, thus improving data quality and application performance.