Instructor is a tool that enables developers to extract structured data from natural language using Large Language Models (LLMs). Integrating with Python's Pydantic library allows users to define desired output structures through type hints, facilitating schema validation and seamless integration with IDEs. Instructor supports various LLM providers, including OpenAI, Anthropic, Litellm, and Cohere, offering flexibility in implementation. Its customizable nature permits the definition of validators and custom error messages, enhancing data validation processes. Instructor is trusted by engineers from platforms like Langflow, underscoring its reliability and effectiveness in managing structured outputs powered by LLMs. Instructor is powered by Pydantic, which is powered by type hints. Schema validation and prompting are controlled by type annotations; less to learn, and less code to write, and it integrates with your IDE.
Features
- Response Models: Specify Pydantic models to define the structure of your LLM outputs
- Retry Management: Easily configure the number of retry attempts for your requests
- Validation: Ensure LLM responses conform to your expectations with Pydantic validation
- Streaming Support: Work with Lists and Partial responses effortlessly
- Flexible Backends: Seamlessly integrate with various LLM providers beyond OpenAI
- Support in many Languages: We support many languages including Python, TypeScript, Ruby, Go, and Elixir