Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

cognesy/instructor-struct

Open more actions menu

Repository files navigation

Instructor Package

Core structured-output engine for InstructorPHP.

Use it to turn unstructured LLM responses into typed PHP data, with validation, retries, and streaming updates.

Example

<?php

use Cognesy\Instructor\StructuredOutput;
use Cognesy\Polyglot\Inference\Config\LLMConfig;

class Person {
    public string $name;
    public int $age;
}

$person = StructuredOutput::fromConfig(LLMConfig::fromArray(['driver' => 'openai']))
    ->with(
        messages: 'His name is Jason and he is 28 years old.',
        responseModel: Person::class,
    )
    ->get();

Documentation

  • packages/instructor/docs/quickstart.md
  • packages/instructor/docs/essentials/usage.md
  • packages/instructor/docs/_meta.yaml

About

[READ-ONLY] Structured outputs from LLMs

Resources

License

MIT, MIT licenses found

Licenses found

MIT
LICENSE
MIT
LICENSE.md

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.