Skip to content

Commit 11b2d34

Browse files
author
ajosh0504
committed
First draft complete
1 parent f88f261 commit 11b2d34

24 files changed

+361
-320
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,6 @@ If you don't see a button to **Allow Access from Anywhere**, you should close th
5555

5656
## That's all!
5757

58-
That's all! You have a new database cluster. If everything goes well, you should see your newly created cluster in the database deployment screen.
58+
That's all! You have a new database cluster. If everything goes well, you should see your newly created cluster on the **Database** tab under the **Deployment** section.
5959

6060
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/2-create-cluster/3-database-deployment.png" alt="Screenshot of the database deployment screen" />

docs/10-mongodb-atlas/3-get-connection-string.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Screenshot from "@site/src/components/Screenshot";
55

66
In order to ingest data into your cluster later in the lab, you will need to get the connection string for your cluster.
77

8-
In the Atlas UI, navigate to the **Overview** page. In the **Clusters section**, selct the tab for the cluster you just created and click **Connect**.
8+
In the Atlas UI, navigate to the **Overview** page. In the **Clusters section**, select the cluster you just created and click **Connect**.
99

1010
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/3-get-conn-string/1-connect-button.png" alt="Screenshot of the connect button" />
1111

docs/20-fireworks-ai/1-create-account.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Screenshot from "@site/src/components/Screenshot";
22

33
# 👐 Create an account
44

5-
In this lab, we will be using _FireFunction V1_, a free and open-source function calling model from Fireworks AI.
5+
In this lab, we will use _FireFunction V1_, a free and open-source function calling model from Fireworks AI.
66

77
The easiest way to use this model is via the Fireworks API. But first, you will need to create a Fireworks account. **If you already have an account, you can move on to the next section.**
88

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

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Screenshot from "@site/src/components/Screenshot";
22

3-
# 👐 Setup Dev Environment
3+
# 👐 Setup dev environment
44

55
* Clone the [GitHub repo](https://github.com/mongodb-developer/ai-agents-lab-notebooks.git) for this lab by executing the following command from the terminal:
66

@@ -30,12 +30,4 @@ jupyter notebook
3030

3131
* In the browser tab that pops up, open the notebook named `notebook_template.ipynb`. This is the notebook you will be working in for this lab.
3232

33-
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/1-jupyter-notebook.png" alt="Jupyter Notebook" />
34-
35-
* Run the code cell under `Step 1: Install Libraries` in the notebook to install all the Python libraries required for the lab.
36-
37-
<Screenshot url="http://localhost:8888/notebooks/notebook_template.ipynb" src="img/screenshots/30-dev-env/2-install-libraries.png" alt="Install libraries" />
38-
39-
* Under `Step 2: Setup Pre-requisites`, replace `<CODE_BLOCK_1>` with the MongoDB connection string, `<CODE_BLOCK_2>` with the Fireworks API key and run the cells.
40-
41-
<Screenshot url="http://localhost:8888/notebooks/notebook_template.ipynb" src="img/screenshots/30-dev-env/3-setup-prereqs.png" alt="Setup prereqs" />
33+
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/1-jupyter-notebook.png" alt="Jupyter Notebook" />

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

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# 👐 Setup pre-requisites
2+
3+
Fill in any `<CODE_BLOCK>`s and run the cells under the **Step 1: Install libraries** and **Step 2: Setup pre-requisites** sections in the notebook.

docs/40-agent-tools/1-knowledge-base.mdx

+7-23
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,12 @@
11
# 👐 Create the agent's knowledge base
22

3-
One of the tools that the AI research agent has access to is a question-answering tool for the agent to answer questions based on information in its knowledge base. But first, we need to create the knowledge base.
3+
One of the tools that the AI research agent has access to is a question-answering tool that retrieves information from a knowledge base (MongoDB collection) and uses it to answer questions. But first, we need to create the knowledge base.
44

5-
## Download the dataset from Hugging Face
5+
Fill in any `<CODE_BLOCK>`s and run the cells under the **Step 3: Create a knowledge base** section in the notebook to download a dataset of Arxiv papers from [Hugging Face](https://huggingface.co/datasets/mongodb-eai/arxiv-embeddings) and ingest it into a MongoDB collection which will serve as our agent's knowledge base.
66

7-
We will use a dataset consisting of a subset of Arxiv papers, to build our knowledge base. The data is available on [Hugging Face](https://huggingface.co/datasets/mongodb-eai/arxiv-embeddings).
7+
The answers for code blocks in this section are as follows:
88

9-
👐 Run the first **TWO** cells under "Step 3: Ingest Data into MongoDB Atlas" to download the dataset from Hugging Face and preview it.
10-
11-
Notice that the dataset already has an `embedding` column, which consists of embeddings of the paper abstracts.
12-
13-
## Ingest data into MongoDB Atlas
14-
15-
Let's use the **PyMongo** Python library to ingest data into MongoDB Atlas. Fill in `<CODE_BLOCK_3>` to `<CODE_BLOCK_6>` and run the cells containing these code blocks.
16-
17-
👐 **CODE_BLOCK_3**: Initialize a MongoDB Python client
18-
19-
📚 https://pymongo.readthedocs.io/en/stable/api/pymongo/mongo_client.html
9+
**CODE_BLOCK_3**
2010

2111
<details>
2212
<summary>Answer</summary>
@@ -27,9 +17,7 @@ MongoClient(MONGODB_URI)
2717
</div>
2818
</details>
2919

30-
👐 **CODE_BLOCK_4**: Connect to the `COLLECTION_NAME` collection using the MongoDB client
31-
32-
📚 https://pymongo.readthedocs.io/en/stable/tutorial.html#getting-a-collection
20+
**CODE_BLOCK_4**
3321

3422
<details>
3523
<summary>Answer</summary>
@@ -40,9 +28,7 @@ client[DB_NAME][COLLECTION_NAME]
4028
</div>
4129
</details>
4230

43-
👐 **CODE_BLOCK_5**: Bulk delete all existing records from the `collection` collection -- should be a one-liner
44-
45-
📚 https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html
31+
**CODE_BLOCK_5**
4632

4733
<details>
4834
<summary>Answer</summary>
@@ -53,9 +39,7 @@ collection.delete_many({})
5339
</div>
5440
</details>
5541

56-
👐 **CODE_BLOCK_6**: Bulk insert `records` into the `collection` collection -- should be a one-liner
57-
58-
📚 https://pymongo.readthedocs.io/en/stable/api/pymongo/collection.html
42+
**CODE_BLOCK_6**
5943

6044
<details>
6145
<summary>Answer</summary>

docs/40-agent-tools/2-chat-completion-llm.mdx

-22
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# 👐 Create a vector search index
2+
3+
To retrieve documents from the knowledge base using vector search, you must configure a vector search index on the knowledge base collection.
4+
5+
To do this, open the **Database Deployments** page in the Atlas UI and select **Create Index** in the lower right corner under Atlas Search.
6+
7+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/40-agent-tools/1-create-index.png" alt="Select create index" />
8+
9+
Click the **Create Search Index** button.
10+
11+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/40-agent-tools/2-create-search-index.png" alt="Create search index" />
12+
13+
Click **JSON Editor** under Atlas Vector Search to create your index
14+
15+
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/40-agent-tools/3-json-editor.png" alt="The 'Create Index' page with the 'JSON Editor' tab highlighted" />
16+
17+
18+
Select the `mongodb_agents_lab` database and the `knowledge` collection, change the index name to `vector_index`, and add the following index definition in the JSON editor:
19+
20+
```python
21+
{
22+
"fields": [
23+
{
24+
"type": "vector",
25+
"path": "embedding",
26+
"numDimensions": 1024,
27+
"similarity": "cosine"
28+
}
29+
]
30+
}
31+
```
32+
33+
:::info
34+
The number of dimensions in the index definition is 1024 since the Arxiv dataset we used to create the knowledge base uses Mixedbread AI's open-source [mxbai-embed-large-v1](https://huggingface.co/mixedbread-ai/mxbai-embed-large-v1) model for embeddings.
35+
:::
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# 👐 Instantiate chat completion LLM
2+
3+
Let's instantiate the chat completion LLM to use as the "brain" of our agent and for any of the tools if required.
4+
5+
We will use Fireworks AI's free AND open-source _firefunction-v1_ model via the _ChatFireworks_ API in LangChain.
6+
7+
Fill in any `<CODE_BLOCK>`s and run the cells under the **Step 5: Instantiate chat completion LLM** section in the notebook to create an instance of _ChatFireworks_ with the _firefunction-v1_ model.
8+
9+
The answers for code blocks in this section are as follows:
10+
11+
**CODE_BLOCK_7**
12+
13+
<details>
14+
<summary>Answer</summary>
15+
<div>
16+
```python
17+
ChatFireworks(
18+
model="accounts/fireworks/models/firefunction-v1", temperature=0.0, max_tokens=1024
19+
)
20+
```
21+
</div>
22+
</details>

docs/40-agent-tools/3-define-agent-tools.mdx

-183
This file was deleted.

0 commit comments

Comments
 (0)