(edited)
I’m using ai-sdk for extracting text from PDFs. this code works when i’m using ‘gemini-2.0-flash-exp’ but fails when i use ‘gemini-1.5-pro’ or any other models.
try {console.log(“Calling generateObject with Gemini model…”);
const { object: extractedData } = await generateObject({ model: google('gemini-1.5-pro'), schema: purchaseOrderSchema, messages: [ { role: 'user', content: [ { type: 'file', data: fileData, mediaType: 'application/pdf', }, { type: 'text', text: prompt, } ], }, ],});
console.log("Successfully extracted purchase order data");return extractedData;} catch (error) {