Skip to content

Commit cfe914a

Browse files
committed
more collection to container wording updates
1 parent b3024fc commit cfe914a

File tree

9 files changed

+22
-22
lines changed

9 files changed

+22
-22
lines changed

07_Create_First_Cosmos_DB_Project/README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,23 +54,23 @@ client = pymongo.MongoClient(CONNECTION_STRING)
5454

5555
When using the `pymongo` client, the creation of a database is automatic when referenced. No specific api calls to create a database are required, if a database already exists, a reference to the database is returned.
5656

57-
>**Note:**: That the creation of databases and containers are lazy, meaning they will not be created until a document is inserted into a collection.
57+
>**Note:**: That the creation of databases and containers are lazy, meaning they will not be created until a document is inserted into a container.
5858
5959
```python
6060
db = client.cosmic_works
6161
```
6262

63-
### Creating a collection
63+
### Creating a container
6464

65-
Similar behavior to the creation of a database is experienced when creating a collection. If the collection does not exist, it will be created once a document is inserted into the collection.
65+
Similar behavior to the creation of a database is experienced when creating a container. If the container does not exist, it will be created once a document is inserted into the container.
6666

6767
```python
6868
collection = db.products
6969
```
7070

7171
### Creating a document
7272

73-
The `insert_one` method is used to insert a document into a collection. The document is a dictionary object.
73+
The `insert_one` method is used to insert a document into a container. The document is a dictionary object.
7474

7575
```python
7676
# Insert the JSON into the database, and retrieve the inserted/generated ID
@@ -79,15 +79,15 @@ product_id = collection.insert_one(product_json).inserted_id
7979

8080
### Reading a document
8181

82-
The `find_one` method is used to retrieve a single document from a collection. The method returns a dictionary object.
82+
The `find_one` method is used to retrieve a single document from a container. The method returns a dictionary object.
8383

8484
```python
8585
retrieved_document = collection.find_one({"_id": product_id})
8686
```
8787

8888
### Updating a document
8989

90-
The `find_one_and_update` method is used to update a single document in a collection. The method returns a dictionary object.
90+
The `find_one_and_update` method is used to update a single document in a container. The method returns a dictionary object.
9191

9292
```python
9393
update_result = collection.find_one_and_update(
@@ -99,15 +99,15 @@ update_result = collection.find_one_and_update(
9999

100100
### Deleting a document
101101

102-
The `delete_one` method is used to delete a single document from a collection.
102+
The `delete_one` method is used to delete a single document from a container.
103103

104104
```python
105105
delete_result = collection.delete_one({"_id": product_id})
106106
```
107107

108108
### Querying documents
109109

110-
The `find` method is used to query documents from a collection. The method returns a cursor object.
110+
The `find` method is used to query documents from a container. The method returns a cursor object.
111111

112112
```python
113113
# Print all documents that have a category name of "Components, Saddles"

08_Load_Data/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Load data into Azure Cosmos DB API for NoSQL
22

3-
The previous lab demonstrated how to add data to a collection individually. This lab will demonstrate how to load data using bulk operations into multiple collections. This data will be used in subsequent labs to explain further the capabilities of Azure Cosmos DB API about AI.
3+
The previous lab demonstrated how to add data to a container individually. This lab will demonstrate how to load data using bulk operations into multiple containers. This data will be used in subsequent labs to explain further the capabilities of Azure Cosmos DB API about AI.
44

55
When loading data, bulk operations are preferred over adding each document individually. Bulk operations involve performing multiple database operations as a batch rather than executing them simultaneously. This approach is more efficient and provides several benefits:
66

09_Vector_Search_Cosmos_DB/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
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.
88

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 NoSQL. Azure Cosmos DB for NoSQL 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 Azure Cosmos DB for NoSQL. Azure Cosmos DB for NoSQL supports the creation of vector search indexes on top of these vector fields. A vector search index is a container 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.
1010

1111
![A typical embedding pipeline that demonstrates how source data is transformed into vectors using an embedding model then stored in a document in an Azure Cosmos DB container and exposed via a vector search index.](media/embedding_pipeline.png)
1212

@@ -74,12 +74,12 @@ def generate_embeddings(text: str):
7474

7575
### Adding an embedding field to a document
7676

77-
The lab creates an embedding field named `contentVector` in each collection and populates the value with the vectorized text of the JSON representation of the document.
77+
The lab creates an embedding field named `contentVector` in each container and populates the value with the vectorized text of the JSON representation of the document.
7878

7979
```python
8080
def add_collection_content_vector_field(collection_name: str):
8181
'''
82-
Add a new field to the collection to hold the vectorized content of each document.
82+
Add a new field to the container to hold the vectorized content of each document.
8383
'''
8484
collection = db[collection_name]
8585
bulk_operations = []
@@ -131,7 +131,7 @@ db.command({
131131
```python
132132
def vector_search(collection_name, query, num_results=3):
133133
"""
134-
Perform a vector search on the specified collection by vectorizing
134+
Perform a vector search on the specified container by vectorizing
135135
the query and searching the vector index for the most similar documents.
136136
137137
returns a list of the top num_results most similar documents

10_LangChain/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ rag_chain = (
6767

6868
### Creating tools for LangChain agents to use
6969

70-
Tools are selected by the Large Language model at runtime. In this case, depending on the incoming user request the LLM will decide which collection in the database to query. The following code shows how to create a tool for the LLM to use to query the products collection in the database.
70+
Tools are selected by the Large Language model at runtime. In this case, depending on the incoming user request the LLM will decide which container in the database to query. The following code shows how to create a tool for the LLM to use to query the products collection in the database.
7171

7272
```python
7373
# create a chain on the retriever to format the documents as JSON

Labs/lab_1_first_application.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"source": [
5454
"## Create a container\n",
5555
"\n",
56-
"Creating containers behaves similarly to the database creation. If the collection does not exist, it will be created. It's important to note that databases and containers are lazily created. This means that the database and collection will not be created until the first document is inserted."
56+
"Creating containers behaves similarly to the database creation. If the container does not exist, it will be created. It's important to note that databases and containers are lazily created. This means that the database and container will not be created until the first document is inserted."
5757
]
5858
},
5959
{
@@ -107,7 +107,7 @@
107107
"source": [
108108
"## Read a document\n",
109109
"\n",
110-
"The insertion of the Product in the previous cell automatically created the database and collection. The `find_one` method is used to retrieve a single document from the database. The `find_one` method takes a filter as an argument. This filter is used to find the document in the database. In this case, the filter is the unique identifier or `_id` of the document that was just inserted."
110+
"The insertion of the Product in the previous cell automatically created the database and container. The `find_one` method is used to retrieve a single document from the database. The `find_one` method takes a filter as an argument. This filter is used to find the document in the database. In this case, the filter is the unique identifier or `_id` of the document that was just inserted."
111111
]
112112
},
113113
{
@@ -185,7 +185,7 @@
185185
"source": [
186186
"## Query for multiple documents\n",
187187
"\n",
188-
"The `find` method is used to query for multiple documents in the database. This method takes a filter as an argument. This filter is used to find the documents to return. In this case, the filter is an empty dictionary. This will return all documents in the collection."
188+
"The `find` method is used to query for multiple documents in the database. This method takes a filter as an argument. This filter is used to find the documents to return. In this case, the filter is an empty dictionary. This will return all documents in the container."
189189
]
190190
},
191191
{
@@ -277,7 +277,7 @@
277277
"source": [
278278
"## Clean up resources\n",
279279
"\n",
280-
"The following cell will delete the database and collection created in this lab. This is done by using the `drop_database` method on the database object. This method takes the name of the database to delete as an argument. If it is desired to simply delete the collection, the `drop_collection` method can be used on the database object. This method takes the name of the collection to delete as an argument."
280+
"The following cell will delete the database and container created in this lab. This is done by using the `drop_database` method on the database object. This method takes the name of the database to delete as an argument. If it is desired to simply delete the container, the `drop_collection` method can be used on the database object. This method takes the name of the container to delete as an argument."
281281
]
282282
},
283283
{

Labs/lab_3_mongodb_vector_search.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@
272272
"source": [
273273
"## Use vector search in Azure Cosmos DB for NoSQL\n",
274274
"\n",
275-
"Now that each document has its associated vector embedding and the vector indexes have been created on each collection, we can now use the vector search capabilities of Azure Cosmos DB for NoSQL."
275+
"Now that each document has its associated vector embedding and the vector indexes have been created on each container, we can now use the vector search capabilities of Azure Cosmos DB for NoSQL."
276276
]
277277
},
278278
{

Labs/lab_4_langchain.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"\n",
7979
"In the previous lab, the `pymongo` library was used to perform a vector search through a db command to find product documents that were most similar to the user's input. In this lab, you will use the `langchain` library to perform the same search. LangChain has a vector store class named **AzureCosmosDBVectorSearch**, a community contribution, that supports vector search in Azure Cosmos DB for NoSQL.\n",
8080
"\n",
81-
"When establishing the connection to the vector store (Azure Cosmos DB for NoSQL), recall that in previous labs the products collection was populated and a contentVector field added that contains the vectorized embeddings of the document itself. Finally, a vector index was also created on the contentVector field to enable vector search. The vector index in each collection is named `VectorSearchIndex`.\n",
81+
"When establishing the connection to the vector store (Azure Cosmos DB for NoSQL), recall that in previous labs the products container was populated and a contentVector field added that contains the vectorized embeddings of the document itself. Finally, a vector index was also created on the contentVector field to enable vector search. The vector index in each container is named `VectorSearchIndex`.\n",
8282
"\n",
8383
"The return value of a vector search in LangChain is a list of `Document` objects. The LangChain `Document` class contains two properties: `page_content`, that represents the textual content that is typically used to augment the prompt, and `metadata` that contains all other attributes of the document. In the cell below, we'll use the `_id` field as the page_content, and the rest of the fields are returned as metadata.\n",
8484
"\n",

Labs/models/customer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Config:
3939
class CustomerList(BaseModel):
4040
"""
4141
The CustomerList class represents a list of customers.
42-
This class is used when deserializing a collection/array
42+
This class is used when deserializing a container/array
4343
of customers.
4444
"""
4545
items: List[Customer]

Labs/models/sales_order.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SalesOrderList(BaseModel):
3030
"""
3131
The SalesOrderList class represents a list of sales orders.
3232
33-
This class is used when deserializing a collection/array
33+
This class is used when deserializing a container/array
3434
of sales orders.
3535
"""
3636
items: List[SalesOrder]

0 commit comments

Comments
 (0)