Generative AI code samples and sample applications

Sample applications

Deploy a prebuilt generative AI sample application, then fork the code to modify it for your own use-case.

Jump Start Solution: Document Summarization

Deploy a one-click sample application to summarize long documents with Vertex AI.

Beginner Python

Jump Start Solution: Generative AI RAG with Cloud SQL

Deploy a one-click sample application that uses vector embeddings stored in Cloud SQL to improve the accuracy of responses from a chat application.

Beginner Python

Jump Start Solution: Generative AI Knowledge Base

Deploy a one-click sample application that extracts question-and-answer pairs from a set of documents, along with a pipeline that triggers the application when a document is uploaded.

Beginner Python

Generate a marketing campaign with Gemini

Build a web app to generate marketing campaign ideas, using Gemini on Vertex AI, Cloud Run, and Streamlit.

Beginner Python

Airport Assistant: RAG App

Sample app for retrieval-augmented generation with AlloyDB for PostgreSQL and Vertex AI. (blog post, codelab).

Intermediate Python

GenWealth: RAG app

Learn to build a Node-based RAG app that provides investment recommendations for financial advisors. This sample integrates with Vertex AI, Cloud Run, AlloyDB, and Cloud Run functions. Built with Angular, TypeScript, Express.js, and LangChain.

Intermediate Node

Fix My Car: RAG app

Learn to build a RAG app that helps car owners troubleshoot their vehicle, without having to flip through their owner's manual. Variants include Cloud SQL with pgvector, and Vertex AI Agent Builder. Built with Java (Spring) and Python (Streamlit).

Intermediate Java

SDKs and Frameworks

Learn how to work with Google Cloud's generative AI APIs using SDK code snippets.

Vertex AI - Gemini SDKs

Learn how to apply the Vertex AI Gemini SDKs to tasks like chat, multimodal prompts, and document processing. Browse additional code samples here.

Beginner Python Node Java Go C#

Vertex AI Agent Builder SDKs

Learn how to store and retrieve RAG documents using Vertex AI Agent Builder (formerly Vertex AI Search).

Beginner Python Node Java Go C# PHP Ruby

Browse all Google Cloud client libraries

Integrating other products, like Cloud Storage or Firestore, into your generative AI app? Browse all Google Cloudclient libraries in your programming language of choice.

Beginner Python Node Java Go C# PHP Ruby

LangChain (Python)

Explore code snippets for using LangChain alongside Google Cloud products, including chat models (Vertex AI), vector databases (AlloyDB, Cloud SQL, Firestore, Vertex AI Agent Builder, BigQuery, and others), and others (Google Drive, Google Maps, YouTube, and others).

Beginner Python

LangChain.js (Node)

Explore code snippets for using LangChain alongside Google Cloud products, including chat models (Vertex AI), vector databases (Vertex AI Vector Search), and others (Google Search).

Beginner Node

Genkit (Node)

Firebase Genkit is an open-source framework that helps you build, deploy, and monitor production-ready AI-powered web applications. Genkit comes with plugins for Vertex AI, Cloud Operations, and Firestore.

Beginner Node

LangChain4j (Java)

Explore code snippets for using LangChain alongside Google Cloud products, including chat models (Vertex AI).

Beginner Java

Notebooks

Explore hands-on walkthroughs of generative AI use cases.

Getting started with Vertex AI Gemini 1.5 Flash

Learn how to call Gemini 1.5 Flash, and leverage its long context window, using the Vertex AI SDK. This notebook includes text, video, and audio modalities.

Beginner Python

Sheet Music Analysis with Gemini

Learn how to extract sheet music metadata, such as composer and tempo, from PDFs using the Vertex AI SDK.

Beginner Python

Video Analysis with Gemini

Learn how to analyze video sentiment, including facial expressions, using the Vertex AI SDK.

Beginner Python

Analyzing movie posters in BigQuery with Gemini

Learn how to extract information from movie posters by calling Gemini directly from BigQuery.

Intermediate Python

Introduction to Vertex AI Embeddings - Text & Multimodal

Learn how to convert text and images to vector embeddings using the Vertex AI SDK, for use in a retrieval-augmented generation (RAG) application.

Intermediate Python

Function-calling with Gemini

Learn how to augment Gemini's response with real-time data, such as a company's stock price and latest news.

Intermediate Python

Code migration from PaLM to Gemini

Learn how to migrate your existing Vertex AI SDK code to call Gemini instead of PaLM.

Intermediate Python

Supervised Tuning with Gemini for Question-answering

Learn how to tune Gemini using Vertex AI, to train the model to respond well to questions about Python coding.

Advanced Python

Browse all notebooks

Explore dozens of other Vertex AI notebooks in the Google Cloud Sample Browser.

Intermediate Python

Learn more