diff --git a/docs/20-dev-env/1-dev-env-setup.mdx b/docs/20-dev-env/1-dev-env-setup.mdx index 650757e..3b492c0 100644 --- a/docs/20-dev-env/1-dev-env-setup.mdx +++ b/docs/20-dev-env/1-dev-env-setup.mdx @@ -14,7 +14,7 @@ import Screenshot from "@site/src/components/Screenshot"; - 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. + 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. @@ -29,7 +29,7 @@ import Screenshot from "@site/src/components/Screenshot"; - 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. + 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. @@ -89,7 +89,7 @@ You will also see the default databases in the cluster appear under **Connection You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next! -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. +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. @@ -143,7 +143,7 @@ You will also see the default databases in the cluster appear under **Connection You will be filling code in a Jupyter Notebook during this lab, so let's get set up with that next! -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. +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. @@ -161,10 +161,10 @@ To run the lab locally, follow the steps below: git clone https://github.com/mongodb-developer/genai-devday-notebooks.git ``` -* `cd` into the `notebooks` directory of the cloned repository: +* `cd` into the `labs` directory of the cloned repository: ``` -cd genai-devday-notebooks/notebooks +cd genai-devday-notebooks/labs ``` * Create and activate a Python virtual environment: diff --git a/docs/20-dev-env/2-setup-pre-reqs.mdx b/docs/20-dev-env/2-setup-pre-reqs.mdx index 43a62fa..5b6ee93 100644 --- a/docs/20-dev-env/2-setup-pre-reqs.mdx +++ b/docs/20-dev-env/2-setup-pre-reqs.mdx @@ -1,26 +1,44 @@ # 👐 Setup prerequisites -Select the LLM provider recommended by your instructor, and run the cells under the **Step 1: Setup prerequisites** section in the notebook. +Set the passkey and LLM provider provided by your instructor, and run the cells under the **Step 1: Setup prerequisites** section in the notebook. -:::info +### Expired passkey OR don't have a passkey -Additional steps **if you are running the lab locally**: +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. -* Spin up a MongoDB Atlas cluster and obtain its connection string: +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: - * Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register) if you don't already have one - * [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster) - * [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string) for your database cluster - -* Set the `MONGODB_URI` variable to the connection string for your cluster as follows: +**Voyage AI** +* Follow the steps here to [obtain a Voyage AI API key](https://docs.voyageai.com/docs/api-key-and-installation#authentication-with-api-keys). +* Set the `VOYAGE_API_KEY` environment variable in the notebook as follows: ```python -MONGODB_URI = "" +os.environ["VOYAGE_API_KEY"] = "your-voyageai-api-key" ``` -* Manually set the value of the `SERVERLESS_URL` variable as follows: +**Gemini** +* Set the `LLM_PROVIDER` in the notebook to "google" + +* Obtain a Gemini API key from [here](https://aistudio.google.com/app/apikey). + +* Set the `GOOGLE_API_KEY` environment variable in the notebook as follows: ```python -SERVERLESS_URL = "https://vtqjvgchmwcjwsrela2oyhlegu0hwqnw.lambda-url.us-west-2.on.aws/" +os.environ["GOOGLE_API_KEY"] = "your-google-api-key" ``` -::: \ No newline at end of file + +### If you are running the lab locally + +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: + +* Spin up a free MongoDB Atlas cluster and obtain its connection string: + + * Register for a [free MongoDB Atlas account](https://www.mongodb.com/cloud/atlas/register) if you don't already have one + * [Create a new database cluster](https://www.mongodb.com/docs/guides/atlas/cluster) + * [Obtain the connection string](https://www.mongodb.com/docs/guides/atlas/connection-string) for your database cluster + +* Set the `MONGODB_URI` variable in the notebook as follows: + +```python +MONGODB_URI = "your_connection_string" +``` \ No newline at end of file diff --git a/docs/40-agent-tools/1-lecture-notes.mdx b/docs/40-agent-tools/1-lecture-notes.mdx index cf5e867..40830e4 100644 --- a/docs/40-agent-tools/1-lecture-notes.mdx +++ b/docs/40-agent-tools/1-lecture-notes.mdx @@ -1,18 +1,5 @@ # 📘 Lecture notes -## About the data - -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: - -* [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`. - -* [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: - -* [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) -* [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) - ## Tool calling Tool calling, interchangeably called function calling allows an LLM to use external tools such as APIs, databases, specialized machine learning models etc. diff --git a/docs/40-agent-tools/2-create-vector-search-index.mdx b/docs/40-agent-tools/2-create-vector-search-index.mdx index 80f4e75..8225162 100644 --- a/docs/40-agent-tools/2-create-vector-search-index.mdx +++ b/docs/40-agent-tools/2-create-vector-search-index.mdx @@ -2,19 +2,4 @@ To retrieve documents using vector search, you must configure a vector search index on the collection you want to perform vector search against. -Fill in any `` placeholders and run the cells under the **Step 3: Create a vector search index** section in the notebook to create a vector search index. - -The answers for code blocks in this section are as follows: - -**CODE_BLOCK_1** - -
-Answer -
- -```python -create_index(vs_collection, VS_INDEX_NAME, model) -``` - -
-
\ No newline at end of file +Run the cells under the **Step 3: Create a vector search index** section in the notebook to create a vector search index. \ No newline at end of file diff --git a/docs/40-agent-tools/3-create-agent-tools.mdx b/docs/40-agent-tools/3-create-agent-tools.mdx index 4679ef3..45e7a0d 100644 --- a/docs/40-agent-tools/3-create-agent-tools.mdx +++ b/docs/40-agent-tools/3-create-agent-tools.mdx @@ -14,13 +14,24 @@ The answers for code blocks in this section are as follows: ## Vector search tool +**CODE_BLOCK_1** + +
+Answer +
+```python +vo.contextualized_embed(inputs=[[query]], model="voyage-context-3", input_type="query") +``` +
+
+ **CODE_BLOCK_2**
Answer
```python -embedding_model.encode(text) +embds_obj.results[0].embeddings[0] ```
@@ -31,7 +42,7 @@ embedding_model.encode(text) Answer
```python -get_embedding(user_query) +get_embeddings(user_query) ```
diff --git a/docs/50-create-agent/1-lecture-notes.mdx b/docs/50-create-agent/1-lecture-notes.mdx index 9219f93..9c99490 100644 --- a/docs/50-create-agent/1-lecture-notes.mdx +++ b/docs/50-create-agent/1-lecture-notes.mdx @@ -17,9 +17,7 @@ To learn more about these concepts, refer to the [LangGraph docs](https://langch ## Using different LLM providers with LangChain -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. - -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: +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: * [Using Amazon Bedrock LLMs with LangChain](https://python.langchain.com/docs/integrations/llms/bedrock/) diff --git a/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png b/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png index 40f1cd9..27033ac 100644 Binary files a/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png and b/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/2-nav-notebook.png differ diff --git a/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/4-click-leaf.png b/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/4-click-leaf.png index cd9a2f8..50e7f33 100644 Binary files a/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/4-click-leaf.png and b/static/img/screenshots/20-dev-env/1-dev-env-setup/codespaces/4-click-leaf.png differ diff --git a/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png b/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png index 5d1118c..4e928be 100644 Binary files a/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png and b/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/2-nav-notebook.png differ diff --git a/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/9-select-kernel.png b/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/9-select-kernel.png index d8dfba0..10d91df 100644 Binary files a/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/9-select-kernel.png and b/static/img/screenshots/20-dev-env/1-dev-env-setup/instruqt/9-select-kernel.png differ diff --git a/static/img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png b/static/img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png index ae888ee..71b1f96 100644 Binary files a/static/img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png and b/static/img/screenshots/20-dev-env/1-dev-env-setup/local/1-nav-notebook.png differ diff --git a/static/img/screenshots/30-import-data/1-import-data/1-verify-collections.png b/static/img/screenshots/30-import-data/1-import-data/1-verify-collections.png index 7c3aa00..fca6fc5 100644 Binary files a/static/img/screenshots/30-import-data/1-import-data/1-verify-collections.png and b/static/img/screenshots/30-import-data/1-import-data/1-verify-collections.png differ diff --git a/static/img/screenshots/30-import-data/1-import-data/2-full-collection.png b/static/img/screenshots/30-import-data/1-import-data/2-full-collection.png index 2a44b60..ed496e2 100644 Binary files a/static/img/screenshots/30-import-data/1-import-data/2-full-collection.png and b/static/img/screenshots/30-import-data/1-import-data/2-full-collection.png differ diff --git a/static/img/screenshots/30-import-data/1-import-data/3-embedded-collection.png b/static/img/screenshots/30-import-data/1-import-data/3-embedded-collection.png index 7e14d2a..707b7a8 100644 Binary files a/static/img/screenshots/30-import-data/1-import-data/3-embedded-collection.png and b/static/img/screenshots/30-import-data/1-import-data/3-embedded-collection.png differ