Skip to main content

generate_json_view

Function generate_json_view 

Source
pub fn generate_json_view(
    name: &str,
    description: &str,
    layout: &str,
) -> Result<String, String>
Expand description

Two-pass AI generation of a JSON-UI v2 spec file.

Pass 1 (describe): asks the model for a plain-text component plan. Pass 2 (structure): constrains output to the full spec JSON Schema via tool_use.

On validation failure, prints a yellow warning and returns an error so the caller can fall back to the static template.