-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
Description
Description
I used Vercel's SDK example:
import { google } from '@ai-sdk/google';
import { NextRequest, NextResponse } from 'next/server';
import { generateObject } from "ai";
import { z } from "zod";
// Initialize the Gemini model
const model = google('gemini-2.5-pro');
export async function POST(request: NextRequest) {
const { object } = await generateObject({
model: model,
schema: z.object({
recipe: z.object({
name: z.string(),
ingredients: z.array(z.string()),
steps: z.array(z.string()),
}),
}),
prompt: 'Generate a lasagna recipe.',
});
console.log(JSON.stringify(object, null, 2));
}
And i was using Google models such as Gemini-2.5-pro. It seems like the generateObject is not performing type validation properly at all.
AI SDK Version
ai 4.3.19
antoniojps, JoeyEamigh and jerocosio