-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ajosh0504
committed
Jun 4, 2024
1 parent
165d20e
commit 79c2efb
Showing
50 changed files
with
266 additions
and
1,009 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import Link from "@site/src/components/Link"; | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Create your account | ||
|
||
In this lab, you will learn how to use MongoDB Atlas as a knowledge base as well as a memory provider for AI agents. | ||
|
||
To use MongoDB Atlas, you will need to start by creating an account. **If you already have an account, you can skip the following steps and move on to the next section.** | ||
|
||
## Sign up for MongoDB Atlas | ||
|
||
Start by going to the <Link to="http://mongodb.com/try">MongoDB website</Link> and creating your account. | ||
|
||
:::tip | ||
Creating a MongoDB Atlas account is free and does not require a credit card. | ||
::: | ||
|
||
You will be greeted by a form similar to the one below. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/1-create-account/1-form.png" alt="Account creation form" /> | ||
|
||
:::info | ||
If you are doing this lab at an event, you should use the same email address you used to register for the event. | ||
::: | ||
|
||
Complete the form and click the **Create Your Atlas Account** button. | ||
|
||
## Verify your email address | ||
|
||
You will receive an email from MongoDB asking you to verify your email address. Click the link in the email to verify your email address. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/1-create-account/2-verify-email.png" alt="Verify your email address" /> | ||
|
||
:::caution | ||
If you haven't received the email within two minutes, check your spam folder. | ||
::: | ||
|
||
## Finish the onboarding | ||
|
||
You will be redirected to the MongoDB Atlas onboarding wizard. Fill in the form and click **Finish** to continue. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import Link from "@site/src/components/Link"; | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Deploy a database cluster | ||
|
||
Now that you have a MongoDB Atlas account, you can create your first cluster for free. | ||
|
||
Once logged in, from the overview page, click on the green button that says **+ Create**. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/2-create-cluster/1-overview.png" alt="Overview screenshot" /> | ||
|
||
:::note | ||
If you just created your account, you will automatically be redirected to the cluster creation page and can skip this step. | ||
::: | ||
|
||
On the cluster creation page, choose the cloud provider and region where your data will be stored. You can also choose the type of cluster you want to create. For this lab, we will use the free tier. | ||
|
||
1. For the cluster tier, pick **M0**, which is the free tier. In the **Name** input box, assign a name (one word, no spaces) to your cluster. | ||
1. Uncheck the *Automate security setup* box. You will set up security manually in the next steps. | ||
1. Uncheck the *Preload sample dataset* box. You will import a dataset later in this lab. | ||
1. Select your favorite cloud provider and the region closest to you. | ||
1. Finally, click on the green button that says **Create Deployment**. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/2-create-cluster/2-deploy-database.png" alt="Create cluster screenshot" /> | ||
|
||
Once you're done with the hardest part of the process (the captcha), you will be redirected to the security quickstart. | ||
|
||
## Security quickstart | ||
|
||
By default, your MongoDB Atlas deployment is completely locked-down. You need to configure the network settings and create a user to access your database. | ||
|
||
While your deployment is being provisioned, you will see the security quickstart dialog. | ||
|
||
### Network access | ||
|
||
First, you should **Allow Access from Anywhere**. You will see a field prepolulated with the IP address `0.0.0.0/0`. This means that you can connect to your database from any IP address including the virtual environment you will use for this lab. Click **Add IP Address** to add this IP address to the network allowlist. | ||
|
||
:::caution | ||
It is dangerous to expose your database to the entire world. Never do this is a real production environment. | ||
::: | ||
|
||
### Database user | ||
|
||
Next, you need to create a database user. Pick any username and password you want. This will be used when you want to connect to your database. Click **Create Database User** to create the user. | ||
|
||
Atlas might create the user automatically for you if you have just created your account. In this case, the username and password will match your Atlas account credentials. | ||
|
||
:::tip | ||
Make sure to remember your username and password. You will need them later. For the sake of this workshop, it might be preferable to use a simple password that you'll remember over a more secure one. | ||
::: | ||
|
||
## Manual network access configuration | ||
|
||
If you don't see a button to **Allow Access from Anywhere**, you should close the dialog and go to the **Network Access** tab under the **Security** section in the left sidebar. Click on the **Add IP Address** button, add the IP address `0.0.0.0/0` and click **Confirm**. | ||
|
||
## That's all! | ||
|
||
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. | ||
|
||
<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" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import Link from "@site/src/components/Link"; | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Get your connection string | ||
|
||
In order to ingest data into your cluster later in the lab, you will need to get the connection string for your cluster. | ||
|
||
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**. | ||
|
||
<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" /> | ||
|
||
A modal will display several ways to connect to your database. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/3-get-conn-string/2-connect-modal.png" alt="Screenshot of the connect modal" /> | ||
|
||
Select **Compass**. While we won't be using Compass to import the data, it's an easy way to see your connection string. | ||
|
||
<Screenshot url="https://cloud.mongodb.com" src="img/screenshots/10-mongodb-atlas/3-get-conn-string/3-connect-compass.png" alt="Screenshot of the connection string" /> | ||
|
||
Look for your connection string. It should look something like: | ||
|
||
``` | ||
mongodb+srv://<username>:<password>@<cluster-url>/ | ||
``` | ||
|
||
Click the copy button next to your connection string to copy it to your clipboard. Paste the connection string somewhere safe. | ||
|
||
:::tip | ||
Don't forget to replace `<password>` with the password you set when you created the cluster. | ||
::: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "MongoDB Atlas", | ||
"position": 1, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Create a MongoDB Atlas account and deploy a free cluster." | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Create an account | ||
|
||
In this lab, we will be using _FireFunction V1_, a free and open-source function calling model from Fireworks AI. | ||
|
||
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.** | ||
|
||
Start by navigating to to the [Fireworks AI homepage](https://fireworks.ai/) and click the purple **Get Started Free** button to create an account. | ||
|
||
<Screenshot url="https://fireworks.ai/" src="img/screenshots/20-fireworks-ai/1-create-account/1-homepage.png" alt="Get started" /> | ||
|
||
Click **Login With Google** and authenticate with your Google account. This will provision a new Fireworks account for you. | ||
|
||
<Screenshot url="https://fireworks.ai/" src="img/screenshots/20-fireworks-ai/1-create-account/2-google-login.png" alt="Login" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Create an API Key | ||
|
||
Once you have a Fireworks account, you can create an API key. | ||
|
||
Upon logging in, click the **API Keys** tab. | ||
|
||
<Screenshot url="https://fireworks.ai/" src="img/screenshots/20-fireworks-ai/2-create-api-key/1-api-key.png" alt="Select API keys" /> | ||
|
||
Click the purple **Create API Key** button. In the modal that appears, enter a name and click **Create Key** to create an API key. | ||
|
||
<Screenshot url="https://fireworks.ai/" src="img/screenshots/20-fireworks-ai/2-create-api-key/2-create-api-key.png" alt="Create API key" /> | ||
|
||
Click the copy button next to your API key to copy it to your clipboard. Paste the API key somewhere safe. | ||
|
||
<Screenshot url="https://fireworks.ai/" src="img/screenshots/20-fireworks-ai/2-create-api-key/3-copy-api-key.png" alt="Copy API key" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Fireworks AI", | ||
"position": 2, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "Create a Fireworks AI account and API key." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Screenshot from "@site/src/components/Screenshot"; | ||
|
||
# 👐 Setup Dev Environment | ||
|
||
* 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: | ||
|
||
``` | ||
git clone https://github.com/mongodb-developer/ai-agents-lab-notebooks.git | ||
``` | ||
|
||
* `cd` into the cloned directory: | ||
|
||
``` | ||
cd ai-agents-lab-notebooks | ||
``` | ||
|
||
* Create and activate a Python virtual environment: | ||
|
||
``` | ||
python -m venv mongodb-ai-agents-lab | ||
source mongodb-ai-agents-lab/bin/activate | ||
``` | ||
|
||
* Install and launch Jupyter Notebook: | ||
|
||
``` | ||
pip install notebook | ||
jupyter notebook | ||
``` | ||
|
||
* 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. | ||
|
||
<Screenshot url="localhost:8888/tree" src="img/screenshots/30-dev-env/1-jupyter-notebook.png" alt="Jupyter Notebook" /> | ||
|
||
* Run the code cell under `Step 1: Install Libraries` in the notebook to install all the Python libraries required for the lab. | ||
|
||
<Screenshot url="http://localhost:8888/notebooks/notebook_template.ipynb" src="img/screenshots/30-dev-env/2-install-libraries.png" alt="Install libraries" /> | ||
|
||
* 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. | ||
|
||
<Screenshot url="http://localhost:8888/notebooks/notebook_template.ipynb" src="img/screenshots/30-dev-env/3-setup-prereqs.png" alt="Setup prereqs" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"label": "Dev Environment", | ||
"position": 3, | ||
"link": { | ||
"type": "generated-index", | ||
"description": "In this section, you will set up the Python development environment for this lab." | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.