Skip to main content

๐Ÿ‘ Setup dev environment

tip

In this lab, we will be using Jupyter Notebooks, which is an interactive Python environment. If you are new to Jupyter Notebooks, use this guide to familiarize yourself with this environment.

Option 1: GitHub Codespacesโ€‹

You will be working in a Jupyter Notebook in a GitHub Codespace throughout this lab. A codespace is a cloud-hosted, containerized development environment that comes pre-configured with all the tools you need to run this lab.

Navigate to this link. You will be prompted to sign into GitHub if you haven't already. Once signed in, click the Create new codespace button to create a new codespace.

Start a codespace

Let it run for a few seconds as it prepares your environment. It will clone the repository, prepare the container, and run the installation scripts. Once the environment is built, you should see a list of files appear under the Explorer.

In the left navigation bar of the IDE, click on the file named ai-rag-lab.ipynb to open the Jupyter Notebook for this lab.

Navigate to the notebook

Next, select the Python interpreter by clicking Select Kernel at the top right of the IDE.

Select kernel

In the modal that appears, click Python environments... and select the interpreter that is marked as Recommended or Global Env.

Select Python Environments
Select recommended interpreter

That's it! You're ready for the lab!

Option 2: Run locallyโ€‹

caution

During the lab, we will use GitHub Codespaces. These instructions are here just in case you can't use Codespaces or if you really, really, really want a local installation.

If you want to run the notebook locally, follow the steps below:

  • Clone the GitHub repo for this lab by executing the following command from the terminal:
git clone https://github.com/mongodb-developer/genai-devday-notebooks.git
  • cd into the cloned directory:
cd genai-devday-notebooks
  • Create and activate a Python virtual environment:
python -m venv mongodb-ai-rag-lab
source mongodb-ai-rag-lab/bin/activate
  • Install the dependencies for this lab:
pip install -r requirements.txt
  • Install and launch Jupyter Notebook:
pip install notebook
jupyter notebook
  • In the browser tab that pops up, open the file named ai-rag-lab.ipynb.
Jupyter Notebook