> ## Documentation Index
> Fetch the complete documentation index at: https://phaseo.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# 结构化输出（AI SDK）

> 使用 Phaseo 和 Vercel AI SDK 生成经过 Schema 验证的 JSON 对象。

使用 `generateObject` 获取类型化输出。

```ts theme={null}
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);
```

## 说明

* Schema 中优先使用显式枚举和必填字段。
* 确保提示词与 Schema 结构一致。
* 在调用方代码中处理解析/验证错误。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.