12  Part 3 Exercise

Open In Colab

We’ll now practice what we have learned today. Try the following:

This notebook should help you get started.

# Install the packages
! pip3 install --upgrade google-cloud-aiplatform
! pip3 install shapely<2.0.0
! pip install langchain
! pip install pypdf
! pip install pydantic==1.10.8
! pip install chromadb==0.3.26
! pip install langchain[docarray]
! pip install typing-inspect==0.8.0 typing_extensions==4.5.0
# Automatically restart kernel after installs so that your environment can access the new packages
import IPython

app = IPython.Application.instance()
app.kernel.do_shutdown(True)
from google.colab import auth
auth.authenticate_user()
# Add your project id and region
PROJECT_ID = "<...>"
REGION = "<...>"

import vertexai

vertexai.init(project=PROJECT_ID, location=REGION)

12.0.1 TODO:

Get some data (your own data, something interesting online, or use the LLM to create some!)

# Your code here

12.0.2 TODO:

Create embeddings for the data, either using Chroma (quicker) or Matching Engine.

# Your code here

12.0.3 TODO:

Create prompts that allow a user to interact with the data and perform common tasks (question and answering, retrieval, summarization etc).

# Your code here

12.0.4 TODO:

Write evaluation prompts and contexts to check the quality of outputs.

# Your code here