Skip to content

Commit a136b31

Browse files
committed
2 parents b80d4fa + 3c5c7bf commit a136b31

File tree

4 files changed

+87
-13
lines changed

4 files changed

+87
-13
lines changed
Lines changed: 56 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,61 @@
1-
# Create your first Cosmos DB project (console app (Jupyter notebook?))
1+
# Create your first Cosmos DB project
22

3-
- How to use the Cosmos DB SDK
4-
- How to develop locally
3+
In this section, we'll cover how to create your first Cosmos DB project. We'll use a notebook to demonstrate the basic CRUD operations. We'll also cover how to use the Azure Cosmos DB Emulator to test your code locally.
54

6-
## Emulator support (does it support vector search?)
7-
## Authentication options
8-
## Create a database
9-
## Create a collection
10-
## Create a document
5+
## Emulator support
116

12-
## INCLUDE 08_Load_Data here
7+
Azure Cosmos DB has an emulator that you can use to develop your code locally. The emulator supports the API for NoSQL and API for MongoDB. Usage of the emulator does not require an Azure Subscription nor does it incur any costs so is ideal for local development and testing. The Azure Cosmos DB emulator can also be utilized with unit tests in a [GitHub Actions CI workflow](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=windows%2Cpython&pivots=api-mongodb#use-the-emulator-in-a-github-actions-ci-workflow).
138

14-
## Read a document
15-
## Update a document
16-
## Delete a document
17-
## Query documents
9+
There is not 100% feature parity between the emulator and the cloud service. Visit the [Azure Cosmos DB emulator](https://learn.microsoft.com/en-us/azure/cosmos-db/emulator) documentation for more details.
1810

11+
For Windows machines, the emulator can be installed via an installer. There is a Windows container using Docker available, however it does not currently support the API for Mongo DB. A Docker image is also available for Linux that does support the API for Mongo DB.
12+
13+
Learn more about the pre-requisites and installation of the emulator [here](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=windows%2Cpython&pivots=api-mongodb).
14+
15+
## Authentication
16+
17+
Authentication to Azure Cosmos DB API for Mongo DB is done using a connection string. The connection string is a URL that contains the authentication information for your Azure Cosmos DB account or local emulator. The username and password used when provisioning the Azure Cosmos DB API for MongoDB service are used in the connection string when authenticating to Azure.
18+
19+
### Retrieving the connection string from the Cosmos DB Emulator
20+
21+
The splash screen or **Quickstart** section of the Cosmos DB Emulator will display the connection string. Access this screen through the following URL: `https://localhost:8081/_explorer/index.html`.
22+
23+
![The Azure Cosmos DB emulator screen displays with the local host url, the Quickstart tab, and the Mongo connection string highlighted.](media/emulator_connection_string.png)
24+
25+
### Retrieving the connection string from the Azure portal
26+
27+
Retrieve the connection string from the Azure portal by navigating to your Azure Cosmos DB account and selecting the **Connection String** menu item on the left-hand side of the screen. The connection string contains tokens for the username an password that must be replaced with the username and password used when provisioning the Azure Cosmos DB API for MongoDB service. Additional users can be added at any time using the [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/cosmosdb/mongodb/user?view=azure-cli-latest).
28+
29+
![The Azure CosmosDb API for MongoDB Connection strings screen displays with the copy button next to the connection string highlighted.](media/azure_connection_string.png)
30+
31+
## Authorization
32+
33+
Azure Cosmos DB API for MongoDB supports fine-grained role-based access control (RBAC) for authorization. There are a number of built-in roles available. The built-in roles are:
34+
1. read
35+
2. readWrite
36+
3. dbAdmin
37+
4. dbOwner
38+
39+
The ability to create custom roles is also available. Custom roles can be created using the [Azure CLI](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/how-to-setup-rbac). Custom roles can include granular permissions for specific databases, collections, and operational actions. Learn more about the [Azure CLI RBAC commands to define custom roles](https://learn.microsoft.com/en-us/azure/cosmos-db/mongodb/how-to-setup-rbac#azure-cli-rbac-commands).
40+
41+
## Helpful tools
42+
43+
Visualization and querying tools:
44+
1. Studio 3T
45+
2. MongoDB Compass
46+
3. Azure Data Studio
47+
4. MongoDB Shell
48+
5. Azure Portal Data Explorer
49+
50+
## Lab 1 - Create your first Cosmos DB for MongoDB application
51+
52+
In this lab, we'll create a Cosmos DB for MongoDB application using a notebook. You have the choice to either use the Azure Cosmos DB Emulator or an Azure Cosmos DB account in Azure. The following concepts will be covered in this lab:
53+
1. Create a database
54+
2. Create a collection
55+
3. Create a document
56+
4. Read a document
57+
5. Update a document
58+
6. Delete a document
59+
7. Query documents
60+
61+
Please visit the lab repository to complete this lab.
37 KB
Loading
44.6 KB
Loading

11_Prompt_Engineering/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,37 @@
66
- Create a flow that communicates with the deployed Azure OpenAI and Azure Cosmos DB services
77
- Implement a web search plugin
88

9+
## What is a prompt
10+
11+
A prompt is an input or instruction provided to an Artificial Intelligence (AI) model to direct its behavior and produce the desired results. The quality and specificity of the prompt are crucial in obtaining precise and relevant outputs. A well-designed prompt can ensure that the AI model generates the desired information or completes the intended task effectively. Some typical prompts include summarization, question answering, text classification, and code generation.
12+
13+
## What is prompt engineering
14+
15+
Prompt engineering is the iterative process of designing, evaluating, and optimizing prompts to produce consistently accurate responses from language models for a particular problem domain. It involves designing and refining the prompts given to an AI model to achieve the desired outputs. Prompt engineers experiment with various prompts, test their effectiveness, and refine them to improve performance. Performance is measured using predefined metrics such as accuracy, relevance, and user satisfaction to assess the impact of prompt engineering.
16+
17+
## General anatomy of a prompt
18+
19+
Instruction, context, input, output indicator
20+
21+
## Zero-shot prompting
22+
23+
Zero-shot prompting is what we would consider the “default”. This is when we provide no examples of inputs/expected outputs to the model to work with. We’re leaving it up to the model to decipher what is needed and how to output it from the instructions.
24+
25+
## Few-shot prompting
26+
27+
Few-shot prompting provides examples to guide the model to the desired output.
28+
29+
## RAG
30+
31+
GPT language models can be fine-tuned to achieve several common tasks such as sentiment analysis and named entity recognition. These tasks generally don't require additional background knowledge.
32+
33+
The RAG pattern facilitates bringing private proprietary knowledge to the model so that it can perform Question Answering over this content. Remember that Large Language Models are indexed only on public information.
34+
Because the RAG technique accesses external knowledge sources to complete tasks, it enables more factual consistency, improves the reliability of the generated responses, and helps to mitigate the problem of "hallucination".
35+
36+
In some cases, the RAG process involves a technique called vectorization on the proprietary data. The user prompt is compared to the vector store and only the most relevant/matching pieces of information are returned and stuffed into prompt for the LLM to reason over and provide an answer.
37+
38+
## Chain of thought
39+
## ReAct
940

1041
## Lab
1142
### Diagram RAG using Azure Cosmos DB for MongoDB vCore as a retriever

0 commit comments

Comments
 (0)