<?php
require 'examples/boot.php';
use Cognesy\Config\Settings;
use Cognesy\Instructor\StructuredOutput;
class UserDetail
{
public int $age;
public string $firstName;
public ?string $lastName;
}
// set the configuration path to custom directory
Settings::setPath(__DIR__ . '/config');
$user = (new StructuredOutput)
->withDebugPreset('on') // we reconfigured local debug settings to dump only request URL
->withMessages('Jason is 25 years old.')
->withResponseClass(UserDetail::class)
->get();
dump($user);
assert(!isset($user->lastName) || $user->lastName === '');
?>