General Principles
- State the task plainly. A short, direct instruction outperforms a wall of text.
- Provide the source material. Pass the text you want analyzed as part of the message.
- Let the schema do the heavy lifting. Prefer changing the response model before adding more prompt detail.
Use PHPDoc Comments as Instructions
The model receives your class structure as a JSON Schema. PHPDoc comments on the class and its properties becomedescription fields in that schema, giving the model precise guidance without
bloating the prompt.
Nullable Fields for Optional Data
Use PHP’s nullable types and set a default ofnull to signal that a field is truly optional.
This prevents the model from inventing values when the source text does not contain the information.