cognesy/instructor-struct

Structured data extraction in PHP, powered by LLMs - core library

Maintainers

👁 ddebowczyk

Package info

github.com/cognesy/instructor-struct

Homepage

Issues

pkg:composer/cognesy/instructor-struct

Statistics

Installs: 238

Dependents: 6

Suggesters: 1

Stars: 0

v2.3.1 2026-03-30 09:17 UTC

Suggests

Provides

None

Conflicts

None

Replaces

None

MIT 6e41c936d41f05ec4dcb651de924d44b8b8c306c

  • Dariusz Debowczyk <ddebowczyk.woop@gmail.com>

automationinferencedata extractionaidata processingopenaillmanthropicollamalanguage modelsgenaicoherestructured outputsemantic processing


README

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