generateObject for typed outputs.
Notes
- Prefer explicit enums and required fields in schemas.
- Keep prompts aligned with the schema shape.
- Handle parse/validation errors in caller code.
Documentation Index
Fetch the complete documentation index at: /docs/llms.txt
Use this file to discover all available pages before exploring further.
Generate schema-validated JSON objects with Phaseo and Vercel AI SDK.
generateObject for typed outputs.
import { phaseo } from "@phaseo/ai-sdk-provider";
import { generateObject } from "ai";
import { z } from "zod";
const { object } = await generateObject({
model: phaseo("openai/gpt-5-nano"),
schema: z.object({
title: z.string(),
priority: z.enum(["low", "medium", "high"]),
actions: z.array(z.string()),
}),
prompt: "Create a short incident follow-up plan.",
});
console.log(object);
Was this page helpful?