Help with ai-sdk/google

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) {

gemini-1.5-pro has been retired by Google, you can find the list of available models here

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.