Skip to content

Commit 1dee6d6

Browse files
committed
acrolinx updates
1 parent 2b5c4c4 commit 1dee6d6

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

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

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

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

17-
In this sample, we'll demonstrate how to build a RAG Pattern application using a subset of the Movie Lens dataset. This sample will leverage 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 to generate embeddings and LLM completions.
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.
1818

19-
At the end, we will create a simple UX using Gradio to allow users to type in questions and display responses generated by a GPT model or served from the cache. The responses will also display an elapsed time so you can see the impact caching has on performance versus generating a response.
19+
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]
2222
> For more samples, visit: [AzureDataRetrievalAugmentedGenerationSamples](https://github.com/microsoft/AzureDataRetrievalAugmentedGenerationSamples)
2323
24-
**Important Note**: This sample requires you to have Azure Cosmos DB for NoSQL and Azure OpenAI accounts set up. To get started, visit:
24+
**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)
2626
- [Azure Cosmos DB for NoSQL Vector Search](../nosql/vector-search.md)
2727
- [Azure OpenAI](../../ai-services/openai/toc.yml)
@@ -80,7 +80,7 @@ openai_client = AzureOpenAI(azure_endpoint=openai_endpoint, api_key=openai_key,
8080
```
8181

8282
### 3. Create a Database and Containers with Vector Policies
83-
This function takes a database object, a collection name, the name of the document property that will store vectors, and the number of vector dimensions used for the embeddings.
83+
This function takes a database object, a collection name, the name of the document property that stores vectors, and the number of vector dimensions used for the embeddings.
8484

8585
```python
8686
db = await cosmos_async_client.create_database_if_not_exists(cosmos_database)
@@ -170,7 +170,7 @@ len(data)
170170

171171
### 6. Store Data in Azure Cosmos DB
172172

173-
Upsert data into Azure Cosmos DB for NoSQL. Records will be written asynchronously.
173+
Upsert data into Azure Cosmos DB for NoSQL. Records are written asynchronously.
174174

175175
```python
176176
import asyncio

articles/cosmos-db/nosql/multi-tenancy-vector-search.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
title: Multi-Tenancy in Azure Cosmos DB
3-
description: Learn concepts for building multi-tenant gen-ai apps in Azure Cosmos DB
2+
title: Multi-tenancy in Azure Cosmos DB
3+
description: Learn concepts for building multitenant gen-ai apps in Azure Cosmos DB
44
author: TheovanKraay
55
ms.service: cosmos-db
66
ms.subservice: nosql
@@ -9,26 +9,26 @@ ms.date: 06/26/2024
99
ms.author: thvankra
1010
---
1111

12-
# Multi-Tenancy in Azure Cosmos DB
12+
# Multi-tenancy for vector search in Azure Cosmos DB
1313

1414
> "OpenAI relies on Cosmos DB to dynamically scale their ChatGPT service – one of the fastest-growing consumer apps ever – enabling high reliability and low maintenance."
15-
> - Satya Nadella
15+
> Satya Nadella
1616
17-
Azure Cosmos DB stands out as the world's first serverless vector search database, offering unparalleled scalability and performance. By leveraging Azure Cosmos DB, users can enhance their vector search capabilities, ensuring high reliability and low maintenance for multi-tenant applications.
17+
Azure Cosmos DB stands out as the world's first serverless vector search database, offering unparalleled scalability and performance. By using Azure Cosmos DB, users can enhance their vector search capabilities, ensuring high reliability and low maintenance for multitenant applications.
1818

1919
Multi-tenancy enables a single instance of a database to serve multiple customers, or tenants, simultaneously. This approach efficiently shares infrastructure and operational overhead, resulting in cost savings and simplified management. It's a crucial design consideration for SaaS applications and some internal enterprise solutions.
2020

21-
Multi-tenancy introduces complexity. Your system must scale efficiently to maintain high performance across all tenants, who may have unique workloads, requirements, and SLAs.
21+
Multi-tenancy introduces complexity. Your system must scale efficiently to maintain high performance across all tenants, who may have unique workloads, requirements, and service-level agreements (SLAs).
2222

2323
Imagine a fictional AI-assisted research platform called ResearchHub. Serving thousands of companies and individual researchers, ResearchHub manages varying user bases, data scales, and SLAs. Ensuring low query latency and high performance is vital for sustaining an excellent user experience.
2424

25-
Azure Cosmos DB, with its [DiskANN vector index](../index-policy.md#vector-indexes) capability, simplifies multi-tenant design, providing efficient data storage and access mechanisms for high-performance applications.
25+
Azure Cosmos DB, with its [DiskANN vector index](../index-policy.md#vector-indexes) capability, simplifies multitenant design, providing efficient data storage and access mechanisms for high-performance applications.
2626

27-
### Multi-Tenancy Models in Cosmos DB
27+
### Multi-tenancy models in Azure Cosmos DB
2828

2929
In Azure Cosmos DB, we recommend two primary approaches to managing multi-tenancy: partition key-per-tenant or account-per-tenant, each with its own set of benefits and trade-offs.
3030

31-
#### 1. Partition Key-Per-Tenant
31+
#### 1. Partition key-per-tenant
3232

3333
For a higher density of tenants and lower isolation, the partition key-per-tenant model is effective. Each tenant is assigned a unique partition key within a given container, allowing logical separation of data.
3434

@@ -41,19 +41,19 @@ For a higher density of tenants and lower isolation, the partition key-per-tenan
4141
- **Resource Contention:** Shared resources can lead to contention during peak usage.
4242
- **Limited Isolation:** Logical but not physical isolation, which may not meet stringent security needs.
4343

44-
#### Hierarchical Partitioning: Enhanced Data Organization
44+
#### Hierarchical partitioning: enhanced data organization
4545

4646
[Hierarchical partitioning](../hierarchical-partition-keys.md) builds on the partition key-per-tenant model, adding deeper levels of data organization. This method involves creating multiple levels of partition keys for more granular data management.
4747

4848
**Advantages:**
49-
- **Optimized Queries:** More precise targeting of sub-partitions at the parent partition level reduces query latency.
49+
- **Optimized Queries:** More precise targeting of subpartitions at the parent partition level reduces query latency.
5050
- **Improved Scalability:** Facilitates deeper data segmentation for easier scaling.
5151
- **Better Resource Allocation:** Evenly distributes workloads, minimizing bottlenecks.
5252

5353
**Example:**
5454
ResearchHub can stratify data within each tenant’s partition by organizing it at departmental levels, facilitating efficient management and queries.
5555

56-
#### 2. Account-Per-Tenant
56+
#### 2. Account-per-tenant
5757

5858
For maximum isolation, the account-per-tenant model is preferable. Each tenant gets a dedicated Cosmos DB account, ensuring complete separation of resources.
5959

@@ -66,9 +66,9 @@ For maximum isolation, the account-per-tenant model is preferable. Each tenant g
6666
- **Increased Management:** Higher complexity in managing multiple Cosmos DB accounts.
6767
- **Higher Costs:** More accounts mean higher infrastructure costs.
6868

69-
### Security Isolation with Customer Managed Keys
69+
### Security isolation with customer-managed keys
7070

71-
Azure Cosmos DB enables [customer-managed keys](../how-to-setup-customer-managed-keys.md) for data encryption, adding an extra layer of security for multi-tenant environments.
71+
Azure Cosmos DB enables [customer-managed keys](../how-to-setup-customer-managed-keys.md) for data encryption, adding an extra layer of security for multitenant environments.
7272

7373
**Steps to Implement:**
7474
1. **Set Up Azure Key Vault:** Securely store your encryption keys.
@@ -77,13 +77,13 @@ Azure Cosmos DB enables [customer-managed keys](../how-to-setup-customer-managed
7777

7878
Using customer-managed keys ensures each tenant's data is encrypted uniquely, providing robust security and compliance.
7979

80-
### Other Isolation Models
80+
### Other isolation models
8181

82-
#### Container and Database Isolation
82+
#### Container and database isolation
8383

8484
In addition to the partition key-per-tenant and account-per-tenant models, Azure Cosmos DB provides other isolation methods such as container isolation and database isolation. These approaches offer varying degrees of performance isolation, though they don't provide the same level of security isolation as the account-per-tenant model.
8585

86-
##### Container Isolation
86+
##### Container isolation
8787

8888
In the container isolation model, each tenant is assigned a separate container within a shared Cosmos DB account. This model allows for some level of isolation in terms of performance and resource allocation.
8989

@@ -93,10 +93,10 @@ In the container isolation model, each tenant is assigned a separate container w
9393
- **Cost Efficiency:** Similar to the partition key-per-tenant model, this method reduces the overhead of multiple accounts.
9494

9595
**Drawbacks:**
96-
- **Limited Security Isolation:** Unlike separate accounts, containers within the same account do not provide physical data isolation. Consequently, this model may not meet stringent security requirements.
96+
- **Limited Security Isolation:** Unlike separate accounts, containers within the same account don't provide physical data isolation. So, this model may not meet stringent security requirements.
9797
- **Resource Contention:** Heavy workloads in one container can still affect others if resource limits are breached.
9898

99-
##### Database Isolation
99+
##### Database isolation
100100

101101
The database isolation model assigns each tenant a separate database within a shared Cosmos DB account. This provides enhanced isolation in terms of resource allocation and management.
102102

@@ -109,20 +109,20 @@ The database isolation model assigns each tenant a separate database within a sh
109109
- **Limited Security Isolation:** Similar to container isolation, having separate databases within a single account does not provide physical data isolation.
110110
- **Complexity:** Managing multiple databases can be more complex than managing containers, especially as the number of tenants grows.
111111

112-
While container and database isolation models do not offer the same level of security isolation as the account-per-tenant model, they can still be useful for achieving performance isolation and flexible resource management. These methods are particularly beneficial for scenarios where cost efficiency and simplified management are priorities, and stringent security isolation is not a critical requirement.
112+
While container and database isolation models don't offer the same level of security isolation as the account-per-tenant model, they can still be useful for achieving performance isolation and flexible resource management. These methods are beneficial for scenarios where cost efficiency and simplified management are priorities, and stringent security isolation is not a critical requirement.
113113

114-
By carefully evaluating the specific needs and constraints of your multi-tenant application, you can choose the most suitable isolation model in Azure Cosmos DB, balancing performance, security, and cost considerations to achieve the best results for your tenants.
114+
By carefully evaluating the specific needs and constraints of your multitenant application, you can choose the most suitable isolation model in Azure Cosmos DB, balancing performance, security, and cost considerations to achieve the best results for your tenants.
115115

116-
### Real-World Implementation Considerations
116+
### Real-world implementation considerations
117117

118-
When designing a multi-tenant system with Cosmos DB, consider these factors:
118+
When designing a multitenant system with Cosmos DB, consider these factors:
119119

120120
- **Tenant Workload:** Evaluate data size and activity to select the appropriate isolation model.
121121
- **Performance Requirements:** Align your architecture with defined SLAs and performance metrics.
122122
- **Cost Management:** Balance infrastructure costs against the need for isolation and performance.
123123
- **Scalability:** Plan for growth by choosing scalable models.
124124

125-
### Practical Implementation in Cosmos DB
125+
### Practical implementation in Azure Cosmos DB
126126

127127
**Partition Key-Per-Tenant:**
128128
1. **Assign Partition Keys:** Unique keys for each tenant ensure logical separation.
@@ -139,12 +139,12 @@ When designing a multi-tenant system with Cosmos DB, consider these factors:
139139
2. **Customize Resources:** Tailor performance and SLAs to tenant requirements.
140140
3. **Ensure Security:** Physical data isolation offers robust security and compliance.
141141

142-
### Best Practices for Using Azure Cosmos DB with Vector Search Capabilities
142+
### Best practices for using Azure Cosmos DB with vector search
143143

144144
Azure Cosmos DB's support for DiskANN vector index capability makes it an excellent choice for applications that require fast, high-dimensional searches, such as AI-assisted research platforms like ResearchHub. Here’s how you can leverage these capabilities:
145145

146146
**1. Efficient Storage and Retrieval:**
147-
- **Vector Indexing:** Use the DiskANN vector index to efficiently store and retrieve high-dimensional vectors. This is particularly useful for applications that involve similarity searches in large datasets, such as image recognition or document similarity.
147+
- **Vector Indexing:** Use the DiskANN vector index to efficiently store and retrieve high-dimensional vectors. This is useful for applications that involve similarity searches in large datasets, such as image recognition or document similarity.
148148
- **Performance Optimization:** DiskANN’s vector search capabilities enable quick, accurate searches, ensuring low latency and high performance, which is critical for maintaining a good user experience.
149149

150150
**2. Scaling Across Tenants:**
@@ -155,7 +155,7 @@ Azure Cosmos DB's support for DiskANN vector index capability makes it an excell
155155
- **Customer Managed Keys:** Implement customer-managed keys for data encryption at rest, ensuring each tenant’s data is securely isolated.
156156
- **Regular Key Rotation:** Enhance security by regularly rotating encryption keys stored in Azure Key Vault.
157157

158-
### Real-World Example: Implementing ResearchHub
158+
### Real-world example: implementing ResearchHub
159159

160160
**Partition Key-Per-Tenant:**
161161
1. **Assign Partition Keys:** Each organization (tenant) is assigned a unique partition key.
@@ -164,7 +164,7 @@ Azure Cosmos DB's support for DiskANN vector index capability makes it an excell
164164

165165
**Hierarchical Partitioning:**
166166
1. **Multi-Level Partition Keys:** Data within a tenant’s partition is further segmented by department, project, or other relevant attributes.
167-
2. **Granular Data Management:** This hierarchical approach allows ResearchHub to manage and query data more efficiently, reducing latency and improving response times.
167+
2. **Granular Data Management:** This hierarchical approach allows ResearchHub to manage and query data more efficiently, reducing latency, and improving response times.
168168

169169
**Account-Per-Tenant:**
170170
1. **Separate Cosmos DB Accounts:** High-profile clients or those with sensitive data are provided individual Cosmos DB accounts.
@@ -173,9 +173,9 @@ Azure Cosmos DB's support for DiskANN vector index capability makes it an excell
173173

174174
### Conclusion
175175

176-
Multi-tenancy in Azure Cosmos DB, especially with its DiskANN vector index capability, offers a powerful solution for building scalable, high-performance AI applications. Whether you choose partition key-per-tenant, hierarchical partitioning, or account-per-tenant models, you can effectively balance cost, security, and performance. By leveraging these models and best practices, you can ensure that your multi-tenant application meets the diverse needs of your customers, delivering an exceptional user experience.
176+
Multi-tenancy in Azure Cosmos DB, especially with its DiskANN vector index capability, offers a powerful solution for building scalable, high-performance AI applications. Whether you choose partition key-per-tenant, hierarchical partitioning, or account-per-tenant models, you can effectively balance cost, security, and performance. By using these models and best practices, you can ensure that your multitenant application meets the diverse needs of your customers, delivering an exceptional user experience.
177177

178-
Azure Cosmos DB provides the tools necessary to build a robust, secure, and scalable multi-tenant environment. With the power of DiskANN vector indexing, you can deliver fast, high-dimensional searches that drive your AI applications.
178+
Azure Cosmos DB provides the tools necessary to build a robust, secure, and scalable multitenant environment. With the power of DiskANN vector indexing, you can deliver fast, high-dimensional searches that drive your AI applications.
179179

180180
### Next steps
181181

0 commit comments

Comments
 (0)