Structured output with the AI SDK
This example uses generateText() with Output.object() and a mock model that returns JSON text locally.
Requirements
Steps for running this example in the shell
- Install dependencies:
bash
npm install- Run the script:
bash
npm startOutput
The script prints a validated JavaScript object.