Skip to content

Commit 6e6272e

Browse files
authored
Merge pull request #3 from mongodb-developer/codespaces_updates
Replace Google Colab with GitHub Codespaces
2 parents dca175c + 28493e8 commit 6e6272e

37 files changed

+115
-103
lines changed

docs/40-dev-env/1-dev-setup.mdx

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# 📘 Running Jupyter Notebooks
2+
3+
Jupyter Notebooks is an interactive Python environment.
4+
5+
Cells in a Jupyter notebook are a modular unit of code or text that you can execute and view outputs for.
6+
7+
To run a cell in a Jupyter notebook, hover over it and click the Run icon that appears against the cell.
8+
9+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/1-run-cell.png" alt="Run a cell" />
10+
11+
When a cell is running, you will see a loading spinner in the bottom left corner of the cell.
12+
13+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/2-running-cell.png" alt="A running cell" />
14+
15+
When a cell is finished running successfully, you will see a green check mark appear in the bottom left corner of the cell.
16+
17+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/3-successful-cell.png" alt="Successful cell run" />
18+
19+
If an error occurred while running a cell, you will see a red cross appear in the bottom left corner of the cell, and also an error traceback after the cell.
20+
21+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/4-error-in-cell.png" alt="Erroneous cell run" />
22+
23+
To fix errors, you may need to update previous cells. If you do, re-run all the cells following the one(s) you updated.
24+
25+
To interrupt a running cell, click the Stop icon that you see against the cell while it is running.
26+
27+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/5-interrupt-cell.png" alt="Interrupt cell run" />
28+
29+
:::warning
30+
The UI might differ slightly if you are running Jupyter Notebooks in a different IDE. Refer to the appropriate documentation if running the notebook in a different environment.
31+
:::

docs/40-dev-env/2-dev-setup.mdx

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import Screenshot from "@site/src/components/Screenshot";
2+
3+
# 👐 Setup dev environment
4+
5+
## Option 1: GitHub Codespaces
6+
7+
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.
8+
9+
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/ai-rag-lab-notebooks?quickstart=1) 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.
10+
11+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/1-create-codespace.png" alt="Start a codespace" />
12+
13+
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.
14+
15+
In the left navigation bar of the IDE, click on the file named `notebook_template.ipynb` to open the Jupyter Notebook for the lab.
16+
17+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
18+
19+
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
20+
21+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/3-select-kernel.png" alt="Select kernel" />
22+
23+
In the modal that appears, click **Python environments...** and select the recommended interpreter.
24+
25+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/4-python-env-modal.png" alt="Select recommended interpreter" />
26+
27+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/5-select-default.png" alt="Select recommended interpreter" />
28+
29+
That's it! You're ready for the lab!
30+
31+
## Option 2: Run locally
32+
33+
:::caution
34+
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.
35+
:::
36+
37+
If you want to run the notebook locally, follow the steps below:
38+
39+
* Clone the [GitHub repo](https://github.com/mongodb-developer/ai-rag-lab-notebooks.git) for this lab by executing the following command from the terminal:
40+
41+
```
42+
git clone https://github.com/mongodb-developer/ai-rag-lab-notebooks.git
43+
```
44+
45+
* `cd` into the cloned directory:
46+
47+
```
48+
cd ai-rag-lab-notebooks
49+
```
50+
51+
* Create and activate a Python virtual environment:
52+
53+
```
54+
python -m venv mongodb-ai-rag-lab
55+
source mongodb-ai-rag-lab/bin/activate
56+
```
57+
58+
* Install and launch Jupyter Notebook:
59+
60+
```
61+
pip install notebook
62+
jupyter notebook
63+
```
64+
65+
* In the browser tab that pops up, open the file named `notebook_template.ipynb`.
66+
67+
<Screenshot url="localhost:8888/tree" src="img/screenshots/40-dev-env/2-dev-setup/6-jupyter-notebook.png" alt="Jupyter Notebook" />

docs/40-dev-env/2-setup-pre-reqs.mdx

Lines changed: 0 additions & 3 deletions
This file was deleted.

docs/40-dev-env/3-setup-pre-reqs.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 👐 Setup prerequisites
2+
3+
Fill in any placeholders and run the cells under the **Step 1: Setup prerequisites** section in the notebook.

docs/50-agent-tools/3-import-data.mdx renamed to docs/50-agent-tools/2-import-data.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ The MongoDB learning assistant has two tools- a vector search tool to retrieve i
44

55
Let's import the data required by these tools into two MongoDB collections. This is as simple as making a `GET` request to a serverless function that we have created for you.
66

7-
Run the cells under the **Step 3: Import data** section in the notebook to import the data required by our agent's tools, into MongoDB collections.
7+
Run the cells under the **Step 2: Import data** section in the notebook to import the data required by our agent's tools, into MongoDB collections.
88

99
To verify that the data has been imported into your MongoDB cluster, navigate to the **Overview** page in the Atlas UI. In the **Clusters section**, select your cluster and click **Browse collections**.
1010

11-
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/3-import-data/1-browse-collections.png" alt="Browse collections" />
11+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/2-import-data/1-browse-collections.png" alt="Browse collections" />
1212

1313
Ensure that you see a database called _mongodb_agents_lab_, and two collections namely _chunked_articles_ and _full_articles_ under it. Note the number and format of documents in both the collections.
1414

15-
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/3-import-data/2-chunked-collection.png" alt="Chunked collection" />
15+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/2-import-data/2-chunked-collection.png" alt="Chunked collection" />
1616

17-
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/3-import-data/3-full-collection.png" alt="Full collection" />
17+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/2-import-data/3-full-collection.png" alt="Full collection" />

docs/50-agent-tools/2-jupyter-notebooks.mdx

Lines changed: 0 additions & 31 deletions
This file was deleted.

docs/50-agent-tools/4-create-vector-search-index.mdx renamed to docs/50-agent-tools/3-create-vector-search-index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
To retrieve documents using vector search, you must configure a vector search index on the collection you want to perform vector search against.
44

5-
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 4: Create a vector search index** section in the notebook to create a vector search index.
5+
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 3: Create a vector search index** section in the notebook to create a vector search index.
66

77
The answers for code blocks in this section are as follows:
88

@@ -30,8 +30,8 @@ vs_collection.create_search_index(model=model)
3030

3131
To verify that the index was created, navigate to **Search Indexes** for the _chunked_articles_ collection.
3232

33-
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/4-create-vector-search-index/1-nav-search-indexes.png" alt="Navigate to search indexes" />
33+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/3-create-vector-search-index/1-nav-search-indexes.png" alt="Navigate to search indexes" />
3434

3535
The index is ready to use once the status changes from **PENDING** to **READY**.
3636

37-
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/4-create-vector-search-index/2-index-ready.png" alt="Index ready to use" />
37+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/50-agent-tools/3-create-vector-search-index/2-index-ready.png" alt="Index ready to use" />

docs/50-agent-tools/5-create-agent-tools.mdx renamed to docs/50-agent-tools/4-create-agent-tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We want the MongoDB learning assistant to have access to the following tools:
88

99
* `get_article_content_for_summarization`: Gets the content of articles for summarization
1010

11-
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 5: Create agent tools** section in the notebook to create tools for the agent to use.
11+
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 4: Create agent tools** section in the notebook to create tools for the agent to use.
1212

1313
The answers for code blocks in this section are as follows:
1414

docs/60-create-agent/2-define-graph-state.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
Let's start by defining the state of our agent's graph.
44

5-
Run the cells under the **Step 6: Define graph state** section in the notebook to define the state of the graph for our MongoDB learning assistant.
5+
Run the cells under the **Step 5: Define graph state** section in the notebook to define the state of the graph for our MongoDB learning assistant.

0 commit comments

Comments
 (0)