Skip to content

Latest commit

 

History

History

llamaindex-vertexai

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Building a RAG pipeline with LlamaIndex and Vertex AI models

LlamaIndex on Vertex AI

Introduction

LlamaIndex is a popular framework for developing context-augmented LLM apps.

Imagine you own the 2024 model of a fictitious vehicle called Cymbal Starlight. It has a user’s manual in PDF format (cymbal-starlight-2024.pdf) and you want to ask LLM questions about this vehicle from the user manual.

In this tutorial, we'll see how to Build a RAG pipeline with LlamaIndex and Vertex AI models and ask LLM questions about the PDF.

See main.py for the full sample.

Setup

Make sure your gcloud is set up with your Google Cloud project:

gcloud config set core/project your-google-cloud-project-id

You're logged in:

gcloud auth application-default login

Create and activate a virtual environment:

python -m venv .venv
source .venv/bin/activate

Install dependencies:

pip install -r requirements.txt

Run

python main.py
Read PDF into documents
Combine document for each page back into a single document
Initialize embedding model
Index document
Initialize query engine with the model
Question: What is the cargo capacity of Cymbal Starlight?
Response: The cargo capacity of the Cymbal Starlight 2024 is 13.5 cubic feet.

Yay, it works!

References