The Gemini Enterprise Agent Platform Model Garden is the central catalog of foundation models on Google Cloud. Selecting the right model for a task means comparing available models by their capabilities, input and output modalities, pricing, and latency. The Gemini Enterprise Agent Platform provides a set of tools for building conversational agents, and the Model Garden hosts both Google's own models (such as Gemini, Imagen, Veo) and third-party models (such as Llama, Claude). When choosing a model, first identify the task type: text generation, multimodal understanding, image generation, or video generation. For example, Gemini 1.5 Pro handles long context and multimodal inputs, while Gemini 1.5 Flash is faster and cheaper for simpler tasks. For image generation, you would select Imagen, and for video generation, Veo. The choice also depends on the required accuracy, latency budget, and costālarger models are more accurate but slower and more expensive. The Model Garden includes model cards that detail performance benchmarks, licensing, and supported regions, making it easier to compare options. The Enterprise Agent Platform further integrates these models with tools for grounding, retrieval-augmented generation (RAG), and agent orchestration, so the model selection must also consider which of these capabilities are needed.
Industry-specific APIs are pre-built, fully managed services that handle specialized tasks without requiring you to select or train a model. The Document AI API processes documents such as invoices, receipts, and forms, extracting structured data (like key-value pairs, tables, and signatures) from unstructured or semi-structured text. The Vision API provides image analysis capabilities including object detection, optical character recognition (OCR), face detection, and content moderation; it can be used for tasks like scanning product labels or analyzing images. The Translate API offers real-time and batch translation between over 100 languages, with support for custom glossaries and model selection (e.g., Neural Machine Translation or AutoML Translation). These APIs are accessed via REST or gRPC endpoints, and they handle scaling, updates, and fault tolerance automatically. You do not need to manage any infrastructure or tune a modelāyou simply send the data (an image, a document, text) and receive the results. The tradeoff is that you cannot customize the model's behavior beyond what the API parameters allow; for example, Document AI offers specialized processors (like "Expense Parser" or "Invoice Parser") but you cannot retrain the underlying model. This makes these APIs ideal when the task matches a well-defined domain and you lack the time or data to train a custom model.
When a pre-built API or a general foundation model is not enough, you can build a custom solution by tuning a model or using it as a service. Model tuning adjusts a foundation model's weights on a small, task-specific dataset to improve performance on that task. Google Cloud supports supervised fine-tuning for Gemini models, where you provide example input-output pairs, and the model learns to mimic those patterns. For image generation, Imagen can be fine-tuned on a set of product images to generate new variations while preserving brand identity. For video generation, Veo can be fine-tuned on video clips to learn specific styles or motions. Models as a service (MaaS) in Model Garden allow you to deploy a third-party model (like Llama or Mistral) without managing the underlying infrastructureāyou pay per token and the platform handles scaling. The choice between tuning and using a model as-is depends on the amount of labeled data, the required accuracy improvement, and the budget. Tuning requires a curated dataset and incurs training costs, but it can deliver much higher accuracy for niche tasks. Alternatively, you can use prompt engineering (e.g., few-shot prompting, chain-of-thought) with Gemini to guide its output without modifying the model weights. This is cheaper and faster but less reliable for complex tasks. The Gemini Enterprise Agent Platform provides tools for building agents that chain multiple model calls, integrate with external APIs, and use grounding with Google Search or enterprise data.
Optimizing applications built on Gemini models involves balancing three factors: cost per token, response latency, and uptime. Cost is reduced by choosing the appropriate model sizeāGemini 1.5 Flash is cheaper than Gemini 1.5 Pro and should be used for simple tasks, while Pro is reserved for complex reasoning or long-context needs. Caching of frequent responses (e.g., using a key-value store for common queries) avoids repeated model calls. Batching requests into a single API call (when the model supports it) lowers per-token cost. Latency is improved by selecting a model endpoint in a region close to the user, using streaming to receive partial responses as they are generated, and reducing the maximum output token count. The Gemini API supports streaming by default, so you can display results incrementally. Availability is ensured by configuring retries with exponential backoff for transient errors, using redundant endpoints across multiple regions (e.g., us-central1 and europe-west4), and setting up fallback modelsāif the primary model fails, the application can switch to a cheaper or simpler model. The Gemini Enterprise Agent Platform offers a Agent Assist feature that can automatically route requests to different models based on latency or cost thresholds. Finally, monitoring with Cloud Monitoring and Cloud Logging tracks token usage, error rates, and latency percentiles, enabling you to adjust the optimization strategy over time.
Use a pre-built API like Document AI or Vision API when the task matches a well-defined domain and you do not need custom behaviorāthese APIs handle scaling and updates automatically. Use a foundation model when you need to customize the output, handle multimodal inputs, or combine multiple tasks in a single agent.
Fine-tuning modifies the model's weights using your own labeled data, which improves accuracy on a specific task but requires training costs and a curated dataset. Using a model as a service (MaaS) deploys an existing model (e.g., Llama) without any weight changes; you pay per token and the platform manages scaling, but you cannot customize the model's behavior beyond prompt engineering.
Reduce latency by selecting a model endpoint in a region close to your users, enabling streaming to receive partial responses, reducing the maximum output token count, and using Gemini 1.5 Flash instead of Pro for simpler tasks. Caching frequent responses also avoids unnecessary model calls.
Improve availability by configuring retries with exponential backoff, using redundant endpoints across multiple regions, and setting up a fallback model (e.g., a cheaper model) that activates when the primary model fails. Monitor error rates and token usage with Cloud Monitoring and Cloud Logging to adjust the strategy.
Professional Machine Learning Engineer
Prepare and test your skills
Prepare and test your skills