diff --git a/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb b/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb index 9ceceee0fd..af6cc33404 100644 --- a/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb +++ b/docs/docs/integrations/vectorstores/mongodb_atlas.ipynb @@ -7,29 +7,33 @@ "source": [ "# MongoDB Atlas\n", "\n", - ">[MongoDB Atlas](https://www.mongodb.com/docs/atlas/) is a fully-managed cloud database available in AWS, Azure, and GCP. It now has support for native Vector Search on your MongoDB document data.\n", + "This notebook covers how to MongoDB Atlas vector search in LangChain, using the `langchain-mongodb` package.\n", "\n", - "You'll need to install `langchain-community` with `pip install -qU langchain-community` to use this integration\n", - "\n", - "This notebook shows how to use [MongoDB Atlas Vector Search](https://www.mongodb.com/products/platform/atlas-vector-search) to store your embeddings in MongoDB documents, create a vector search index, and perform KNN search with an approximate nearest neighbor algorithm (`Hierarchical Navigable Small Worlds`). It uses the [$vectorSearch MQL Stage](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/). \n", + ">[MongoDB Atlas](https://www.mongodb.com/docs/atlas/) is a fully-managed cloud database available in AWS, Azure, and GCP. It supports native Vector Search and full text search (BM25) on your MongoDB document data.\n", "\n", + ">[MongoDB Atlas Vector Search](https://www.mongodb.com/products/platform/atlas-vector-search) allows to store your embeddings in MongoDB documents, create a vector search index, and perform KNN search with an approximate nearest neighbor algorithm (`Hierarchical Navigable Small Worlds`). It uses the [$vectorSearch MQL Stage](https://www.mongodb.com/docs/atlas/atlas-vector-search/vector-search-overview/). " + ] + }, + { + "cell_type": "markdown", + "id": "359b8e9b", + "metadata": {}, + "source": [ + "## Prerequisites\n", + ">*An Atlas cluster running MongoDB version 6.0.11, 7.0.2, or later (including RCs).\n", "\n", - "To use MongoDB Atlas, you must first deploy a cluster. We have a Forever-Free tier of clusters available. To get started head over to Atlas here: [quick start](https://www.mongodb.com/docs/atlas/getting-started/).\n", + ">*An OpenAI API Key. You must have a paid OpenAI account with credits available for API requests.\n", "\n", - " " + "You'll need to install `langchain-mongodb` to use this integration" ] }, { "cell_type": "markdown", - "id": "5abfec15", + "id": "d899e588", "metadata": {}, "source": [ - "> Note: \n", - "> \n", - ">* More documentation can be found at [LangChain-MongoDB site](https://www.mongodb.com/docs/atlas/atlas-vector-search/ai-integrations/langchain/)\n", - ">* This feature is Generally Available and ready for production deployments.\n", - ">* The langchain version 0.0.305 ([release notes](https://github.com/langchain-ai/langchain/releases/tag/v0.0.305)) introduces the support for $vectorSearch MQL stage, which is available with MongoDB Atlas 6.0.11 and 7.0.2. Users utilizing earlier versions of MongoDB Atlas need to pin their LangChain version to <=0.0.304\n", - "> " + "## Setting up MongoDB Atlas Cluster\n", + "To use MongoDB Atlas, you must first deploy a cluster. We have a Forever-Free tier of clusters available. To get started head over to Atlas here: [quick start](https://www.mongodb.com/docs/atlas/getting-started/)." ] }, { @@ -37,6 +41,7 @@ "id": "1b5ce18d", "metadata": {}, "source": [ + "## Usage\n", "In the notebook we will demonstrate how to perform `Retrieval Augmented Generation` (RAG) using MongoDB Atlas, OpenAI and Langchain. We will be performing Similarity Search, Similarity Search with Metadata Pre-Filtering, and Question Answering over the PDF document for [GPT 4 technical report](https://arxiv.org/pdf/2303.08774.pdf) that came out in March 2023 and hence is not part of the OpenAI's Large Language Model(LLM)'s parametric memory, which had a knowledge cutoff of September 2021." ] }, @@ -76,7 +81,7 @@ "metadata": {}, "outputs": [], "source": [ - "%pip install --upgrade --quiet langchain pypdf pymongo langchain-openai tiktoken" + "%pip install --upgrade --quiet langchain langchain-mongodb pypdf pymongo langchain-openai tiktoken" ] }, { @@ -411,6 +416,18 @@ "source": [ "GPT-4 requires significantly more compute than earlier GPT models. On a dataset derived from OpenAI's internal codebase, GPT-4 requires 100p (petaflops) of compute to reach the lowest loss, while the smaller models require 1-10n (nanoflops)." ] + }, + { + "cell_type": "markdown", + "id": "0ac44802", + "metadata": {}, + "source": [ + "# Other Notes\n", + ">* More documentation can be found at [LangChain-MongoDB](https://www.mongodb.com/docs/atlas/atlas-vector-search/ai-integrations/langchain/) site\n", + ">* This feature is Generally Available and ready for production deployments.\n", + ">* The langchain version 0.0.305 ([release notes](https://github.com/langchain-ai/langchain/releases/tag/v0.0.305)) introduces the support for $vectorSearch MQL stage, which is available with MongoDB Atlas 6.0.11 and 7.0.2. Users utilizing earlier versions of MongoDB Atlas need to pin their LangChain version to <=0.0.304\n", + "> " + ] } ], "metadata": {