Basics
Modes
Overview
Instructor supports several ways to extract data from the response:
Mode::Tools
- uses OpenAI-style tool calls to get the language model to generate JSON following the schema,Mode::JsonSchema
- guarantees output matching JSON Schema via Context Free Grammar, does not support optional properties,Mode::Json
- JSON mode, response follows provided JSON Schema,Mode::MdJson
- uses prompting to get the language model to generate JSON following the schema.
Note: not all modes are supported by all models or providers.
Mode can be set via parameter of Instructor::response()
or Instructor::request()
methods.