|
| 1 | +import Tabs from '@theme/Tabs'; |
| 2 | +import TabItem from '@theme/TabItem'; |
1 | 3 | import Screenshot from "@site/src/components/Screenshot";
|
2 | 4 |
|
3 | 5 | # 👐 Setup dev environment
|
4 | 6 |
|
5 | 7 | <details>
|
6 |
| - <summary>🦹 If you are doing this lab as part of a MongoDB GenAI Developer Day, you can continue in the Codespace you previously created.</summary> |
| 8 | + <summary>🦹 If you are doing this lab as part of a MongoDB GenAI Developer Day, you can continue in the environment you previously created.</summary> |
7 | 9 |
|
8 |
| - 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. |
| 10 | + <Tabs groupId="resume lab"> |
| 11 | + <TabItem value="Instruqt" label="Instruqt"> |
9 | 12 |
|
10 |
| - <Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/1-resume-codespace.png" alt="Resume codespace" /> |
| 13 | + Navigate to the Instruqt lab using [this](http://mdb.link/instruqt-ai) link. Click **Continue** to continue in the sandbox you created previously. |
| 14 | + |
| 15 | + <Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/1-resume-sandbox.png" alt="Resume sandbox" /> |
| 16 | + |
| 17 | + In the Explorer menu, navigate to `genai-devday-notebooks` > `notebooks` > `ai-agents-lab.ipynb` This is the Jupyter Notebook you will be using throughout this lab. |
| 18 | + |
| 19 | + <Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png" alt="Navigate to the notebook" /> |
| 20 | + |
| 21 | + :::tip |
| 22 | + Notice that this documentation website is also linked in the `Agents Lab Instructions` tab of your Instruqt sandbox. Feel free to access the documentation from there instead for the rest of the lab. |
| 23 | + ::: |
| 24 | + </TabItem> |
| 25 | + |
| 26 | + <TabItem value="GitHub Codespaces" label="GitHub Codespaces"> |
| 27 | + |
| 28 | + 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 codespace you created previously. |
| 29 | + |
| 30 | + <Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/1-resume-codespace.png" alt="Resume codespace" /> |
11 | 31 |
|
12 | 32 | Give the codespace a few seconds to restart. When files appear in the Explorer tab, click on the file named `ai-agents-lab.ipynb` under `notebooks`. This is the Jupyter Notebook you will be using throughout this lab.
|
13 | 33 |
|
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" /> |
| 34 | + <Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png" alt="Navigate to the notebook" /> |
| 35 | + </TabItem> |
| 36 | + |
| 37 | + <TabItem value="Local" label="Local"> |
| 38 | + |
| 39 | + Open the browser tab where your Jupyter Server from before is running and open the file named `ai-agents-lab.ipynb`. |
| 40 | + |
| 41 | + <Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png" alt="Jupyter Notebook" /> |
| 42 | + |
| 43 | + </TabItem> |
| 44 | + </Tabs> |
15 | 45 | </details>
|
16 | 46 |
|
17 | 47 | :::tip
|
18 | 48 | In this lab, we will be using Jupyter Notebooks, which is an interactive Python environment. If you are new to Jupyter Notebooks, use [this](https://mongodb-developer.github.io/vector-search-lab/docs/dev-env/jupyter-notebooks) guide to familiarize yourself with the environment.
|
19 | 49 | :::
|
20 | 50 |
|
21 |
| -## Option 1: GitHub Codespaces |
| 51 | +<Tabs groupId="setup options"> |
| 52 | +<TabItem value="Instruqt" label="Instruqt"> |
22 | 53 |
|
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. |
| 54 | +Instruqt is a lab platform that provides cloud-based sandboxes which come pre-configured with all the tools you need to run this lab. |
24 | 55 |
|
25 |
| -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. |
| 56 | +**Navigate to the Instruqt lab using [this](http://mdb.link/instruqt-ai) link.** Fill out the form that appears and click **Submit and access**. |
26 | 57 |
|
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" /> |
| 58 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/3-submit-form.png" alt="Submit Instruqt form" /> |
28 | 59 |
|
29 |
| -Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster. |
| 60 | +Click **Start** to launch the lab environment. |
| 61 | + |
| 62 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/4-start-sandbox-setup.png" alt="Start Instruqt sandbox" /> |
| 63 | + |
| 64 | +You should see a screen with a purple progress bar indicating that Instruqt is preparing a sandbox with all the required libraries for this lab and a MongoDB cluster. |
| 65 | + |
| 66 | +Once this is done, you should see a Start button at the bottom right of the screen. Click this to enter the lab. |
| 67 | + |
| 68 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/5-start-lab.png" alt="Start Instruqt lab" /> |
30 | 69 |
|
31 | 70 | ### Connect to the MongoDB cluster
|
32 | 71 |
|
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. |
| 72 | +Let's first connect to the MongoDB cluster that was created for you. This will allow you to view data we import into the cluster later in the lab, directly from the VSCode IDE. |
34 | 73 |
|
35 |
| -To connect to the cluster, click the leaf icon in the left navigation bar of the IDE. |
| 74 | +To do this, click the leaf icon in the left navigation bar of the IDE. This is MongoDB's VSCode extension. |
36 | 75 |
|
37 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/4-click-leaf.png" alt="Click leaf icon" /> |
| 76 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/6-click-leaf.png" alt="Click leaf icon" /> |
38 | 77 |
|
39 |
| -Under **Connections**, click the _mongodb:27017_ connection. This should automatically establish a connection to the local MongoDB cluster running on port 27017. |
| 78 | +Under **Connections**, click the _Local MongoDB Atlas_ connection. This should automatically establish a connection to the local MongoDB cluster running on port 27017. |
40 | 79 |
|
41 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/5-connect-cluster.png" alt="Connect to the cluster" /> |
| 80 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/7-connect-cluster.png" alt="Connect to the cluster" /> |
42 | 81 |
|
43 |
| -If the connection was successful, you should see the message **Connected to: mongodb:27017** with a green indicator. |
| 82 | +If the connection was successful, you should see a green leaf and a "connected" message appear around the _Local MongoDB Atlas_ connection. |
44 | 83 |
|
45 | 84 | You will also see the default databases in the cluster appear under **Connections**. Any additional databases we create during the lab will also appear here.
|
46 | 85 |
|
47 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/6-connection-successful.png" alt="Connection successful" /> |
| 86 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/8-connection-successful.png" alt="Connection successful" /> |
48 | 87 |
|
49 | 88 | ### Jupyter Notebook setup
|
50 | 89 |
|
51 | 90 | You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next!
|
52 | 91 |
|
53 |
| -Within the codespace, click on the files icon in the left navigation bar of the IDE. In the Explorer menu, under `notebooks`, click on the file named `ai-agents-lab.ipynb` to open the Jupyter Notebook for this lab. |
| 92 | +Within the sandbox, click on the files icon in the left navigation bar of the IDE. In the Explorer menu, navigate to `genai-devday-notebooks` > `notebooks` > `ai-agents-lab.ipynb` to open the Jupyter Notebook for this lab. |
54 | 93 |
|
55 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/7-nav-notebook.png" alt="Navigate to the notebook" /> |
| 94 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png" alt="Navigate to the notebook" /> |
56 | 95 |
|
57 | 96 | Next, select the Python interpreter by clicking **Select Kernel** at the top right of the IDE.
|
58 | 97 |
|
59 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/8-select-kernel.png" alt="Select kernel" /> |
| 98 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/9-select-kernel.png" alt="Select kernel" /> |
60 | 99 |
|
61 | 100 | In the modal that appears, click **Python environments...** and select the interpreter that is marked as **Recommended** or **Global Env**.
|
62 | 101 |
|
63 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/9-python-env-modal.png" alt="Select Python Environments" /> |
| 102 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/10-python-env-modal.png" alt="Select Python Environments" /> |
64 | 103 |
|
65 |
| -<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/10-select-recommended.png" alt="Select recommended interpreter" /> |
| 104 | +<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/11-select-recommended.png" alt="Select recommended interpreter" /> |
66 | 105 |
|
67 | 106 | That's it! You're ready for the lab!
|
68 | 107 |
|
69 |
| -## Option 2: Run locally |
70 |
| - |
71 |
| -:::caution |
72 |
| -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. |
| 108 | +:::tip |
| 109 | +Notice that this documentation website is also linked in the `Agents Lab Instructions` tab of your Instruqt sandbox. Feel free to access the documentation from there instead for the rest of the lab. |
73 | 110 | :::
|
74 | 111 |
|
| 112 | +</TabItem> |
| 113 | + |
| 114 | +<TabItem value="GitHub Codespaces" label="GitHub Codespaces"> |
| 115 | + |
| 116 | +A codespace is a cloud-hosted development environment from GitHub, that comes pre-configured with all the tools you need to run this lab. |
| 117 | + |
| 118 | +**To create a 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. |
| 119 | + |
| 120 | +<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/3-create-codespace.png" alt="Start a codespace" /> |
| 121 | + |
| 122 | +Let it run for a few seconds as it prepares a Docker container with all the required libraries and a MongoDB cluster. |
| 123 | + |
| 124 | +### Connect to the MongoDB cluster |
| 125 | + |
| 126 | +Let's first connect to the MongoDB cluster that was created for you. This will allow you to view data we import into the cluster later in the lab, directly from the VSCode IDE. |
| 127 | + |
| 128 | +To do this, click the leaf icon in the left navigation bar of the IDE. This is MongoDB's VSCode extension. |
| 129 | + |
| 130 | +<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/4-click-leaf.png" alt="Click leaf icon" /> |
| 131 | + |
| 132 | +Under **Connections**, click the _Local MongoDB Atlas_ connection. This should automatically establish a connection to the local MongoDB cluster running on port 27017. |
| 133 | + |
| 134 | +<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/5-connect-cluster.png" alt="Connect to the cluster" /> |
| 135 | + |
| 136 | +If the connection was successful, you should see a green leaf and a "connected" message appear around the _Local MongoDB Atlas_ connection. |
| 137 | + |
| 138 | +You will also see the default databases in the cluster appear under **Connections**. Any additional databases we create during the lab will also appear here. |
| 139 | + |
| 140 | +<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/6-connection-successful.png" alt="Connection successful" /> |
| 141 | + |
| 142 | +### Jupyter Notebook setup |
| 143 | + |
| 144 | +You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next! |
| 145 | + |
| 146 | +Within the codespace, click on the files icon in the left navigation bar of the IDE. In the Explorer menu, under `notebooks`, click on the file named `ai-agents-lab.ipynb` to open the Jupyter Notebook for this lab. |
| 147 | + |
| 148 | +<Screenshot url="https://github.com/codespaces" src="img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png" alt="Navigate to the notebook" /> |
| 149 | + |
| 150 | +That's it! You're ready for the lab! |
| 151 | + |
| 152 | +</TabItem> |
| 153 | + |
| 154 | +<TabItem value="Local" label="Local"> |
| 155 | + |
75 | 156 | To run the lab locally, follow the steps below:
|
76 | 157 |
|
77 | 158 | * Clone the [GitHub repo](https://github.com/mongodb-developer/genai-devday-notebooks.git) for this lab by executing the following command from the terminal:
|
@@ -108,4 +189,8 @@ jupyter notebook
|
108 | 189 |
|
109 | 190 | * In the browser tab that pops up, open the file named `ai-agents-lab.ipynb`.
|
110 | 191 |
|
111 |
| -<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/1-dev-env-setup/11-jupyter-notebook.png" alt="Jupyter Notebook" /> |
| 192 | +<Screenshot url="localhost:8888/tree" src="img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png" alt="Jupyter Notebook" /> |
| 193 | + |
| 194 | +</TabItem> |
| 195 | + |
| 196 | +</Tabs> |
0 commit comments