Install Dependencies

Install the four libraries your RAG app needs

💻

Writing code and entering commands is only available on desktop. Open this page on a larger screen to complete this chapter.

What you are installing

PackagePurpose
pypdfExtract text from PDF files
google-genaiCall the Gemini API for embeddings and generation
numpyCompute cosine similarity between vectors
python-dotenvLoad your API key from a .env file

Storing API keys directly in source code is a security risk. Anyone who reads your code sees your key. python-dotenv loads secrets from a separate .env file that you never commit to version control.

One pip install command installs all four.

Instructions

Use the pip command to install all dependencies.

  1. Install pypdf, google-genai, numpy, and python-dotenv.