NOTE: Philosophy behind Instructor was formulated by Jason Liu, the creator of original version of Instructor in Python and adapted for the PHP port.Instructor values simplicity and flexibility in leveraging language models. It offers a streamlined approach for structured output, avoiding unnecessary dependencies or complex abstractions.
“Simplicity is a great virtue, but it requires hard work to achieve it and education to appreciate it. And to make matters worse: complexity sells better.” — Edsger Dijkstra
responseModel
and StructuredOutput::create()
to get started.StructuredOutput::create()
with data schemas fed in via responseModel
.class SomeStructuredData { ... }
function extract($input) : SomeStructuredData
function compute(SomeStructuredData $data):
or call methods on your
schema $data->compute()