Generate object

Generate object with Vercel's AI SDK
typescript

  const { response } = await generateObject({
    model: openai('gpt-4o-mini'),
    system: 'You are a helpful assistant.',
    prompt,
    schema: z.object({
      notifications: z.array(
        z.object({
          name: z.string().describe('Name of a fictional person.'),
          message: z.string().describe('Do not use emojis or links.'),
          minutesAgo: z.number(),
        })
      ),
    })
  });