Skip to content

[Platform] Structured Output with Object Instances #1545

@chr-hertel

Description

@chr-hertel

It would be great to populate data into an existing state object like:

class City {
    public function __construct(
        public string $name,
        public int $population,
        public string $country,
        public string $mayor,
    ) {
    }
}

$city = new City('Berlin');
$messages = new MessageBag(
    Message::ofUser('Please research the missing data attributes for this city', $city),
);
$result = $platform->invoke($messages, [
    'response_format' => $city,
]);

dump($result->asObject());
// City('Berlin', 3500000, 'Germany', 'Kai Wegner')

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureNew featureHelp wantedExtra attention is neededPlatformIssues & PRs about the AI Platform component

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions