new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

google-gemini/capabilities

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Google Gemini 2.5 Flash Image generation uses generateText not generateImage

Gemini 2.5 Flash Image is a language model with multimodal capabilities. To generate images with this model, use the generateText or streamText functions, not the generateImage function. The model determines which modality to respond in based on the prompt and configuration.

Generated images returned in result.files array

When using generateText with Gemini 2.5 Flash Image for image generation, generated images are returned in the result.files array as Uint8Array data with a mediaType property that identifies them as images.

Google Gemini 2.5 Flash Image can edit images with natural language

Gemini 2.5 Flash Image excels at editing existing images with natural language instructions. You can add elements, modify styles, or transform images while maintaining their core characteristics by passing an image file and text instructions in the content array.

Image editing with Gemini 2.5 Flash Image using file input

To edit an image with Gemini 2.5 Flash Image, include a message with both text content and file content. The file content object has type 'file' and includes a data field (string, Uint8Array, ArrayBuffer, or Buffer, or URL) and a mediaType field specifying the image format.

Google Gemini image generation example code

import { generateText } from 'ai'; import fs from 'node:fs'; import 'dotenv/config'; async function generateImage() { const result = await generateText({ model: 'google/gemini-2.5-flash-image', prompt: 'Create a picture of a nano banana dish in a fancy restaurant with a Gemini theme', }); // Save generated images for (const file of result.files) { if (file.mediaType.startsWith('image/')) { const timestamp = Date.now(); const fileName = `generated-${timestamp}.png`; fs.mkdirSync('output', { recursive: true }); await fs.promises.writeFile(`output/${fileName}`, file.uint8Array); console.log(`Generated and saved image: output/${fileName}`); } } } generateImage().catch(console.error); This example shows how to generate an image from a text prompt and save it to a file.

Google Gemini image editing example code

import { generateText } from 'ai'; import fs from 'node:fs'; import 'dotenv/config'; async function editImage() { const editResult = await generateText({ model: 'google/gemini-2.5-flash-image', prompt: [ { role: 'user', content: [ { type: 'text', text: 'Add a small wizard hat to this cat. Keep everything else the same.', }, { type: 'file', // data: DataContent (string | Uint8Array | ArrayBuffer | Buffer) or URL data: new URL( 'https://raw.githubusercontent.com/vercel/ai/refs/heads/main/examples/ai-functions/data/comic-cat.png', ), mediaType: 'image/jpeg', }, ], }, ], }); // Save the edited image const timestamp = Date.now(); fs.mkdirSync('output', { recursive: true }); for (const file of editResult.files) { if (file.mediaType.startsWith('image/')) { await fs.promises.writeFile( `output/edited-${timestamp}.png`, file.uint8Array, ); console.log(`Saved edited image: output/edited-${timestamp}.png`); } } } editImage().catch(console.error); This example shows how to edit an existing image by passing a file and natural language instructions.

Give your agent this brain