Skip to content

Commit acd16c0

Browse files
committed
updates
1 parent 63e459e commit acd16c0

File tree

8 files changed

+74
-2
lines changed

8 files changed

+74
-2
lines changed

articles/cosmos-db/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@
2828
items:
2929
- name: Vector search overview
3030
href: gen-ai/vector-search-overview.md
31+
- name: Retrieval Augmented Generation (RAG)
32+
href: gen-ai/rag.md
3133
- name: Tokens
3234
href: gen-ai/tokens.md
3335
- name: Vector embeddings

articles/cosmos-db/gen-ai/distance-functions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Two vectors are multiplied to return a single number. It combines the two vector
3131
## Related content
3232
- [VectorDistance system function](../nosql/query/vectordistance.md) in Azure Cosmos DB NoSQL
3333
- [What is a vector database?](../vector-database.md)
34+
- [Retrieval Augmented Generation (RAG)](rag.md)
3435
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
3536
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
3637
- [What is vector search?](vector-search-overview.md)

articles/cosmos-db/gen-ai/knn-vs-ann.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ Two major categories of vector search algorithms are k-Nearest Neighbors (kNN) a
3333

3434
## Related content
3535
- [What is a vector database?](../vector-database.md)
36+
- [Retrieval Augmented Generation (RAG)](rag.md)
3637
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
3738
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
3839
- [What is vector search?](vector-search-overview.md)

articles/cosmos-db/gen-ai/quickstart-rag-chatbot.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ ms.author: thvankra
1414

1515
[!INCLUDE[NoSQL](../includes/appliesto-nosql.md)]
1616

17-
In this quickstart, we demonstrate how to build a RAG Pattern application using a subset of the Movie Lens dataset. This sample uses the Python SDK for Azure Cosmos DB for NoSQL to perform vector search for RAG, store and retrieve chat history, and store the vectors of the chat history to use as a semantic cache. Azure OpenAI is used to generate embeddings and Large Language Model (LLM) completions.
17+
In this quickstart, we demonstrate how to build a [RAG Pattern](../gen-ai/rag.md) application using a subset of the Movie Lens dataset. This sample uses the Python SDK for Azure Cosmos DB for NoSQL to perform vector search for RAG, store and retrieve chat history, and store the vectors of the chat history to use as a semantic cache. Azure OpenAI is used to generate embeddings and Large Language Model (LLM) completions.
1818

1919
At the end, we create a simple UX using Gradio to allow users to type in questions and display responses generated by Azure OpenAI or served from the cache. The responses also display an elapsed time so you can see the impact caching has on performance versus generating a response.
2020

2121
> [!TIP]
22-
> For more samples, visit: [AzureDataRetrievalAugmentedGenerationSamples](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples)
22+
> For more RAG samples, visit: [AzureDataRetrievalAugmentedGenerationSamples](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples)
2323
2424
**Important Note**: This sample requires you to setup accounts for Azure Cosmos DB for NoSQL, and Azure OpenAI. To get started, visit:
2525
- [Azure Cosmos DB for NoSQL Python Quickstart](../nosql/quickstart-python.md)

articles/cosmos-db/gen-ai/rag.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
3+
title: Retrieval Augmented Generation (RAG) in Azure Cosmos DB
4+
description: Learn about Retrieval Augmented Generation (RAG) in Azure Cosmos DB
5+
author: TheovanKraay
6+
ms.service: cosmos-db
7+
ms.subservice: nosql
8+
ms.topic: conceptual
9+
ms.date: 07/09/2024
10+
ms.author: thvankra
11+
---
12+
13+
# Retrieval Augmented Generation (RAG) in Azure Cosmos DB
14+
15+
Retrieval Augmented Generation (RAG) combines the power of large language models (LLMs) with robust information retrieval systems to create more accurate and contextually relevant responses. Unlike traditional generative models that rely solely on pre-trained data, RAG architectures enhance an LLM's capabilities by integrating real-time information retrieval. This augmentation ensures responses are not only generative but also grounded in the most relevant, up-to-date data available.
16+
17+
Azure Cosmos DB, an operational database that supports vector search, stands out as an excellent platform for implementing RAG. Its ability to handle both operational and analytical workloads in a single database, along with advanced features such as multi-tenancy and hierarchical partition keys, provides a solid foundation for building sophisticated generative AI applications.
18+
19+
## Key Advantages of Using Azure Cosmos DB
20+
21+
### 1. Unified Data Storage and Retrieval
22+
Azure Cosmos DB enables seamless integration of [vector search](../nosql/vector-search.md) capabilities within a unified database system. This means that your operational data and vectorized data coexist, eliminating the need for separate indexing systems.
23+
24+
### 2. Real-Time Data Ingestion and Querying
25+
Azure Cosmos DB supports real-time ingestion and querying, making it ideal for applications that require up-to-the-minute information. This is crucial for RAG architectures, where the freshness of data can significantly impact the relevance of generated responses.
26+
27+
### 3. Scalability and Global Distribution
28+
Designed for large-scale applications, Azure Cosmos DB offers global distribution and automatic scaling. This ensures that your RAG-enabled application can handle high query volumes and deliver consistent performance irrespective of user location.
29+
30+
### 4. High Availability and Reliability
31+
Azure Cosmos DB offers comprehensive SLAs for throughput, latency, and [availability](/articles/reliability/reliability-cosmos-db-nosql.md). This reliability ensures that your RAG system is always available to generate responses with minimal downtime.
32+
33+
### 5. Multi-Tenancy with Hierarchical Partition Keys
34+
Azure Cosmos DB supports [multi-tenancy](../nosql/multi-tenancy-vector-search.md) through various performance and security isolation models, making it easier to manage data for different clients or user groups within the same database. This feature is particularly useful for SaaS applications where separation of tenant data is crucial for security and compliance.
35+
36+
### 6. Comprehensive Security Features
37+
With built-in features such as end-to-end encryption, role-based access control (RBAC), and virtual network (VNet) integration, Azure Cosmos DB ensures that your data remains secure. These security measures are essential for enterprise-grade RAG applications that handle sensitive information.
38+
39+
40+
41+
## Implementing RAG with Azure Cosmos DB
42+
43+
> [!TIP]
44+
> For RAG samples, visit: [AzureDataRetrievalAugmentedGenerationSamples](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples)
45+
46+
Here's a streamlined process for building a RAG application with Azure Cosmos DB:
47+
48+
1. **Data Ingestion**: Store your documents, images, and other content types in Azure Cosmos DB. Utilize the database's support for vector search to index and retrieve vectorized content.
49+
50+
2. **Query Execution**: When a user submits a query, Azure Cosmos DB can quickly retrieve the most relevant data using its vector search capabilities.
51+
52+
3. **LLM Integration**: Pass the retrieved data to an LLM (e.g., Azure OpenAI) to generate a response. The well-structured data provided by Cosmos DB enhances the quality of the model's output.
53+
54+
4. **Response Generation**: The LLM processes the data and generates a comprehensive response, which is then delivered to the user.
55+
56+
57+
## Related content
58+
- [What is a vector database?](../vector-database.md)
59+
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
60+
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
61+
- LLM [tokens](tokens.md)
62+
- Vector [embeddings](vector-embeddings.md)
63+
- [Distance functions](distance-functions.md)
64+
- [kNN vs ANN vector search algorithms](knn-vs-ann.md)
65+
- [Multi-tenancy for Vector Search](../nosql/multi-tenancy-vector-search.md)

articles/cosmos-db/gen-ai/tokens.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Tokens are small chunks of text generated by splitting the input text into small
1414

1515
## Related content
1616
- [What is a vector database?](../vector-database.md)
17+
- [Retrieval Augmented Generation (RAG)](rag.md)
1718
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
1819
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
1920
- [What is vector search?](vector-search-overview.md)

articles/cosmos-db/gen-ai/vector-embeddings.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ You can see more examples in this [interactive visualization](https://openai.com
3232

3333
## Related content
3434
- [What is a vector database?](../vector-database.md)
35+
- [Retrieval Augmented Generation (RAG)](rag.md)
3536
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
3637
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
3738
- [What is vector search?](vector-search-overview.md)

articles/cosmos-db/gen-ai/vector-search-overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Using an integrated vector search feature in a fully featured database ([as oppo
2020

2121
## Related content
2222
- [What is a vector database?](../vector-database.md)
23+
- [Retrieval Augmented Generation (RAG)](rag.md)
2324
- [Vector database in Azure Cosmos DB NoSQL](../nosql/vector-search.md)
2425
- [Vector database in Azure Cosmos DB for MongoDB](../mongodb/vcore/vector-search.md)
2526
- LLM [tokens](tokens.md)

0 commit comments

Comments
 (0)