<?php
require 'examples/boot.php';
use Cognesy\Instructor\StructuredOutput;
class UserDetail
{
public int $age;
public string $firstName;
public ?string $lastName;
}
$user = (new StructuredOutput)
->withMessages('Jason is 25 years old.')
->withResponseClass(UserDetail::class)
->get();
dump($user);
assert(!isset($user->lastName) || $user->lastName === '');
?>