Skip to content

Commit 9fd6da7

Browse files
authored
Merge pull request #12 from mongodb-developer/add_voyageai
Voyage AI doc update
2 parents 6af946a + e35e5df commit 9fd6da7

File tree

14 files changed

+52
-53
lines changed

14 files changed

+52
-53
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Screenshot from "@site/src/components/Screenshot";
1414

1515
<Screenshot url="https://play.instruqt.com" src="img/screenshots/20-dev-env/1-dev-env-setup/instruqt/1-resume-sandbox.png" alt="Resume sandbox" />
1616

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.
17+
In the Explorer menu, navigate to `genai-devday-notebooks` > `labs` > `ai-agents-lab.ipynb` This is the Jupyter Notebook you will be using throughout this lab.
1818

1919
<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" />
2020

@@ -29,7 +29,7 @@ import Screenshot from "@site/src/components/Screenshot";
2929

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

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.
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 `labs`. This is the Jupyter Notebook you will be using throughout this lab.
3333

3434
<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" />
3535
</TabItem>
@@ -89,7 +89,7 @@ You will also see the default databases in the cluster appear under **Connection
8989

9090
You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next!
9191

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.
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` > `labs` > `ai-agents-lab.ipynb` to open the Jupyter Notebook for this lab.
9393

9494
<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" />
9595

@@ -143,7 +143,7 @@ You will also see the default databases in the cluster appear under **Connection
143143

144144
You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next!
145145

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.
146+
Within the codespace, click on the files icon in the left navigation bar of the IDE. In the Explorer menu, under `labs`, click on the file named `ai-agents-lab.ipynb` to open the Jupyter Notebook for this lab.
147147

148148
<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" />
149149

@@ -161,10 +161,10 @@ To run the lab locally, follow the steps below:
161161
git clone https://github.com/mongodb-developer/genai-devday-notebooks.git
162162
```
163163

164-
* `cd` into the `notebooks` directory of the cloned repository:
164+
* `cd` into the `labs` directory of the cloned repository:
165165

166166
```
167-
cd genai-devday-notebooks/notebooks
167+
cd genai-devday-notebooks/labs
168168
```
169169

170170
* Create and activate a Python virtual environment:
Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,44 @@
11
# 👐 Setup prerequisites
22

3-
Select the LLM provider recommended by your instructor, and run the cells under the **Step 1: Setup prerequisites** section in the notebook.
3+
Set the passkey and LLM provider provided by your instructor, and run the cells under the **Step 1: Setup prerequisites** section in the notebook.
44

5-
:::info
5+
### Expired passkey OR don't have a passkey
66

7-
Additional steps **if you are running the lab locally**:
7+
Passkeys are provided to you at MongoDB Developer Days to easily get API keys for LLM and embedding APIs that are used in the workshop. These passkeys are valid for 3 days after the workshop.
88

9-
* Spin up a MongoDB Atlas cluster and obtain its connection string:
9+
Once the passkey expires, or if you weren't at a MongoDB Developer Day recently, you will need to obtain the following API keys for the workshop:
1010

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:
11+
**Voyage AI**
12+
* Follow the steps here to [obtain a Voyage AI API key](https://docs.voyageai.com/docs/api-key-and-installation#authentication-with-api-keys).
13+
* Set the `VOYAGE_API_KEY` environment variable in the notebook as follows:
1614

1715
```python
18-
MONGODB_URI = "<your_connection_string>"
16+
os.environ["VOYAGE_API_KEY"] = "your-voyageai-api-key"
1917
```
2018

21-
* Manually set the value of the `SERVERLESS_URL` variable as follows:
19+
**Gemini**
20+
* Set the `LLM_PROVIDER` in the notebook to "google"
21+
22+
* Obtain a Gemini API key from [here](https://aistudio.google.com/app/apikey).
23+
24+
* Set the `GOOGLE_API_KEY` environment variable in the notebook as follows:
2225

2326
```python
24-
SERVERLESS_URL = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/"
27+
os.environ["GOOGLE_API_KEY"] = "your-google-api-key"
2528
```
26-
:::
29+
30+
### If you are running the lab locally
31+
32+
If you aren't using Instruqt or GitHub Codespaces to run the lab and instead running it locally, you will need to do the following additional steps:
33+
34+
* Spin up a free MongoDB Atlas cluster and obtain its connection string:
35+
36+
* Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register) if you don't already have one
37+
* [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster)
38+
* [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string) for your database cluster
39+
40+
* Set the `MONGODB_URI` variable in the notebook as follows:
41+
42+
```python
43+
MONGODB_URI = "your_connection_string"
44+
```

docs/40-agent-tools/1-lecture-notes.mdx

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
# 📘 Lecture notes
22

3-
## About the data
4-
5-
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:
6-
7-
* [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`.
8-
9-
* [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`.
10-
11-
To learn more about chunking and embedding, here are some resources from our Developer Center:
12-
13-
* [How to Choose the Right Chunking Strategy for Your LLM Application](https://www.mongodb.com/developer/products/atlas/choosing-chunking-strategy-rag/?utm_campaign=devrel&utm_medium=ai-agents-devday-workshop&utm_term=apoorva.joshi)
14-
* [How to Choose the Best Embedding Model for Your LLM Application](https://www.mongodb.com/developer/products/atlas/choose-embedding-model-rag/?utm_campaign=devrel&utm_medium=ai-agents-devday-workshop&utm_term=apoorva.joshi)
15-
163
## Tool calling
174

185
Tool calling, interchangeably called function calling allows an LLM to use external tools such as APIs, databases, specialized machine learning models etc.

docs/40-agent-tools/2-create-vector-search-index.mdx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,4 @@
22

33
To retrieve documents using vector search, you must configure a vector search index on the collection you want to perform vector search against.
44

5-
Fill in any `<CODE_BLOCK_N>` placeholders and run the cells under the **Step 3: Create a vector search index** section in the notebook to create a vector search index.
6-
7-
The answers for code blocks in this section are as follows:
8-
9-
**CODE_BLOCK_1**
10-
11-
<details>
12-
<summary>Answer</summary>
13-
<div>
14-
15-
```python
16-
create_index(vs_collection, VS_INDEX_NAME, model)
17-
```
18-
19-
</div>
20-
</details>
5+
Run the cells under the **Step 3: Create a vector search index** section in the notebook to create a vector search index.

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,24 @@ The answers for code blocks in this section are as follows:
1414

1515
## Vector search tool
1616

17+
**CODE_BLOCK_1**
18+
19+
<details>
20+
<summary>Answer</summary>
21+
<div>
22+
```python
23+
vo.contextualized_embed(inputs=[[query]], model="voyage-context-3", input_type="query")
24+
```
25+
</div>
26+
</details>
27+
1728
**CODE_BLOCK_2**
1829

1930
<details>
2031
<summary>Answer</summary>
2132
<div>
2233
```python
23-
embedding_model.encode(text)
34+
embds_obj.results[0].embeddings[0]
2435
```
2536
</div>
2637
</details>
@@ -31,7 +42,7 @@ embedding_model.encode(text)
3142
<summary>Answer</summary>
3243
<div>
3344
```python
34-
get_embedding(user_query)
45+
get_embeddings(user_query)
3546
```
3647
</div>
3748
</details>

docs/50-create-agent/1-lecture-notes.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ To learn more about these concepts, refer to the [LangGraph docs](https://langch
1717

1818
## Using different LLM providers with LangChain
1919

20-
LangChain supports different LLM providers for you to build AI applications with. Unless you are using open-source models, you typically need to obtain API keys to use the chat completion APIs offered by different LLM providers.
21-
22-
For this lab, we have created a serverless function that creates LLM objects for Amazon, Google and Microsoft models that you can use with LangChain and LangGraph without having to obtain API keys. However, if you would like to do this on your own, here are some resources:
20+
LangChain supports different LLM providers for you to build AI applications with. For this lab, we have created a utility function that generates LangChain LLM objects based on your chosen provider (Amazon, Google or Microsoft). However, if you would like to do this on your own, here are some resources:
2321

2422
* [Using Amazon Bedrock LLMs with LangChain](https://python.langchain.com/docs/integrations/llms/bedrock/)
2523

53 KB
Loading
5.78 KB
Loading
25 KB
Loading
-52.3 KB
Loading

0 commit comments

Comments
 (0)