Mastering Controlled Generation with Gemini 1.5: Schema Adherence for Developers- Google Developers Blog
Sep 3, 2024Lewis Liu, Terry Koo

Summary
This post introduces Controlled Generation for Gemini 1.5 Flash and adds 'enum' support, enabling developers to reliably generate responses that adhere to a defined schema. It also notes that controlled generation is automatically enabled when using function calling on Gemini 1.5. The post explains the importance of controlled generation for producing machine-readable data, seamless API integration, and predictable outputs. It details the 'response schema' concept, built on OpenAPI 3.0, and highlights Google's 'secret sauce' for controlled generation: minimal latency, enum support, and no data storage. Examples are provided for generating JSON recipes and classifying product condition with enum schemas.
More from the Predictive APIs and Machine Learning Integration trail
- Expanding Choice in Gemini Enterprise Agent Platform: Introducing Grounding with Parallel Web Search- Google Developers Blog
- Evolving Spec-Driven Development: Conductor Now Supports Antigravity- Google Developers Blog
- Building scalable AI agents with modular prompt transpilation- Google Developers Blog
- LiteRT.js, Google's high performance Web AI Inference- Google Developers Blog
- Gemma 4 12B: The Developer Guide- Google Developers Blog