You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 06_Create_First_Cosmos_DB_Project/README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ Learn more about the pre-requisites and installation of the emulator [here](http
14
14
15
15
>**NOTE**: When using the Azure CosmosDB emulator using the API for MongoDB it must be started with the [MongoDB endpoint options enabled](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=windows%2Cpython&pivots=api-mongodb#start-the-emulator) at the command-line.
16
16
17
-
**The Azure Cosmos DB emulator does not support vector search. To complete the vector search and AI-related labs, you must use an Azure Cosmos DB API for the MongoDB vCore account in Azure.**
17
+
**The Azure Cosmos DB emulator does not support vector search. To complete the vector search and AI-related labs, you must use an vCore-based Azure Cosmos DB for MongoDB account in Azure.**
# Use vector search on embeddings in Azure Cosmos DB for MongoDB vCore
1
+
# Use vector search on embeddings in vCore-based Azure Cosmos DB for MongoDB
2
2
3
-
>**NOTE**: Azure Cosmos DB for MongoDB vCore supports vector search on embeddings. This functionality is not supported on RUs-based accounts.
3
+
>**NOTE**: vCore-based Azure Cosmos DB for MongoDB supports vector search on embeddings. This functionality is not supported on RUs-based accounts.
4
4
5
5
## Embeddings and vector search
6
6
7
7
Embedding is a way of serializing the semantic meaning of data into a vector representation. Because the generated vector embedding represents the semantic meaning, it means that when it is searched, it can find similar data based on the semantic meaning of the data rather than exact text. Data can come from many sources, including text, images, audio, and video. Because the data is represented as a vector, vector search can, therefore, find similar data across all different types of data.
8
8
9
-
Embeddings are created by sending data to an embedding model, where it is transformed into a vector, which then can be stored as a vector field within its source document in Azure Cosmos DB for MongoDB vCore. Azure Cosmos DB for MongoDB vCore supports the creation of vector search indexes on top of these vector fields. A vector search index is a collection of vectors in [latent space](https://idl.cs.washington.edu/papers/latent-space-cartography/) that enables a semantic similarity search across all data (vectors) contained within.
9
+
Embeddings are created by sending data to an embedding model, where it is transformed into a vector, which then can be stored as a vector field within its source document in vCore-based Azure Cosmos DB for MongoDB. vCore-based Azure Cosmos DB for MongoDB supports the creation of vector search indexes on top of these vector fields. A vector search index is a collection of vectors in [latent space](https://idl.cs.washington.edu/papers/latent-space-cartography/) that enables a semantic similarity search across all data (vectors) contained within.
10
10
11
11

12
12
@@ -16,15 +16,15 @@ Vector search is an important RAG (Retrieval Augmented Generation) pattern compo
16
16
17
17
A vector index search allows for a prompt pre-processing step where information can be semantically retrieved from an index and then used to generate a factually accurate prompt for the LLM to reason over. This provides the knowledge augmentation and focus (attention) to the LLM.
18
18
19
-
In this example, assume textual data is vectorized and stored within an Azure Cosmos DB for MongoDB vCore database. The text data and embeddings/vector field are stored in the same document. A vector search index has been created on the vector field. When a message is received from a chat application, this message is also vectorized using the same embedding model (ex., Azure OpenAI text-embedding-ada-002), which is then used as input to the vector search index. The vector search index returns a list of documents whose vector field is semantically similar to the incoming message. The unvectorized text stored within the same document is then used to augment the LLM prompt. The LLM receives the prompt and responds to the requestor based on the information it has been given.
19
+
In this example, assume textual data is vectorized and stored within an vCore-based Azure Cosmos DB for MongoDB database. The text data and embeddings/vector field are stored in the same document. A vector search index has been created on the vector field. When a message is received from a chat application, this message is also vectorized using the same embedding model (ex., Azure OpenAI text-embedding-ada-002), which is then used as input to the vector search index. The vector search index returns a list of documents whose vector field is semantically similar to the incoming message. The unvectorized text stored within the same document is then used to augment the LLM prompt. The LLM receives the prompt and responds to the requestor based on the information it has been given.
20
20
21
21

22
22
23
-
## Why use Azure Cosmos DB for MongoDB vCore as a vector store?
23
+
## Why use vCore-based Azure Cosmos DB for MongoDB as a vector store?
24
24
25
-
It is common practice to store vectorized data in a dedicated vector store as vector search indexing is not a common capability of most databases. However, this introduces additional complexity to the solution as the data must be stored in two different locations. Azure Cosmos DB for MongoDB vCore supports vector search indexing, which means that the vectorized data can be stored in the same document as the original data. This reduces the complexity of the solution and allows for a single database to be used for both the vector store and the original data.
25
+
It is common practice to store vectorized data in a dedicated vector store as vector search indexing is not a common capability of most databases. However, this introduces additional complexity to the solution as the data must be stored in two different locations. vCore-based Azure Cosmos DB for MongoDB supports vector search indexing, which means that the vectorized data can be stored in the same document as the original data. This reduces the complexity of the solution and allows for a single database to be used for both the vector store and the original data.
26
26
27
-
## Lab 3 - Use vector search on embeddings in Azure Cosmos DB for MongoDB vCore
27
+
## Lab 3 - Use vector search on embeddings in vCore-based Azure Cosmos DB for MongoDBvCore
28
28
29
29
In this lab, a notebook demonstrates how to add an embedding field to a document, create a vector search index, and perform a vector search query. The notebook ends with a demonstration of utilizing vector search with an LLM in a RAG scenario.
30
30
@@ -36,6 +36,6 @@ On the **Settings** screen, select the **Resource** tab, then copy and record th
36
36
37
37

38
38
39
-
>**NOTE**: This lab can only be completed using a deployed Azure Cosmos DB API for MongoDB vCore account due to the use of vector search. The Azure Cosmos DB Emulator does not support vector search.
39
+
>**NOTE**: This lab can only be completed using a deployed vCore-based Azure Cosmos DB for MongoDB account due to the use of vector search. The Azure Cosmos DB Emulator does not support vector search.
40
40
41
41
Please visit the lab repository to complete this lab.
Copy file name to clipboardExpand all lines: 09_LangChain/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ LangChain agents can leverage tools and toolkits. A tool can be an integration i
10
10
11
11
## LangChain RAG pattern
12
12
13
-
Earlier in this guide, the RAG (Retrieval Augmented Generation) pattern was introduced. In LangChain, the RAG pattern is implemented as part of a chain that combines a retriever and a Large Language Model (generator). The retriever is responsible for finding the most relevant documents for a given query, in this case, doing a vector search on Azure Cosmos DB MongoDB vCore, and the LLM (generator) is responsible for reasoning over the incoming prompt and context.
13
+
Earlier in this guide, the RAG (Retrieval Augmented Generation) pattern was introduced. In LangChain, the RAG pattern is implemented as part of a chain that combines a retriever and a Large Language Model (generator). The retriever is responsible for finding the most relevant documents for a given query, in this case, doing a vector search on vCore-based Azure Cosmos DB for MongoDB, and the LLM (generator) is responsible for reasoning over the incoming prompt and context.
14
14
15
15

16
16
@@ -20,4 +20,4 @@ When an incoming message is received, the retriever will vectorize the message a
20
20
21
21
## Lab 4 - Vector search and RAG using LangChain
22
22
23
-
In this lab, you will learn to use LangChain to re-implement the RAG pattern introduced in Lab 3. Take note of the readability of the code and how easy it is to compose a reusable RAG chain using LangChain that queries the products vector index in Azure Cosmos DB MongoDB vCore. Lab 4 concludes with the creation of an agent with various tools for the LLM to leverage to fulfill the incoming request.
23
+
In this lab, you will learn to use LangChain to re-implement the RAG pattern introduced in Lab 3. Take note of the readability of the code and how easy it is to compose a reusable RAG chain using LangChain that queries the products vector index in vCore-based Azure Cosmos DB for MongoDB. Lab 4 concludes with the creation of an agent with various tools for the LLM to leverage to fulfill the incoming request.
Copy file name to clipboardExpand all lines: 11_User_Interface/README.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Connect the chat user interface with the chatbot API
2
2
3
-
In the previous lab, you configured and deployed the Backend API code that integrates Azure Cosmos DB for MongoDB vCore with Azure OpenAI. When the Azure resource template for this lab was run to deploy the necessary Azure resources, a front-end web application written as a SPA (single page application) in React was deployed.
3
+
In the previous lab, you configured and deployed the Backend API code that integrates vCore-based Azure Cosmos DB for MongoDB with Azure OpenAI. When the Azure resource template for this lab was run to deploy the necessary Azure resources, a front-end web application written as a SPA (single page application) in React was deployed.
4
4
5
5
You can find the URL to access this front-end application within the Azure Portal on the **Web App** resource with the name that ends with **-web**.
6
6
@@ -35,7 +35,7 @@ Go ahead, ask the service a few questions about CosmicWorks and observice the re
35
35
36
36
## What do I do if the responses are incorrect?
37
37
38
-
It's important to remember the model is pre-trained with data, given a system message to guide it, in addition to the company data it has access to via Azure Cosmos DB for MongoDB vCore. There are times when the Azure OpenAI model may generate an incorrect response to the prompt given that is either incomplete or even a hallucination (aka includes information that is not correct or accurate).
38
+
It's important to remember the model is pre-trained with data, given a system message to guide it, in addition to the company data it has access to via vCore-based Azure Cosmos DB for MongoDB. There are times when the Azure OpenAI model may generate an incorrect response to the prompt given that is either incomplete or even a hallucination (aka includes information that is not correct or accurate).
39
39
40
40
There are a few options of how this can be handled when the response is incorrect:
0 commit comments