instructor
Instructor is an open-source library for obtaining structured outputs from large language models (LLMs). It was originally implemented in Python and offers versions in multiple languages, including TypeScript, Ruby, Go, Elixir, and Rust. Users define the desired data structure with Pydantic models, and Instructor requests the corresponding fields from the LLM and validates the returned results; if validation fails, it can automatically retry based on Pydantic's error messages. It supports streaming output and extraction of nested complex structures, and is compatible with several major LLM providers. The project is under the MIT license, and the official sources state that it has more than 3 million monthly downloads and over 10,000 GitHub stars, and is used by teams at OpenAI, Google, Microsoft, AWS, and many startups.