DeepMind developer reveals how Gemini writes prompts for every other model

AI Engineer////7 min read

The strategy of generative orchestration

DeepMind developer reveals how Gemini writes prompts for every other model
Let's go Bananas with GenMedia — Guillaume Vernade, Google DeepMind

Building a complex multimedia project often stalls at the prompt engineering stage. When you are trying to illustrate an entire book, the sheer volume of descriptions, character consistency issues, and thematic alignment can overwhelm even the most patient developer. Guillaume Vernade, a developer advocate at Google DeepMind, demonstrates a workflow where Gemini acts as the central orchestrator, translating raw source text into specialized instructions for image, video, and audio models.

This isn't just about automation; it's about leveraging the fact that many GenMedia models were actually trained on data annotated or described by Gemini itself. There is a native linguistic alignment between these systems. By feeding a full open-source book like The Wind in the Willows into Gemini's massive context window, you transform the model into a creative director that understands the characters, the plot, and the emotional arc, allowing it to generate the highly specific prompts required for Imagen or Veo to produce consistent results.

Setting up the development environment and SDKs

To begin this kind of multi-modal pipeline, you need the Google GenAI SDK. The ecosystem is currently split between AI Studio and Vertex AI. While Vertex AI offers enterprise-grade control over data residency and bucket security, AI Studio is the preferred sandbox for rapid prototyping due to its simplified API key management and file upload features.

One critical architectural decision is how you handle model overload and rate limits. The Google GenAI SDK allows for an auto-retry configuration, which is essential when working with preview models like Imagen 3 or Veo.

# Basic client initialization with auto-retry logic
client = genai.Client(
    api_key="YOUR_API_KEY",
    http_options={'retries': 5}
)

When initializing your clients, you must select specific model strings for different tasks. For the orchestration layer, Gemini 1.5 Flash is often sufficient and more cost-effective than Gemini 1.5 Pro, though the latter is better for extremely complex reasoning tasks. For media generation, you might target imagen-3.0-generate-002 for images and veo-1.0-generate for video. These models frequently update, so staying current with the latest model identifiers is a core part of the maintenance cycle.

Managing state with the Interactions API

A common bottleneck in generative pipelines is the stateless nature of standard REST calls. If you are asking Gemini to generate prompts for twelve chapters, traditionally you would have to re-upload the entire book or the previous conversation history with every single request. This increases latency and burns through token quotas rapidly.

Google DeepMind recently introduced the Interactions API to solve this. This API makes calls stateful by providing an interaction_id. When you send a subsequent request with that ID, the server already has the context cached, removing the need for redundant data transfers. This is particularly transformative for "branching" workflows where you might generate a scene's text in one branch and its corresponding music in another, all stemming from the same initial book upload.

# Conceptualizing the interaction flow
response = client.models.generate_content(
    model="gemini-2.0-flash",
    contents="Summarize the first chapter of this book.",
    config=types.GenerateContentConfig(interaction_mode=True)
)
interaction_id = response.interaction_id

# Future calls use the ID to maintain state without resending the book
follow_up = client.models.generate_content(
    model="gemini-2.0-flash",
    contents="Now write a music prompt for that summary.",
    interaction_id=interaction_id
)

Achieving character consistency across modalities

The most difficult hurdle in illustrating a narrative is ensuring that Mole looks like Mole in every single chapter. If you rely on raw text prompts alone, the model might give him a blue coat in chapter one and a red vest in chapter two. To solve this, you use a multi-step image-to-image or image-as-reference strategy.

First, have Gemini generate a master portrait for each character. Store these images. When you move on to illustrating a chapter scene, you don't just send the text prompt; you send the master portrait of the character as an image reference. This tells the generation model: "The character in this scene should look exactly like this."

For Veo, the video generation model, this becomes even more powerful. You can pass a generated image as the first_frame. This ensures the video starts with the exact visual fidelity and character design you established in the image phase, drastically reducing the temporal flickering or character morphing that plagues standard text-to-video generation.

Engineering synthetic voices and musical scores

The final layer of the workshop involves Lyria for music and Text-to-Speech (TTS) for dialogue. Lyria is unique because it accepts structural commands directly in the prompt. You can specify a verse-chorus-verse structure, set the BPM, or even ask for a specific instrument to enter at a specific timestamp.

# A structured music prompt for Lyria
music_prompt = """
    0:00-0:10: Slow acoustic guitar intro, pastoral and calm.
    0:10-0:20: Add light woodwinds, represent the flowing river.
    0:20-0:30: Full folk ensemble with a cheerful tempo.
"""
music_response = client.models.generate_content(
    model="lyria-1.0-clip",
    contents=music_prompt
)

A brilliant trick for Text-to-Speech involves manipulating speaker styles within a single voice model. Instead of needing dozens of different voice actors, you can use a single high-quality voice and steer it using parenthetical style instructions like (whispering), (excitedly), or (with a deep, slow rasp). When combined with Gemini's ability to rewrite book dialogue into a play format, you can create a multi-character audio experience using only one or two base voice profiles. It's a testament to the power of steering models through natural language rather than just raw parameter tuning.

Practical tips and debugging generative pipelines

Working with this many moving parts requires a methodical approach to debugging. First, always use structured output (JSON) for your orchestration layer. If you ask Gemini for a prompt and it returns a conversational paragraph, your automated script will break. By providing a JSON Schema, you ensure the model returns exactly what your downstream GenMedia models expect.

Second, keep an eye on your service tier. Google has introduced a "Priority" tier which, for roughly twice the cost, places your requests in a fast track. This is vital for live workshops or real-time applications where a 45-second wait for a video generation is unacceptable. Conversely, the "Flex" tier offers a 50% discount if you can tolerate longer latency.

Finally, remember that the "Why" matters. We use these models not just to make content, but to build world models. Whether it is a real-time DJ app using Lyria Realtime that changes based on a player's location in a game, or a Text-to-Speech system that reads a grocery list as an epic opera, the goal is seamless integration across all five senses. The code is the bridge between the raw data of a book and a living, breathing media experience.

Topic DensityMention share of the most discussed topics · 29 mentions across 14 distinct topics
Gemini
24%· products
Text-to-Speech
10%· products
Veo
10%· products
AI Studio
7%· products
GenMedia
7%· products
Other topics
41%
End of Article
Source video
DeepMind developer reveals how Gemini writes prompts for every other model

Let's go Bananas with GenMedia — Guillaume Vernade, Google DeepMind

Watch

AI Engineer // 1:17:14

We turn high signal in-person events for the top AI engineers, founders, leaders, and researchers in the world into the best free learning opportunities for millions around the world here on YouTube. Your subscribes, likes, comments, speaking, attendance, or sponsorships goes a long way toward making our biz model sustainable indefinitely. We strongly believe this industry deserves a better class of community and that we know how to do this well; we just need your support.

Who and what they mention most
Anthropic
26.9%21
Claude
21.8%17
OpenAI
19.2%15
Cursor
15.4%12
7 min read0%
7 min read