Object Strategy
Object Strategy
Details
Strategy for generating structured objects based on a JSON Schema. This strategy instructs the LLM to produce valid JSON matching the schema, and handles parsing and validation of the output.
Super class
aisdk::OutputStrategy -> ObjectStrategy
Public fields
schemaThe schema definition (from z_object, etc.).
schema_nameHuman-readable name for the schema.
Methods
Method new()
Initialize the ObjectStrategy.
Usage
ObjectStrategy$new(schema, schema_name = "json_schema")Method validate()
Validate and parse the LLM output as JSON.