Documentation Index Fetch the complete documentation index at: https://mintlify.com/GoogleCloudPlatform/generative-ai/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
Generative AI on Google Cloud enables organizations to transform their workflows across industries. This section showcases real-world use cases with working code examples from production implementations.
Use Case Categories
Our use cases span multiple domains, each demonstrating practical applications of Gemini and other generative AI models:
Document Processing Extract, classify, summarize, and analyze documents with multimodal AI
Customer Support Build intelligent chatbots and automate support workflows
Code Generation Accelerate development with AI-powered coding assistance
Data Analytics Generate SQL, extract insights, and automate analysis with BigQuery
Education Create personalized learning experiences and educational content
Healthcare Improve medical coding, clinical documentation, and patient care
Marketing Generate compelling content and personalized campaigns
Finance Automate KYC, risk analysis, and financial document processing
Common Implementation Patterns
Across these use cases, several powerful patterns emerge:
Multimodal Understanding
Gemini’s native multimodality enables processing of text, images, audio, video, and PDFs in a single request:
from google import genai
from google.genai.types import Part
client = genai.Client( vertexai = True , project = PROJECT_ID , location = LOCATION )
response = client.models.generate_content(
model = "gemini-2.0-flash" ,
contents = [
"Analyze this document and image:" ,
Part.from_uri( file_uri = "gs://bucket/document.pdf" , mime_type = "application/pdf" ),
Part.from_uri( file_uri = "gs://bucket/image.jpg" , mime_type = "image/jpeg" ),
],
)
print (response.text)
Structured Output
Control generation format using Pydantic models or JSON schemas:
from pydantic import BaseModel
from google.genai.types import GenerateContentConfig
class ProductInfo ( BaseModel ):
name: str
price: float
category: str
in_stock: bool
response = client.models.generate_content(
model = "gemini-2.0-flash" ,
contents = "Extract product information from this description..." ,
config = GenerateContentConfig(
response_schema = ProductInfo,
response_mime_type = "application/json" ,
),
)
product = response.parsed # Pydantic model instance
Function Calling
Extend model capabilities by connecting to external tools and APIs:
from google.genai.types import FunctionDeclaration, Tool
get_weather = FunctionDeclaration(
name = "get_weather" ,
description = "Get current weather for a location" ,
parameters = {
"type" : "OBJECT" ,
"properties" : {
"location" : { "type" : "STRING" , "description" : "City name" }
},
},
)
tool = Tool( function_declarations = [get_weather])
response = client.models.generate_content(
model = "gemini-2.0-flash" ,
contents = "What's the weather in San Francisco?" ,
config = GenerateContentConfig( tools = [tool]),
)
if response.function_calls:
for call in response.function_calls:
print ( f "Function: { call.name } " )
print ( f "Args: { call.args } " )
Retrieval Augmented Generation (RAG)
Ground responses in your own data using vector search:
from langchain.vectorstores import FAISS
from langchain_google_vertexai import VertexAIEmbeddings
# Create embeddings and vector store
embeddings = VertexAIEmbeddings( model_name = "text-embedding-005" )
db = FAISS .from_documents(documents, embeddings)
# Retrieve relevant context
retriever = db.as_retriever( search_kwargs = { "k" : 5 })
relevant_docs = retriever.get_relevant_documents(query)
# Generate with context
context = " \n " .join([doc.page_content for doc in relevant_docs])
response = client.models.generate_content(
model = "gemini-2.0-flash" ,
contents = f "Context: { context } \n\n Question: { query } " ,
)
Grounding with Google Search
Enable real-time web search for up-to-date information:
from google.genai.types import GoogleSearch, Tool
search_tool = Tool( google_search = GoogleSearch())
response = client.models.generate_content(
model = "gemini-2.0-flash" ,
contents = "What are the latest developments in quantum computing?" ,
config = GenerateContentConfig( tools = [search_tool]),
)
print (response.text)
for chunk in response.candidates[ 0 ].grounding_metadata.search_entry_point.rendered_content:
print ( f "Source: { chunk } " )
Best Practices
Start with the Right Model
Use gemini-2.0-flash for fast, cost-effective tasks and gemini-2.5-pro for complex reasoning
Leverage System Instructions
Define clear system instructions to guide model behavior consistently
Use Structured Output
Constrain responses with schemas for reliable downstream processing
Implement Error Handling
Handle rate limits, timeouts, and validation errors gracefully
Monitor and Evaluate
Track model performance, costs, and user satisfaction metrics
Next Steps
Explore specific use cases to see complete implementations: