Skip to content

Commit

Permalink
Merge pull request #4 from mongodb-developer/cloud-agnostic-updates
Browse files Browse the repository at this point in the history
Making the lab cloud agnostic
  • Loading branch information
ajosh0504 authored Jan 21, 2025
2 parents ea30884 + a3a639d commit d99c016
Show file tree
Hide file tree
Showing 70 changed files with 152 additions and 292 deletions.
62 changes: 0 additions & 62 deletions docs/20-mongodb-atlas/1-create-account.mdx

This file was deleted.

17 changes: 17 additions & 0 deletions docs/20-mongodb-atlas/1-setup.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 👐 MongoDB Setup

:::caution
If you are doing this lab as part of a MongoDB GenAI Developer Day, at this point you should already have a free cluster, so you can skip this step.

If you don't have a cluster yet, follow the steps below to create one.
:::

In this lab, you will learn how to use MongoDB Atlas as a knowledge base as well as a memory provider for an AI agent that can help you understand technical documentation.

To use MongoDB Atlas, you will need to create an account, a free cluster and obtain the connection string to connect to your cluster. Follow these steps to get set up:

* [Register for a free MongoDB Atlas account](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-account)

* [Create a new database cluster](https://mongodb-developer.github.io/intro-lab/docs/mongodb-atlas/create-cluster)

* [Obtain the connection string for your database cluster](https://mongodb-developer.github.io/intro-lab/docs/importing-data/get-connection-string)
56 changes: 0 additions & 56 deletions docs/20-mongodb-atlas/2-create-cluster.mdx

This file was deleted.

24 changes: 0 additions & 24 deletions docs/20-mongodb-atlas/3-get-connection-string.mdx

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,25 @@ Cells in a Jupyter notebook are a modular unit of code or text that you can exec

To run a cell in a Jupyter notebook, hover over it and click the Run icon that appears against the cell.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/1-run-cell.png" alt="Run a cell" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/1-run-cell.png" alt="Run a cell" />

When a cell is running, you will see a loading spinner in the bottom left corner of the cell.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/2-running-cell.png" alt="A running cell" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/2-running-cell.png" alt="A running cell" />

When a cell is finished running successfully, you will see a green check mark appear in the bottom left corner of the cell.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/3-successful-cell.png" alt="Successful cell run" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/3-successful-cell.png" alt="Successful cell run" />

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.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/4-error-in-cell.png" alt="Erroneous cell run" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/4-error-in-cell.png" alt="Erroneous cell run" />

To fix errors, you may need to update previous cells. If you do, re-run all the cells following the one(s) you updated.

To interrupt a running cell, click the Stop icon that you see against the cell while it is running.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/1-jupyter-notebooks/5-interrupt-cell.png" alt="Interrupt cell run" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/1-jupyter-notebooks/5-interrupt-cell.png" alt="Interrupt cell run" />

:::warning
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.
Expand Down
38 changes: 22 additions & 16 deletions docs/40-dev-env/2-dev-setup.mdx → docs/30-dev-env/2-dev-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,35 @@ import Screenshot from "@site/src/components/Screenshot";

# 👐 Setup dev environment

:::caution
If you are doing this lab as part of a MongoDB GenAI Developer Day, at this point you should already have the GitHub Codespace ready for this lab, so you can skip this step.

If you haven't created the Codespace yet, follow the steps below to create one.
:::

## 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](https://github.com/codespaces/new/mongodb-developer/ai-agents-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.
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.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/1-create-codespace.png" alt="Start a codespace" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-setup/1-create-codespace.png" alt="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.
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 `notebook_template.ipynb` to open the Jupyter Notebook for the lab.
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.

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/2-nav-notebook.png" alt="Navigate to the notebook" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-setup/2-nav-notebook.png" alt="Navigate to the notebook" />

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

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/3-select-kernel.png" alt="Select kernel" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-setup/3-select-kernel.png" alt="Select kernel" />

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

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/4-python-env-modal.png" alt="Select recommended interpreter" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-setup/4-python-env-modal.png" alt="Select Python Environments" />

<Screenshot url="https://github.com/codespaces" src="img/screenshots/40-dev-env/2-dev-setup/5-select-default.png" alt="Select recommended interpreter" />
<Screenshot url="https://github.com/codespaces" src="img/screenshots/30-dev-env/2-dev-setup/5-select-recommended.png" alt="Select recommended interpreter" />

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

Expand All @@ -36,23 +42,23 @@ During the lab, we will use GitHub Codespaces. These instructions are here just

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

* 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:
* Clone the [GitHub repo](https://github.com/mongodb-developer/genai-devday-notebooks.git) for this lab by executing the following command from the terminal:

```
git clone https://github.com/mongodb-developer/ai-rag-lab-notebooks.git
git clone https://github.com/mongodb-developer/genai-devday-notebooks.git
```

* `cd` into the cloned directory:

```
cd ai-rag-lab-notebooks
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
python -m venv mongodb-ai-agents-lab
source mongodb-ai-agents-lab/bin/activate
```

* Install and launch Jupyter Notebook:
Expand All @@ -62,6 +68,6 @@ pip install notebook
jupyter notebook
```

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

<Screenshot url="localhost:8888/tree" src="img/screenshots/40-dev-env/2-dev-setup/6-jupyter-notebook.png" alt="Jupyter Notebook" />
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/2-dev-setup/6-jupyter-notebook.png" alt="Jupyter Notebook" />
25 changes: 25 additions & 0 deletions docs/30-dev-env/3-setup-pre-reqs.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 👐 Setup prerequisites

Fill in any placeholders, select an LLM provider (one of `aws`, `google` or `microsoft`) of your choice, and run the cells under the **Step 1: Setup prerequisites** section in the notebook.

**CODE_BLOCK_1**

<details>
<summary>Answer</summary>
<div>
```python
mongodb_client[DB_NAME][VS_COLLECTION_NAME]
```
</div>
</details>

**CODE_BLOCK_2**

<details>
<summary>Answer</summary>
<div>
```python
mongodb_client[DB_NAME][FULL_COLLECTION_NAME]
```
</div>
</details>
File renamed without changes.
15 changes: 0 additions & 15 deletions docs/30-fireworks-ai/1-create-account.mdx

This file was deleted.

13 changes: 0 additions & 13 deletions docs/30-fireworks-ai/2-create-api-key.mdx

This file was deleted.

8 changes: 0 additions & 8 deletions docs/30-fireworks-ai/_category_.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Here is a quick overview of concepts that you will come across in this section o

## About the data

In this lab, we are using a serverless AWS Lambda function to import the data required by the agent's tools, into MongoDB. If you want to do this on your own, these datasets are available on Hugging Face:
In this lab, we are using a serverless function to import the data required by the agent's tools, into MongoDB. If you want to do this on your own, these datasets are available on Hugging Face:

* [devcenter-articles](https://huggingface.co/datasets/MongoDB/devcenter-articles): Markdown versions of 20 articles from our Developer Center. This dataset is imported into a collection called `full_articles`.
* [mongodb-docs](https://huggingface.co/datasets/MongoDB/mongodb-docs): Markdown versions of a small subset of MongoDB's technical documentation. This dataset is imported into a collection called `full_docs`.

* [devcenter-articles-embedded](https://huggingface.co/datasets/MongoDB/devcenter-articles-embedded): Chunked and embedded versions of the articles in the `devcenter-articles` dataset. This dataset is imported into a collection called `chunked_articles`.
* [mongodb-docs-embedded](https://huggingface.co/datasets/MongoDB/mongodb-docs-embedded): Chunked and embedded versions of the articles in the `mongodb-docs` dataset. This dataset is imported into a collection called `chunked_docs`.

To learn more about chunking and embedding, here are some resources from our Developer Center:

Expand Down
Loading

0 comments on commit d99c016

Please sign in to comment.