Code and slides for the Data For Science webinar series: Gemini API with Vertex AI for Developers (O’Reilly).
This course explores Google’s generative AI stack: the Gemini API (Google AI Studio and Vertex AI) on Google Cloud. You’ll work through text and multimodal use cases, deployment and MLOps patterns on Vertex AI, and end-to-end solution design (RAG, agents, and pipelines). The notebooks are meant to be run in order so concepts and credentials build from one module to the next.
- Generative AI overview
- Gemini API introduction
- Vertex AI overview
- Prompt engineering for text models
- Text generation with the Gemini API
- Information extraction with text models
- Image and video understanding
- Hands-on: captioning and visual Q&A
- Multimodal inputs for richer applications
- Real-world multimodal use cases
- MLOps practices with Vertex AI (including Kubeflow Pipelines samples)
- Model monitoring and explainability concepts
- Deploying Gemini-powered applications (e.g. Cloud Run-oriented examples)
- Scaling and optimization considerations for production
- Architecture patterns: RAG, agents, and multi-stage pipelines
- Designing production-oriented generative AI systems
- Security, privacy, and responsible use
Requirements: Python 3.10+ (the materials are tested with 3.12). Dependencies are defined in pyproject.toml and locked with uv.lock.
- Install uv if needed:
curl -LsSf https://astral.sh/uv/install.sh | sh- Clone the repo and install into a local virtual environment:
git clone https://github.com/DataForScience/GeminiAI.git
cd GeminiAI
uv syncuv sync creates .venv and installs Jupyter, Gemini/Vertex client libraries, KFP (Kubeflow Pipelines), and the rest of the stack. To use the environment explicitly:
source .venv/bin/activate # Windows: .venv\Scripts\activate| What you need | Used for | Where to get it |
|---|---|---|
| GEMINI_API_KEY | Calling the Gemini API from notebooks (Google AI Studio key) | Google AI Studio |
| GCP_PROJECT | Vertex AI, deployment, and cloud examples | Google Cloud Console (free tier available) |
| GCP_LOCATION | Vertex AI, deployment, and cloud examples | Google Cloud Console (free tier available) |
Set environment variables in your shell or in a .env file in the project root (gitignored). The course uses GEMINI_API_KEY (not GOOGLE_API_KEY).
For Vertex AI and GCP APIs, enable the Vertex AI API on your project and authenticate with Application Default Credentials, for example:
gcloud auth application-default login
gcloud services enable aiplatform.googleapis.com --project=YOUR_PROJECT_IDExact gcloud steps also appear in the notebooks where relevant.
From the project directory (with the env active, or via uv run):
uv run jupyter notebookThis repository is not configured as an installable Python package (no src layout / package discovery), so pip install -e . is not supported. Prefer uv sync.
If you cannot use uv, create a virtual environment and install the dependencies listed under [project].dependencies in pyproject.toml, for example:
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install "google-cloud-aiplatform>=1.71.1" "google-genai>=1.68.0" "google-generativeai>=0.8.6" "jupyter>=1.1.1" "kfp>=2.13.0" "matplotlib>=3.10.8" "numpy>=2.2.6" "pandas>=2.3.3" "vertexai>=1.71.1" "watermark>=2.6.0"The checked-in requirements.txt is a minimal, older pin (matplotlib / numpy / pandas / watermark only) and does not include the Gemini, Vertex AI, or KFP stack.
GeminiAI/
├── 1. Gemini Fundamentals.ipynb # Module 1
├── 2. Text Generation.ipynb # Module 2
├── 3. Multimodal.ipynb # Module 3
├── 4. Deployment.ipynb # Module 4
├── 5. E2E Solutions.ipynb # Module 5
├── Untitled.ipynb # D4Sci notebook template (branding / structure)
├── slides/
│ ├── GeminiAI.pdf # Primary slide deck
├── data/ # Logos, author image, sample images/audio/video
├── d4sci.mplstyle # Matplotlib style for figures
├── pyproject.toml # Project metadata and dependencies
├── uv.lock # Locked versions for uv
├── requirements.txt # Legacy minimal deps only (see Setup)
├── LICENSE
- Work through Modules 1 → 5 in order.
- For slides only, open
slides/GeminiAI.pdf.
| Notebook | Topic |
|---|---|
1. Gemini Fundamentals.ipynb |
Gemini API and Vertex AI fundamentals |
2. Text Generation.ipynb |
Gemini API for text generation |
3. Multimodal.ipynb |
Multimodal applications |
4. Deployment.ipynb |
Vertex AI and deployment strategies |
5. E2E Solutions.ipynb |
End-to-end generative AI solutions |
Running all notebooks end-to-end typically costs on the order of $1–3 in API usage, depending on how often you re-run cells and current pricing.
Vertex AI / Cloud Run / build steps in Module 4 can incur additional GCP charges if you execute them against a real project.
Reach out at info@data4sci.com or open an issue if something isn’t working.
|
Web: www.data4sci.com |
