Skip to content

Commit c1e6048

Browse files
author
ajosh0504
committed
Making data visualization non-optional
1 parent fce9968 commit c1e6048

22 files changed

+58
-72
lines changed

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

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -20,76 +20,79 @@ In this lab, we will be using Jupyter Notebooks, which is an interactive Python
2020

2121
## Option 1: GitHub Codespaces
2222

23-
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.
23+
You will be working in GitHub Codespaces 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.
2424

2525
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/genai-devday-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.
2626

27-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/3-create-codespace.png" alt="Start a codespace" />
27+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/3-create-codespace.png" alt="Start a codespace" />
2828

29-
Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster. Once the environment is built, you should see a VS Code IDE with a list of files in the Explorer tab.
29+
Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster.
3030

31-
In the Explorer menu, under `notebooks`, click on the file named `ai-rag-lab.ipynb` to open the Jupyter Notebook for this lab.
31+
### Connect to the MongoDB cluster
3232

33-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
33+
Once the environment is built, you will be prompted to connect to the MongoDB cluster via MongoDB's VSCode extension. This will allow you to visualize the data that we will import into the cluster later in the lab, directly from the VSCode IDE.
3434

35-
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
35+
To connect to the cluster, click the **Connect** button.
3636

37-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/4-select-kernel.png" alt="Select kernel" />
37+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/4-click-connect.png" alt="Click Connect" />
3838

39-
In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
39+
In the modal that appears at the top of the screen, enter the string `mongodb://admin:mongodb@mongodb:27017/` and hit `Enter` on your keyboard.
4040

41-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/5-python-env-modal.png" alt="Select Python Environments" />
41+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/5-enter-connection-string.png" alt="Enter connection string" />
4242

43-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/6-select-recommended.png" alt="Select recommended interpreter" />
43+
If the connection was successful, you should see **Connected to: mongodb:27017** with a green indicator.
4444

45-
That's it! You're ready for the lab!
45+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/6-connection-successful.png" alt="Connection successful" />
4646

47-
<details>
48-
<summary>🦹 Use the MongoDB for VS Code extension to interact with the local MongoDB cluster from the VSCode IDE. </summary>
47+
You can view the default and any additional collections we create on the cluster during the lab by clicking the leaf icon in the left navigation bar of the IDE.
48+
49+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/7-view-collections.png" alt="View collections" />
4950

50-
In the left navigation bar of the IDE, click on the leaf icon. Under Connections, click the **Add Connection** button.
51+
### Jupyter Notebook setup
5152

52-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/7-add-connection.png" alt="Add MongoDB connection" />
53+
You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next!
5354

54-
In the tab that appears, click the **Connect** button.
55+
Click on the files icon in the left navigation bar. In the Explorer menu, under `notebooks`, click on the file named `ai-rag-lab.ipynb` to open the Jupyter Notebook for this lab.
5556

56-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/8-click-connect.png" alt="Click Connect" />
57+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
5758

58-
In the modal that appears at the top of the screen, enter the string `mongodb://admin:mongodb@mongodb:27017/` and hit `Enter` on your keyboard.
59+
Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
5960

60-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/9-enter-connection-string.png" alt="Enter connection string" />
61+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/8-select-kernel.png" alt="Select kernel" />
6162

62-
If the connection was successful, you should see the cluster and its default databases under Connections. Any additional databases and collections created during the lab will appear here as well.
63+
In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
6364

64-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/10-connections.png" alt="View connections" />
65+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/9-python-env-modal.png" alt="Select Python Environments" />
6566

66-
</details>
67+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/2-dev-env-setup/10-select-recommended.png" alt="Select recommended interpreter" />
68+
69+
That's it! You're ready for the lab!
6770

6871
## Option 2: Run locally
6972

7073
:::caution
7174
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.
7275
:::
7376

74-
To run the lab locally, follow the steps below:
77+
To run the lab locally, follow the steps below:
7578

7679
* Clone the [GitHub repo](https://github.com/mongodb-developer/genai-devday-notebooks.git) for this lab by executing the following command from the terminal:
7780

7881
```
7982
git clone https://github.com/mongodb-developer/genai-devday-notebooks.git
8083
```
8184

82-
* `cd` into the cloned directory:
85+
* `cd` into the `notebooks` directory of the cloned repository:
8386

8487
```
85-
cd genai-devday-notebooks
88+
cd genai-devday-notebooks/notebooks
8689
```
8790

8891
* Create and activate a Python virtual environment:
8992

9093
```
91-
python -m venv mongodb-ai-rag-lab
92-
source mongodb-ai-rag-lab/bin/activate
94+
python -m venv ai-rag-lab
95+
source ai-rag-lab/bin/activate
9396
```
9497

9598
* Install the dependencies for this lab:
@@ -107,4 +110,4 @@ jupyter notebook
107110

108111
* In the browser tab that pops up, open the file named `ai-rag-lab.ipynb`.
109112

110-
<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/1-dev-env-setup/11-jupyter-notebook.png" alt="Jupyter Notebook" />
113+
<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/2-dev-env-setup/11-jupyter-notebook.png" alt="Jupyter Notebook" />

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 👐 Setup prerequisites
22

3-
Replace any placeholders and run the cells under **Step 1: Setup prerequisites** section in the notebook.
3+
Run the cells under **Step 1: Setup prerequisites** section in the notebook.
44

55
:::info
66

docs/30-prepare-the-data/4-ingest-data.mdx

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,16 @@ collection.insert_many(embedded_docs)
1919
</div>
2020
</details>
2121

22-
<details>
23-
<summary>🦹 Visually verify that the data has been imported into the local MongoDB cluster. </summary>
24-
25-
Click the leaf icon in the left navigation bar of the IDE.
22+
To visually verify that the data has been imported into the MongoDB cluster, click the leaf icon in the left navigation bar of the IDE.
2623

27-
Ensure that you see a database called _mongodb_genai_devday_rag_, and a collection named _knowledge_base_ under it.
24+
Ensure that you see a database called _mongodb_genai_devday_rag_, and a collection named _knowledge_base_ under it.
2825

29-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/1-verify-collection.png" alt="Verify collection" />
26+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/1-verify-collection.png" alt="Verify collection" />
3027

31-
Click the **>** arrow next to _knowledge_base_ and note the number of documents.
28+
Click the **>** arrow next to _knowledge_base_ and note the number of documents.
3229

33-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/2-document-count.png" alt="Verify document count" />
34-
35-
To preview a document, click the **>** arrow next to _Documents_ and select a document from the list.
30+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/2-document-count.png" alt="Verify document count" />
31+
32+
To preview a document, click the **>** arrow next to _Documents_ and select a document from the list.
3633

37-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/3-preview-document.png" alt="Preview document" />
38-
</details>
34+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-prepare-the-data/4-ingest-data/3-preview-document.png" alt="Preview document" />

docs/40-perform-vector-search/2-create-vector-index.mdx

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

33
To retrieve documents from MongoDB using vector search, you must configure a vector search index on the collection into which you ingested your data. In this lab, you will programmatically create vector search indexes using MongoDB's Python driver.
44

5-
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 6: Create a vector search index** section in the notebook to create a vector search index.
6-
7-
The answers for code blocks in this section are as follows:
8-
9-
**CODE_BLOCK_6**
10-
11-
<details>
12-
<summary>Answer</summary>
13-
<div>
14-
```python
15-
collection.create_search_index(model=model)
16-
```
17-
</div>
18-
</details>
5+
Run the cells under the **Step 6: Create a vector search index** section in the notebook to create a vector search index.

docs/40-perform-vector-search/3-vector-search.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 7:
66

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

9-
**CODE_BLOCK_7**
9+
**CODE_BLOCK_6**
1010

1111
<details>
1212
<summary>Answer</summary>
@@ -17,7 +17,7 @@ get_embedding(user_query)
1717
</div>
1818
</details>
1919

20-
**CODE_BLOCK_8**
20+
**CODE_BLOCK_7**
2121

2222
<details>
2323
<summary>Answer</summary>
@@ -45,7 +45,7 @@ get_embedding(user_query)
4545
</div>
4646
</details>
4747

48-
**CODE_BLOCK_9**
48+
**CODE_BLOCK_8**
4949

5050
<details>
5151
<summary>Answer</summary>

docs/40-perform-vector-search/4-pre-filtering.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **🦹‍
1010

1111
The answers for code blocks in this section are as follows:
1212

13-
**CODE_BLOCK_10**
13+
**CODE_BLOCK_9**
1414

1515
<details>
1616
<summary>Answer</summary>
@@ -35,7 +35,7 @@ The answers for code blocks in this section are as follows:
3535
</div>
3636
</details>
3737

38-
**CODE_BLOCK_11**
38+
**CODE_BLOCK_10**
3939

4040
<details>
4141
<summary>Answer</summary>
@@ -64,7 +64,7 @@ The answers for code blocks in this section are as follows:
6464
</div>
6565
</details>
6666

67-
**CODE_BLOCK_12**
67+
**CODE_BLOCK_11**
6868

6969
<details>
7070
<summary>Answer</summary>
@@ -90,7 +90,7 @@ The answers for code blocks in this section are as follows:
9090
</div>
9191
</details>
9292

93-
**CODE_BLOCK_13**
93+
**CODE_BLOCK_12**
9494

9595
<details>
9696
<summary>Answer</summary>

docs/50-build-rag-app/1-build-rag-app.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 8:
66

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

9-
**CODE_BLOCK_14**
9+
**CODE_BLOCK_13**
1010

1111
<details>
1212
<summary>Answer</summary>
@@ -17,7 +17,7 @@ vector_search(user_query)
1717
</div>
1818
</details>
1919

20-
**CODE_BLOCK_15**
20+
**CODE_BLOCK_14**
2121

2222
<details>
2323
<summary>Answer</summary>
@@ -28,7 +28,7 @@ create_prompt(user_query)
2828
</div>
2929
</details>
3030

31-
**CODE_BLOCK_16**
31+
**CODE_BLOCK_15**
3232

3333
<details>
3434
<summary>Answer</summary>

docs/50-build-rag-app/2-add-reranking.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **🦹‍
66

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

9-
**CODE_BLOCK_17**
9+
**CODE_BLOCK_16**
1010

1111
<details>
1212
<summary>Answer</summary>

docs/60-add-memory/1-add-memory.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 9:
66

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

9-
**CODE_BLOCK_18**
9+
**CODE_BLOCK_17**
1010

1111
<details>
1212
<summary>Answer</summary>
@@ -17,7 +17,7 @@ history_collection.create_index("session_id")
1717
</div>
1818
</details>
1919

20-
**CODE_BLOCK_19**
20+
**CODE_BLOCK_18**
2121

2222
<details>
2323
<summary>Answer</summary>
@@ -28,7 +28,7 @@ history_collection.insert_one(message)
2828
</div>
2929
</details>
3030

31-
**CODE_BLOCK_20**
31+
**CODE_BLOCK_19**
3232

3333
<details>
3434
<summary>Answer</summary>
@@ -39,7 +39,7 @@ history_collection.find({"session_id": session_id}).sort("timestamp", 1)
3939
</div>
4040
</details>
4141

42-
**CODE_BLOCK_21**
42+
**CODE_BLOCK_20**
4343

4444
<details>
4545
<summary>Answer</summary>
@@ -50,7 +50,7 @@ retrieve_session_history(session_id)
5050
</div>
5151
</details>
5252

53-
**CODE_BLOCK_22**
53+
**CODE_BLOCK_21**
5454

5555
<details>
5656
<summary>Answer</summary>
@@ -61,7 +61,7 @@ retrieve_session_history(session_id)
6161
</div>
6262
</details>
6363

64-
**CODE_BLOCK_23**
64+
**CODE_BLOCK_22**
6565

6666
<details>
6767
<summary>Answer</summary>
Binary file not shown.
Loading
Loading
Loading
Loading
Loading
Binary file not shown.
Loading
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)