Skip to content

Commit 5086f9f

Browse files
authored
Merge pull request #6 from mongodb-developer/local_mongodb
Update lab docs to support local MongoDB changes
2 parents 0b30e2c + 089c6c1 commit 5086f9f

File tree

58 files changed

+114
-290
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+114
-290
lines changed

docs/30-dev-env/1-dev-env-setup.mdx renamed to docs/20-dev-env/1-dev-env-setup.mdx

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ import Screenshot from "@site/src/components/Screenshot";
77

88
Navigate to [this](https://github.com/codespaces/new/mongodb-developer/genai-devday-notebooks?quickstart=1) link. Click the **Resume this codespace** button to resume the code space you created previously.
99

10-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/1-resume-codespace.png" alt="Resume codespace" />
10+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/1-resume-codespace.png" alt="Resume codespace" />
1111

1212
Give the codespace a few seconds to restart. When files appear under the Explorer, click the file named `ai-agents-lab.ipynb`. This is the Jupyter Notebook you will be using throughout this lab.
1313

14-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/3-nav-notebook.png" alt="Navigate to the notebook" />
14+
<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" />
1515
</details>
1616

1717
:::tip
@@ -24,26 +24,47 @@ You will be working in a Jupyter Notebook in a GitHub Codespace throughout this
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/30-dev-env/1-dev-env-setup/2-create-codespace.png" alt="Start a codespace" />
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" />
2828

2929
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.
3030

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

33-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/3-nav-notebook.png" alt="Navigate to the notebook" />
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" />
3434

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

37-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-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/1-dev-env-setup/4-select-kernel.png" alt="Select kernel" />
3838

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

41-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-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/1-dev-env-setup/5-python-env-modal.png" alt="Select Python Environments" />
4242

43-
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-dev-env-setup/6-select-recommended.png" alt="Select recommended interpreter" />
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" />
4444

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

47+
<details>
48+
<summary>🦹 Use the MongoDB for VS Code extension to interact with the local MongoDB cluster from the VSCode IDE </summary>
49+
50+
In the left navigation bar of the IDE, click on the leaf icon. Under Connections, click the **Add Connection** button.
51+
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+
54+
In the tab that appears, click the **Connect** button.
55+
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+
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+
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+
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+
64+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/10-connections.png" alt="View connections" />
65+
66+
</details>
67+
4768
## Option 2: Run locally
4869

4970
:::caution
@@ -86,4 +107,4 @@ jupyter notebook
86107

87108
* In the browser tab that pops up, open the file named `ai-agents-lab.ipynb`.
88109

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

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# 👐 Setup prerequisites
2+
3+
Select the LLM provider recommended by your instructor, and run the cells under the **Step 1: Setup prerequisites** section in the notebook.
4+
5+
:::info
6+
7+
Additional steps **if you are running the lab locally**:
8+
9+
* Spin up a MongoDB Atlas cluster and obtain its connection string:
10+
11+
* Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register) if you don't already have one
12+
* [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster)
13+
* [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string) for your database cluster
14+
15+
* Set the `MONGODB_URI` variable to the connection string for your cluster as follows:
16+
17+
```python
18+
MONGODB_URI = "<your_connection_string>"
19+
```
20+
21+
* Manually set the value of the `SERVERLESS_URL` variable as follows:
22+
23+
```python
24+
SERVERLESS_URL = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/"
25+
```
26+
:::
File renamed without changes.

docs/20-mongodb-atlas/1-create-account.mdx

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

docs/20-mongodb-atlas/2-create-cluster.mdx

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

docs/20-mongodb-atlas/3-connection-string.mdx

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

docs/20-mongodb-atlas/_category_.json

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

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

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

docs/30-import-data/1-import-data.mdx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# 👐 Import data into MongoDB
2+
3+
The documentation agent has two tools- a vector search tool to retrieve information from documentation to answer questions, and another tool to get the content from specific documentation pages for summarization.
4+
5+
Let's import the data required by these tools into two MongoDB collections.
6+
7+
Run the cells under the **Step 2: Import data into MongoDB** section in the notebook to import the data required by the agent's tools, into MongoDB collections.
8+
9+
<details>
10+
<summary>🦹 Visually verify that the data has been imported into the local MongoDB cluster </summary>
11+
12+
Click the leaf icon in the left navigation bar of the IDE.
13+
14+
Ensure that you see a database called _mongodb_genai_devday_agents_, and two collections named _mongodb_docs_ and _mongodb_docs_embeddings_ under it.
15+
16+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/1-verify-collections.png" alt="Verify collection" />
17+
18+
Click the **>** arrow next to each collection and note the number of documents in it.
19+
20+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/2-full-collection.png" alt="Verify full collection document count" />
21+
22+
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-import-data/1-import-data/3-embedded-collection.png" alt="Verify embedded collection document count" />
23+
</details>

0 commit comments

Comments
 (0)