检查点
Index Documents in Chroma DB Vector Store
/ 30
Setup Chroma DB as a Retriever
/ 40
Create a prompt template for a language model
/ 30
Build LangChain Applications using Vertex AI: Challenge Lab
- GSP516
- Overview
- Introduction
- Setup and requirements
- Challenge Scenario
- Task 1. Load Wikipedia Articles as LangChain Documents
- Task 2. Use RecursiveTextSplitter to split Documents
- Task 3. Index Documents as embeddings in Chroma DB Vector Store
- Task 4. Setup a Retriever
- Task 5. Setup Model and Build LangChain Chain
- Congratulations!
GSP516
Overview
Introduction
In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
This lab is recommended for students who have enrolled in the Build LangChain Applications using Vertex AI: Challenge Lab quest. Are you ready for the challenge?
Topics tested
- Use
gemini-pro
to answer questions related to PDF documents stored in a Google Cloud Storage bucket. - Index the documents as embeddings in a Vector Store (for simplicity
Chroma
is used). - Implement a Retrieval Augmentation Generation application using
LangChain
to answer questions using the documents indexed by the Vector Store to ground information.
Setup and requirements
Before you click the Start Lab button
Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.
This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
- Access to a standard internet browser (Chrome browser recommended).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
Challenge Scenario
As a developer at a company specializing in building Question Answering agents, you're tasked with harnessing Gemini's cutting-edge capabilities to elevate the platform's functionality. Your mission is to implement a LangChain application for Question Answering using Gemini's available models.
Your success in this challenge will not only advance the platform's functionality but also demonstrate your proficiency in implementing Retrieval Augmentation Generation to assist with answering questions posed by users looking for information, grounded by a knowledge base. Are you ready to take on the challenge?
Task 1. Load Wikipedia Articles as LangChain Documents
In this section, you are tasked with completing the python code in cells of a Jupyter notebook to load Wikipedia articles as LangChain Documents
.
- In the Google Cloud Console, on the Navigation menu, click Vertex AI > Workbench.
- On the User-Managed Notebooks page, find the
generative-ai-jupyterlab
notebook and click on the Open JupyterLab button. - Open the
retrieval_augmentation_generation_challenge.ipynb
file found in the left folder view. - Complete the missing parts of each cell to progress to the next section. These will be denoted with
INSERT
and an instruction to complete.
Task 2. Use RecursiveTextSplitter to split Documents
In this section, you are tasked with using a LangChain RecursiveTextSplitter
to split the documents loaded from Wikipedia in Task 1 in preparation for indexing in a Vector Store.
-
Remain in Vertex AI Workbench and proceed to the section Task 2: Use
RecursiveTextSplitter
to split Documents. -
Complete the required sections of the notebook
retrieval_augmentation_generation_challenge.ipynb
under Task 2.
Task 3. Index Documents as embeddings in Chroma DB Vector Store
In this section, you are tasked with using the Gemini embedding model to embed the documents loaded from Wikipedia in a new Chroma DB index. The index will later be used as a knowledge base to ground responses from queries to the gemini-pro
model.
-
Remain in Vertex AI Workbench and proceed to the section Task 3: Index Documents as
embeddings
in Chroma DB Vector Store. -
Complete the required sections of the notebook
retrieval_augmentation_generation_challenge.ipynb
under Task 3.
Click Check my progress to verify the objective.
Task 4. Setup a Retriever
In this section, you are tasked with setting up Chroma DB as a LangChain Retriever
so that the documents indexed can be used to ground responses from a Large Language Model (LLM).
-
Remain in Vertex AI Workbench and proceed to the section Task 4: Setup a
Retriever
. -
Complete the required sections of the notebook
retrieval_augmentation_generation_challenge.ipynb
under Task 4.
Click Check my progress to verify the objective.
Task 5. Setup Model and Build LangChain Chain
In this section, you are tasked with initializing the model used to handle user queries and create a LangChain Chain
to setup the workflow of the generative AI application.
-
Remain in Vertex AI Workbench and proceed to the section Task 5. Setup Model and Build LangChain
Chain
. -
Complete the required sections of the notebook
retrieval_augmentation_generation_challenge.ipynb
under Task 5.
Click Check my progress to verify the objective.
Congratulations!
You have now completed the lab! Throughout this challenge, you've demonstrated your adeptness in leveraging LangChain with Gemini and Chroma DB to create a Retrieval Augmentation Generation application to produce results for user queries grounded by a private knowledge base. Well done on a job excellently executed!
Next steps
- Check out the Generative AI on Vertex AI documentation.
- Learn more about Generative AI on the Google Cloud Tech YouTube channel.
- Google Cloud Generative AI official repo
- Example Gemini notebooks
Google Cloud training and certification
...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.
Manual Last Updated March 6, 2024
Lab Last Tested March 6, 2024
Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.