laravel/ai

Structured output validation

Open

#189 aberto em 19 de fev. de 2026

Ver no GitHub
 (4 comments) (2 reactions) (0 assignees)PHP (261 forks)github user discovery
help wantedneeds more info

Métricas do repositório

Stars
 (978 stars)
Métricas de merge de PR
 (Mesclagem média 6d 11h) (49 fundiu PRs em 30d)

Description

Hi

I am a bit new to laravel/ai but I have a question regarding agents that implements HasStructuredOutput

If the structured format of the StructuredAgentResponse doesn't follow the format defined in the schema - shouldn't an exception be thrown? Should this happen on the Prism level, the Laravel/Ai level - or am I supposed to do this myself?

I don't really see any point in structured output if I have no guarantee that the result will conform to my schema.

Guia do colaborador