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
Update nuget pkgs, update deploy to use gpt-4o-mini and target region (#358)
## Purpose
- update nuget packages to latest versions
- change default model from `gpt-35-turbo` to `gpt-4o-mini`
- change default azure deployment region to `East US`
- remove the paragraph about requesting access to `AOAI`
## Does this introduce a breaking change?
<!-- Mark one with an "x". -->
```
[ ] Yes
[X] No
```
## Pull Request Type
What kind of change does this Pull Request introduce?
<!-- Please check the one that applies to this PR using "x". -->
```
[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[X] Refactoring (no functional changes, no api changes)
[X] Documentation content changes
[X] Other: Update deploy to use the latest AOAI GPT model
```
## How to Test
* Get the code
```
git clone [repo-address]
cd [repo-name]
```
* Test the code / deploy
```
azd up
```
Copy file name to clipboardExpand all lines: README.md
+32-21Lines changed: 32 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ description: A csharp sample app that chats with your data using OpenAI and AI S
56
56
[](https://github.com/codespaces/new?hide_repo_select=true&ref=main&repo=624102171&machine=standardLinux32gb&devcontainer_path=.devcontainer%2Fdevcontainer.json&location=WestUs2)
57
57
[](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/azure-samples/azure-search-openai-demo-csharp)
58
58
59
-
This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data using the Retrieval Augmented Generation pattern. It uses Azure OpenAI Service to access the ChatGPT model (`gpt-35-turbo`), and Azure AI Search for data indexing and retrieval.
59
+
This sample demonstrates a few approaches for creating ChatGPT-like experiences over your own data using the Retrieval Augmented Generation pattern. It uses Azure OpenAI Service to access the ChatGPT model (`gpt-4o-mini`), and Azure AI Search for data indexing and retrieval.
60
60
61
61
The repo includes sample data so it's ready to try end-to-end. In this sample application, we use a fictitious company called Contoso Electronics, and the experience allows its employees to ask questions about the benefits, internal policies, as well as job descriptions and roles.
62
62
@@ -94,10 +94,8 @@ We want to hear from you! Are you interested in building or currently building i
94
94
In order to deploy and run this example, you'll need
95
95
96
96
-**Azure Account** - If you're new to Azure, get an [Azure account for free](https://aka.ms/free) and you'll get some free Azure credits to get started.
97
-
-**Azure subscription with access enabled for the Azure OpenAI service** - [You can request access](https://aka.ms/oaiapply). You can also visit [the Azure AI Search docs](https://azure.microsoft.com/free/cognitive-search/) to get some free Azure credits to get you started.
98
97
-**Azure account permissions** - Your Azure Account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [User Access Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#user-access-administrator) or [Owner](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#owner).
99
98
100
-
101
99
> [!WARNING]<br>
102
100
> By default this sample will create an Azure Container App, and Azure AI Search resource that have a monthly cost, as well as Form Recognizer resource that has cost per document page. You can switch them to free versions of each of them if you want to avoid this cost by changing the parameters file under the infra folder (though there are some limits to consider; for example, you can have up to 1 free Azure AI Search resource per subscription, and the free Form Recognizer resource only analyzes the first 2 pages of each document.)
103
101
@@ -126,12 +124,12 @@ Install the following prerequisites:
126
124
-[Git](https://git-scm.com/downloads)
127
125
-[Powershell 7+ (pwsh)](https://github.com/powershell/powershell) - For Windows users only.
128
126
129
-
> **Important**<br>
127
+
> **Important**:
130
128
> Ensure you can run `pwsh.exe` from a PowerShell command. If this fails, you likely need to upgrade PowerShell.
> Ensure Docker is running before running any `azd` provisioning / deployment commands.
136
134
137
135
Then, run the following commands to get the project on your local environment:
@@ -144,26 +142,29 @@ Then, run the following commands to get the project on your local environment:
144
142
145
143
#### Deploying from scratch
146
144
147
-
> **Important**<br>
145
+
[📺 Live stream: Deploying from scratch](https://youtu.be/wgSnkxGH2Sk?si=C4zAbLKhK3LoAS43)
146
+
147
+
> **Important**:
148
148
> Ensure Docker is running before running any `azd` provisioning / deployment commands.
149
149
150
150
Execute the following command, if you don't have any pre-existing Azure services and want to start from a fresh deployment.
151
151
152
152
1. Run `azd up` - This will provision Azure resources and deploy this sample to those resources, including building the search index based on the files found in the `./data` folder.
153
-
- For the target location, the regions that currently support the model used in this sample are **East US 2**, **East US**or **South Central US**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models)
153
+
- For the target location, the regions that currently support the model used in this sample are **East US** or **Sweden Central**. For an up-to-date list of regions and models, check [here](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models)
154
154
- If you have access to multiple Azure subscriptions, you will be prompted to select the subscription you want to use. If you only have access to one subscription, it will be selected automatically.
155
155
156
-
> **Note**<br>
157
-
> This application uses the `gpt-35-turbo` model. When choosing which region to deploy to, make sure they're available in that region (i.e. EastUS). For more information, see the [Azure OpenAI Service documentation](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models#gpt-35-models).
156
+
> **Note**:
157
+
> This application uses the `gpt-4o-mini` model. When choosing which region to deploy to, make sure they're available in that region (i.e. EastUS). For more information, see the [Azure OpenAI Service documentation](https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#standard-deployment-model-availability).
158
158
159
159
1. After the application has been successfully deployed you will see a URL printed to the console. Click that URL to interact with the application in your browser.
160
160
161
161
It will look like the following:
162
162
163
163

164
164
165
-
> [!NOTE]<br>
165
+
> [!NOTE]:
166
166
> It may take a few minutes for the application to be fully deployed.
167
+
> After the application is deployed, it will also take a few minutes to process the documents to be added into the vector database.
167
168
168
169
#### Use existing resources
169
170
@@ -298,21 +299,23 @@ To then limit access to a specific set of users or groups, you can follow the st
298
299
299
300
### Enable vision (multi-modal) support
300
301
301
-
With GPT-4o, it's possible to support an enrichmented retrival augmented generation by providing both text and image as source content. To enable vision support, you need to enable `USE_VISION` and use `GPT-4o` model when provisioning.
302
+
With `GPT-4o-mini`, it's possible to support an enrichmented retrival augmented generation by providing both text and image as source content. To enable vision support, you need to enable `USE_VISION` and use `GPT-4o` or `GPT-4o-mini` model when provisioning.
302
303
303
304
> [!NOTE]
304
305
> You would need to re-indexing supporting material and re-deploy the application after enabling GPT-4o support if you have already deployed the application before. This is because enabling GPT-4o support requires new fields to be added to the search index.
305
306
306
307
To enable GPT-4V support with Azure OpenAI Service, run the following commands:
308
+
307
309
```bash
308
310
azd env set USE_VISION true
309
311
azd env set USE_AOAI true
310
-
azd env set AZURE_OPENAI_CHATGPT_MODEL_NAME gpt-4o
311
-
azd env set AZURE_OPENAI_RESOURCE_LOCATION westus# Please check the gpt-4o availability for more details.
312
+
azd env set AZURE_OPENAI_CHATGPT_MODEL_NAME gpt-4o-mini
313
+
azd env set AZURE_OPENAI_RESOURCE_LOCATION eastus# Please check the gpt model availability for more details.
312
314
azd up
313
315
```
314
316
315
317
To enable vision support with OpenAI, run the following commands:
318
+
316
319
```bash
317
320
azd env set USE_VISION true
318
321
azd env set USE_AOAI false
@@ -321,23 +324,31 @@ azd up
321
324
```
322
325
323
326
To clean up previously deployed resources, run the following command:
327
+
324
328
```bash
325
329
azd down --purge
326
330
azd env set AZD_PREPDOCS_RAN false# This is to ensure that the documents are re-indexed with the new fields.
327
331
```
332
+
328
333
## Productionizing
329
334
330
335
This sample is designed to be a starting point for your own production application,
331
336
but you should do a thorough review of the security and performance before deploying
332
337
to production. Here are some things to consider:
333
338
334
-
***OpenAI Capacity**: The default TPM (tokens per minute) is set to 30K. That is equivalent to approximately 30 conversations per minute (assuming 1K per user message/response). You can increase the capacity by changing the `chatGptDeploymentCapacity` and `embeddingDeploymentCapacity` parameters in `infra/main.bicep` to your account's maximum capacity. You can also view the Quotas tab in [Azure OpenAI studio](https://oai.azure.com/) to understand how much capacity you have.
335
-
***Azure Storage**: The default storage account uses the `Standard_LRS` SKU. To improve your resiliency, we recommend using `Standard_ZRS` for production deployments, which you can specify using the `sku` property under the `storage` module in `infra/main.bicep`.
336
-
***Azure AI Search**: If you see errors about search service capacity being exceeded, you may find it helpful to increase the number of replicas by changing `replicaCount` in `infra/core/search/search-services.bicep` or manually scaling it from the Azure Portal.
337
-
***Azure Container Apps**: By default, this application deploys containers with 0.5 CPU Cores and 1GB of memory. The minimum replicas is 1 and maximum 10. For this app, you can set values such as `containerCpuCoreCount`, `containerMaxReplicas `, `containerMemory`, `containerMinReplicas` in the `infra/core/host/container-app.bicep` file to fit your needs. You can use auto-scaling rules or scheduled scaling rules, and scale up the [maximum/minimum](https://learn.microsoft.com/azure/container-apps/scale-app) based on load.
338
-
***Authentication**: By default, the deployed app is publicly accessible. We recommend restricting access to authenticated users. See [Enabling authentication](#enabling-authentication) above for how to enable authentication.
339
-
***Networking**: We recommend deploying inside a Virtual Network. If the app is only for internal enterprise use, use a private DNS zone. Also consider using Azure API Management (APIM) for firewalls and other forms of protection. For more details, read [Azure OpenAI Landing Zone reference architecture](https://techcommunity.microsoft.com/t5/azure-architecture-blog/azure-openai-landing-zone-reference-architecture/ba-p/3882102).
340
-
***Loadtesting**: We recommend running a loadtest for your expected number of users.
339
+
-**OpenAI Capacity**: The default TPM (tokens per minute) is set to 30K. That is equivalent to approximately 30 conversations per minute (assuming 1K per user message/response). You can increase the capacity by changing the `chatGptDeploymentCapacity` and `embeddingDeploymentCapacity` parameters in `infra/main.bicep` to your account's maximum capacity. You can also view the Quotas tab in [Azure OpenAI studio](https://oai.azure.com/) to understand how much capacity you have.
340
+
341
+
-**Azure Storage**: The default storage account uses the `Standard_LRS` SKU. To improve your resiliency, we recommend using `Standard_ZRS` for production deployments, which you can specify using the `sku` property under the `storage` module in `infra/main.bicep`.
342
+
343
+
-**Azure AI Search**: If you see errors about search service capacity being exceeded, you may find it helpful to increase the number of replicas by changing `replicaCount` in `infra/core/search/search-services.bicep` or manually scaling it from the Azure Portal.
344
+
345
+
-**Azure Container Apps**: By default, this application deploys containers with 0.5 CPU Cores and 1GB of memory. The minimum replicas is 1 and maximum 10. For this app, you can set values such as `containerCpuCoreCount`, `containerMaxReplicas `, `containerMemory`, `containerMinReplicas` in the `infra/core/host/container-app.bicep` file to fit your needs. You can use auto-scaling rules or scheduled scaling rules, and scale up the [maximum/minimum](https://learn.microsoft.com/azure/container-apps/scale-app) based on load.
346
+
347
+
-**Authentication**: By default, the deployed app is publicly accessible. We recommend restricting access to authenticated users. See [Enabling authentication](#enabling-authentication) above for how to enable authentication.
348
+
349
+
-**Networking**: We recommend deploying inside a Virtual Network. If the app is only for internal enterprise use, use a private DNS zone. Also consider using Azure API Management (APIM) for firewalls and other forms of protection. For more details, read [Azure OpenAI Landing Zone reference architecture](https://techcommunity.microsoft.com/t5/azure-architecture-blog/azure-openai-landing-zone-reference-architecture/ba-p/3882102).
350
+
351
+
-**Loadtesting**: We recommend running a loadtest for your expected number of users.
341
352
342
353
## Guidance
343
354
@@ -367,4 +378,4 @@ Pricing varies per region and usage, so it isn't possible to predict exact costs
367
378
368
379
**_Question_**: Why do we need to break up the PDFs into chunks when Azure AI Search supports searching large documents?
369
380
370
-
**_Answer_**: Chunking allows us to limit the amount of information we send to OpenAI due to token limits. By breaking up the content, it allows us to easily find potential chunks of text that we can inject into OpenAI. The method of chunking we use leverages a sliding window of text such that sentences that end one chunk will start the next. This allows us to reduce the chance of losing the context of the text.
381
+
**_Answer_**: Chunking allows us to limit the amount of information we send to OpenAI due to token limits. By breaking up the content, it allows us to easily find potential chunks of text that we can inject into OpenAI. The method of chunking we use leverages a sliding window of text such that sentences that end one chunk will start the next. This allows us to reduce the chance of losing the context of the text.
0 commit comments