AI APIs and Gemini applications
Professional Machine Learning Engineer · Lesson 3 of 19 · 16:32
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Google Cloud Professional Machine Learning Engineer exam, on the official exam guide. In this lesson: Document AI processors, the Vision API, Cloud Translation, image and video generation models (Imagen, Gemini image models, Veo), partner models as a managed API, supervised tuning of Gemini, and cost, latency, and availability: context caching, batch inference, Provisioned Throughput, and the global endpoint. Includes three original practice questions, with Cymbal Insurance, a fictional car and home insurer, as the example.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Build before you train
Every week, Cymbal Insurance receives thousands of claim forms, garage invoices, and photos, and calls in four languages. Training a model for each of these jobs would take months. Google Cloud already offers APIs and generative models for most of them, so the first question is always: is there a ready service that does this?
Industry-specific APIs
Document AI turns documents into structured data, through processors. Enterprise Document OCR digitizes text and layout, the Form Parser pulls tables and key value pairs out of forms, pretrained parsers handle common documents like invoices and identity cards, and a custom extractor learns the fields of your own documents. The Vision API analyzes images: labels, objects, text, faces, and landmarks. Cloud Translation translates text, with a basic edition for plain translation, and an advanced edition with glossaries, document and batch translation, and a translation model that adapts from a few example pairs. Each one is a managed API: you send data, and you get results, with no model to train.
Images, video, and partner models
For generated media, Agent Platform offers image generation models, like Imagen and the newer Gemini image models, and video generation with Veo and Gemini Omni, from a text prompt or a first image. Partner models, like Claude or Mistral, are served as a managed API, so you call them like Gemini, with no infrastructure to manage. When a prompt alone cannot give the behavior you need, supervised tuning adapts a Gemini model with your own examples of prompts and expected answers. The tuned model gets its own endpoint, and you call it like the base model.
Optimizing Gemini applications
Three levers shape cost, latency, and availability. First, the model: a smaller, faster model costs less and answers sooner. Second, how you send requests: context caching reuses a long shared prefix, like a policy handbook, at a lower cost, and batch inference processes large volumes asynchronously, at a discounted rate, when nobody waits for the answer. Third, capacity: Standard pay as you go shares capacity with other customers, Priority pay as you go gives more consistent performance, and Provisioned Throughput reserves throughput for a fixed fee, for critical, steady traffic. For availability, the global endpoint routes requests to the region with the most capacity, and a retry with exponential backoff absorbs resource exhausted errors.
When not to use the global endpoint
One caution about the global endpoint: you cannot choose or know the region that processes each request. So when regulations require processing in a given region, use a regional or multi-region endpoint instead.
Recap
Let's recap. Document AI processors turn documents into structured data, the Vision API analyzes images, and Cloud Translation translates text. Image models like Imagen, and video models like Veo, generate media, and partner models run as a managed API. Supervised tuning adapts Gemini with your own examples. Context caching and batch inference lower the cost of requests, and Provisioned Throughput reserves capacity. And the global endpoint improves availability, unless the processing region is regulated.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
Cymbal Insurance receives scanned accident report forms, and needs the fields and the tables on each form as structured data for its claims database. Which service fits best?
- The Document AI Form Parser
- Label detection in the Vision API
- Cloud Translation, Advanced edition
- A custom vision model trained from scratch
Show the answer
The Document AI Form Parser
The Document AI Form Parser pulls key value pairs and tables out of forms. “Label detection in the Vision API” only labels what an image shows, like a car or a tree. “Cloud Translation, Advanced edition” would translate the text, without structuring the fields. And “A custom vision model trained from scratch” would take months to build what a processor already does.
Every night, the team summarizes the day’s 40,000 closed claims with Gemini, and the summaries are only read the next morning. How can it cut the cost the most?
- Buy Provisioned Throughput for the night
- Switch to Priority pay as you go
- Send the requests as a batch inference job
- Split the claims across several projects
Show the answer
Send the requests as a batch inference job
Batch inference processes the night's requests asynchronously, at a discounted rate, and nobody waits for the answers. “Buy Provisioned Throughput for the night” would buy reserved capacity, which suits steady real-time traffic. “Switch to Priority pay as you go” would make each request faster, but at a higher price. And “Split the claims across several projects” would add work and risk, without lowering the price of each request.
The adjusters’ assistant sends the same long claims handbook with every question, and most requests repeat that same opening text. Which option lowers cost and latency?
- Send the requests to the global endpoint
- Use context caching for the handbook
- Remove the handbook from the prompts
- Retrain a model on the handbook every week
Show the answer
Use context caching for the handbook
Context caching reuses the repeated handbook, so those tokens cost less, and responses come back sooner. “Send the requests to the global endpoint” only moves requests to another region, and still sends the whole handbook every time. “Remove the handbook from the prompts” would remove the context the assistant needs. And “Retrain a model on the handbook every week” would retrain a model whenever the handbook changes.