|
| 1 | +# Deploying with minimal costs |
| 2 | + |
| 3 | +This AI RAG chat application is designed to be easily deployed using the Azure Developer CLI, which provisions the infrastructure according to the Bicep files in the `infra` folder. Those files describe each of the Azure resources needed, and configures their SKU (pricing tier) and other parameters. Many Azure services offer a free tier, but the infrastructure files in this project do *not* default to the free tier as there are often limitations in that tier. |
| 4 | + |
| 5 | +However, if your goal is to minimize costs while prototyping your application, follow the steps below *before* running `azd up`. Once you've gone through these steps, return to the [deployment steps](../README.md#deployment). |
| 6 | + |
| 7 | +[📺 Live stream: Deploying from a free account]() |
| 8 | + |
| 9 | +1. Log in to your Azure account using the Azure Developer CLI: |
| 10 | + |
| 11 | + ```shell |
| 12 | + azd auth login |
| 13 | + ``` |
| 14 | + |
| 15 | +1. Create a new azd environment for the free resource group: |
| 16 | + |
| 17 | + ```shell |
| 18 | + azd env new |
| 19 | + ``` |
| 20 | + |
| 21 | + Enter a name that will be used for the resource group. |
| 22 | + This will create a new folder in the `.azure` folder, and set it as the active environment for any calls to `azd` going forward. |
| 23 | + |
| 24 | +1. Use the free tier of **Azure AI Document Intelligence** (aka [Form Recognizer](https://learn.microsoft.com/en-us/azure/ai-services/document-intelligence/overview?view=doc-intel-4.0.0)): |
| 25 | + |
| 26 | + ```shell |
| 27 | + azd env set AZURE_FORMRECOGNIZER_SERVICE_SKU F0 |
| 28 | + ``` |
| 29 | + |
| 30 | +1. Use the free tier of **Azure AI Search**: |
| 31 | + |
| 32 | + ```shell |
| 33 | + azd env set AZURE_SEARCH_SERVICE_SKU free |
| 34 | + azd env set AZURE_SEARCH_SEMANTIC_RANKER disabled |
| 35 | + ``` |
| 36 | + |
| 37 | + Limitations: |
| 38 | + 1. You are only allowed one free search service across all regions. |
| 39 | + If you have one already, either delete that service or follow instructions to |
| 40 | + reuse your [existing search service](../README.md#use-existing-resources). |
| 41 | + 2. The free tier does not support semantic ranker. Note that will generally result in [decreased search relevance](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/azure-ai-search-outperforming-vector-search-with-hybrid/ba-p/3929167). |
| 42 | + |
| 43 | +1. Turn off **Azure Monitor** (Application Insights): |
| 44 | + |
| 45 | + ```shell |
| 46 | + azd env set AZURE_USE_APPLICATION_INSIGHTS false |
| 47 | + ``` |
| 48 | + |
| 49 | + Application Insights is quite inexpensive already, so turning this off may not be worth the costs saved, but it is an option for those who want to minimize costs. |
| 50 | + |
| 51 | +1. (Optional) Use **OpenAI.com** instead of Azure OpenAI. |
| 52 | + |
| 53 | + You can create a free account in OpenAI and [request a key to use OpenAI models](https://platform.openai.com/docs/quickstart/create-and-export-an-api-key). Once you have this, you can disable the use of Azure OpenAI Services, and use OpenAI APIs. |
| 54 | + |
| 55 | + ```shell |
| 56 | + azd env set USE_AOAI false |
| 57 | + azd env set USE_VISION false |
| 58 | + azd env set OPENAI_CHATGPT_DEPLOYMENT gpt-4o-mini |
| 59 | + azd env set OPENAI_API_KEY <your openai.com key goes here> |
| 60 | + ``` |
| 61 | + |
| 62 | + ***Note:** Both Azure OpenAI and openai.com OpenAI accounts will incur costs, based on tokens used, but the costs are fairly low for the amount of sample data (less than $10).* |
| 63 | + |
| 64 | +1. Once you've made the desired customizations, follow the steps in the README [to run `azd up`](../README.md#deploying-from-scratch). We recommend using "eastus" as the region, for availability reasons. |
0 commit comments