Skip to content

Commit 3db86a6

Browse files
committed
docs: update readme and docs
1 parent 1aeff10 commit 3db86a6

File tree

8 files changed

+136
-111
lines changed

8 files changed

+136
-111
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ OPENAI_API_KEY=
2323

2424
# Customize the deployment for the OpenAI text embedding model and chat model.
2525
AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-ada-002
26-
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4
26+
AZURE_OPENAI_CHAT_DEPLOYMENT=gpt-4o-mini
2727
AZURE_API_VERSION=2024-10-01-preview
2828
AZURE_AI_SEARCH_INDEX_NAME=llamaindex-vector-search
2929
AZURE_AI_SEARCH_CHUNK_FIELD="chunk"

README.md

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ This template, the application code and configuration it contains, has been buil
3131

3232
## Table of Contents
3333

34+
- [LlamaIndex RAG chat app with Azure OpenAI and Azure AI Search (JavaScript)](#llamaindex-rag-chat-app-with-azure-openai-and-azure-ai-search-javascript)
35+
- [Important Security Notice](#important-security-notice)
36+
- [Table of Contents](#table-of-contents)
37+
- [Architecture Diagram](#architecture-diagram)
3438
- [Azure account requirements](#azure-account-requirements)
3539
- [Cost estimation](#cost-estimation)
3640
- [Getting Started](#getting-started)
@@ -40,6 +44,7 @@ This template, the application code and configuration it contains, has been buil
4044
- [Deploying](#deploying)
4145
- [Deploying again](#deploying-again)
4246
- [Running the development server](#running-the-development-server)
47+
- [Using Docker (optional)](#using-docker-optional)
4348
- [Using the app](#using-the-app)
4449
- [Clean up](#clean-up)
4550
- [Guidance](#guidance)
@@ -58,7 +63,7 @@ The repo includes sample data so it's ready to try end to end. In this sample ap
5863

5964
- **Azure account**. If you're new to Azure, [get an Azure account for free](https://azure.microsoft.com/free/cognitive-search/) and you'll get some free Azure credits to get started.
6065
- **Azure account permissions**:
61-
- Your Azure account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [Role Based Access Control Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#role-based-access-control-administrator-preview), [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). If you don't have subscription-level permissions, you must be granted [RBAC](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#role-based-access-control-administrator-preview) for an existing resource group and [deploy to that existing group](docs/deploy_existing.md#resource-group).
66+
- Your Azure account must have `Microsoft.Authorization/roleAssignments/write` permissions, such as [Role Based Access Control Administrator](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#role-based-access-control-administrator-preview), [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). If you don't have subscription-level permissions, you must be granted [RBAC](https://learn.microsoft.com/azure/role-based-access-control/built-in-roles#role-based-access-control-administrator-preview) for an existing resource group and deploy to that existing group.
6267
- Your Azure account also needs `Microsoft.Resources/deployments/write` permissions on the subscription level.
6368

6469
### Cost estimation
@@ -67,14 +72,14 @@ Pricing varies per region and usage, so it isn't possible to predict exact costs
6772
However, you can try the [Azure pricing calculator](https://azure.com/e/a87a169b256e43c089015fda8182ca87) for the resources below.
6873

6974
* Azure Container Apps: Consumption plan with 1 CPU core, 2.0 GB RAM. Pricing with Pay-as-You-Go. [Pricing](https://azure.microsoft.com/pricing/details/container-apps/)
70-
* Azure OpenAI: Standard tier, gpt-4 and text-embedding-3-large models. Pricing per 1K tokens used. [Pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/)
75+
* Azure OpenAI: Standard tier, gpt-4o-mini and text-embedding-3-large models. Pricing per 1K tokens used. [Pricing](https://azure.microsoft.com/pricing/details/cognitive-services/openai-service/)
7176
* Azure AI Search: Standard tier, 1 replica, free level of semantic search. Pricing per hour. [Pricing](https://azure.microsoft.com/pricing/details/search/)
7277
* Azure Blob Storage: Standard tier with ZRS (Zone-redundant storage). Pricing per storage and read operations. [Pricing](https://azure.microsoft.com/pricing/details/storage/blobs/)
7378
* Azure Monitor: Pay-as-you-go tier. Costs based on data ingested. [Pricing](https://azure.microsoft.com/pricing/details/monitor/)
7479

7580
To reduce costs, you can switch to free SKUs for various services, but those SKUs have limitations.
7681

77-
To avoid unnecessary costs, remember to take down your app if it's no longer in use,
82+
To avoid unnecessary costs, remember to take down your app if it's no longer in use,
7883
either by deleting the resource group in the Portal or running `azd down`.
7984

8085
## Getting Started
@@ -114,46 +119,61 @@ A related option is VS Code Dev Containers, which will open the project in your
114119
2. Create a new folder and switch to it in the terminal.
115120
3. Run this command to download the project code:
116121

117-
```shell
118-
azd init -t llamaindex-search-javascript
119-
```
122+
```shell
123+
azd init -t llamaindex-search-javascript
124+
```
120125

121-
Note that this command will initialize a git repository, so you do not need to clone this repository.
126+
> [!NOTE]
127+
> This command will initialize a git repository, so you do not need to clone this repository.
122128
123129
## Deploying
124130

125131
The steps below will provision Azure resources and deploy the application code to Azure Container Apps.
126132

127-
1. Login to your Azure account:
133+
Login to your Azure account:
128134

129-
```shell
130-
azd auth login
131-
```
135+
```shell
136+
azd auth login
137+
```
132138

133-
For GitHub Codespaces users, if the previous command fails, try:
139+
For GitHub Codespaces users, if the previous command fails, try:
134140

135-
```shell
136-
azd auth login --use-device-code
137-
```
141+
```shell
142+
azd auth login --use-device-code
143+
```
144+
145+
Create a new azd environment:
138146

139-
1. Create a new azd environment:
147+
```shell
148+
azd env new
149+
```
140150

141-
```shell
142-
azd env new
143-
```
151+
Enter a name that will be used for the resource group.
152+
This will create a new folder in the `.azure` folder, and set it as the active environment for any calls to `azd` going forward.
144153

145-
Enter a name that will be used for the resource group.
146-
This will create a new folder in the `.azure` folder, and set it as the active environment for any calls to `azd` going forward.
147-
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.
148-
- **Important**: Beware that the resources created by this command will incur immediate costs, primarily from the AI Search resource. These resources may accrue costs even if you interrupt the command before it is fully executed. You can run `azd down` or delete the resources manually to avoid unnecessary spending.
149-
- You will be prompted to select two locations, one for the majority of resources and one for the OpenAI resource, which is currently a short list. That location list is based on the [OpenAI model availability table](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models#model-summary-table-and-region-availability) and may become outdated as availability changes.
150-
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.
154+
Package, provision and deploy this project to Azure:
155+
156+
```shell
157+
azd up
158+
```
159+
160+
> [!NOTE]
161+
> 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.
162+
163+
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.
151164

152165
It will look like the following:
153166

154167
!['Output from running azd up'](docs/images/llamaindex-search-javascript-endpoint.png)
155168

156-
> NOTE: It may take 5-10 minutes after you see 'SUCCESS' for the application to be fully deployed.
169+
> [!NOTE]
170+
> It may take 5-10 minutes after you see 'SUCCESS' for the application to be fully deployed.
171+
172+
> [!IMPORTANT]
173+
> Beware that the resources created by this command will incur immediate costs, primarily from the AI Search resource. These resources may accrue costs even if you interrupt the command before it is fully executed. You can run `azd down` or delete the resources manually to avoid unnecessary spending.
174+
>
175+
> You will be prompted to select two locations, one for the majority of resources and one for the OpenAI resource, which is currently a short list. That location list is based on the [OpenAI model availability table](https://learn.microsoft.com/azure/cognitive-services/openai/concepts/models#model-summary-table-and-region-availability) and may become outdated as availability changes.
176+
157177

158178
### Deploying again
159179

@@ -248,7 +268,7 @@ NOTE: you can also run `azd down --purge --force`.
248268

249269
The resource group and all the resources will be deleted.
250270

251-
# Guidance
271+
## Guidance
252272

253273
You can find extensive documentation in the [docs](docs/README.md) folder:
254274

docs/azd.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ To troubleshoot any issues, see [troubleshooting](#troubleshooting).
7272

7373
### Configure environment variables for running services
7474

75-
Configure environment variables for running services by updating `settings` in [main.parameters.json](./infra/main.parameters.json).
75+
Configure environment variables for running services by updating `settings` in [main.parameters.json](../infra/main.parameters.json).
7676

7777
### Configure CI/CD pipeline
7878

docs/features.md

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
This document covers optional features that can be enabled in the deployed Azure resources.
55
You should typically enable these features before running `azd up`. Once you've set them, return to the [deployment steps](../README.md#deploying).
66

7-
* [Using GPT-4](#using-gpt-4)
8-
* [Using text-embedding-3 models](#using-text-embedding-3-models)
9-
* [Enabling authentication](#enabling-authentication)
10-
* [Adding an OpenAI load balancer](#adding-an-openai-load-balancer)
7+
- [Enabling optional features](#enabling-optional-features)
8+
- [Using GPT-4](#using-gpt-4)
9+
- [Using text-embedding-3 models](#using-text-embedding-3-models)
10+
- [Enabling authentication](#enabling-authentication)
11+
- [Adding an OpenAI load balancer](#adding-an-openai-load-balancer)
1112

1213
## Using GPT-4
1314

@@ -19,73 +20,73 @@ Execute the following commands inside your terminal:
1920

2021
1. To set the name of the deployment, run this command with a unique name in your Azure OpenAI account. You can use any deployment name, as long as it's unique in your Azure OpenAI account.
2122

22-
```bash
23-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT <your-deployment-name>
24-
```
23+
```bash
24+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT <your-deployment-name>
25+
```
2526

26-
For example:
27+
For example:
2728

28-
```bash
29-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT chat4
30-
```
29+
```bash
30+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT chat4
31+
```
3132

3233
1. To set the GPT model name to a **gpt-4**, **gpt-4o**, or **gpt-4o mini** version from the [available models](https://learn.microsoft.com/azure/ai-services/openai/concepts/models), run this command with the appropriate GPT model name.
3334

34-
For GPT-4:
35+
For GPT-4:
3536

36-
```bash
37-
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4
38-
```
37+
```bash
38+
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4
39+
```
3940

40-
For GPT-4o:
41+
For GPT-4o:
4142

42-
```bash
43-
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4o
44-
```
43+
```bash
44+
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4o
45+
```
4546

46-
For GPT-4o mini:
47+
For GPT-4o mini:
4748

48-
```bash
49-
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4o-mini
50-
```
49+
```bash
50+
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4o-mini
51+
```
5152

5253
1. To set the Azure OpenAI deployment SKU name, run this command with [the desired SKU name](https://learn.microsoft.com/azure/ai-services/openai/how-to/deployment-types#deployment-types).
5354

54-
```bash
55-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_SKU GlobalStandard
56-
```
55+
```bash
56+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_SKU GlobalStandard
57+
```
5758

5859
1. To set the Azure OpenAI deployment capacity, run this command with the desired capacity.
5960

60-
```bash
61-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_CAPACITY 10
62-
```
61+
```bash
62+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_CAPACITY 10
63+
```
6364

6465
1. To set the Azure OpenAI deployment version from the [available versions](https://learn.microsoft.com/azure/ai-services/openai/concepts/models), run this command with the appropriate version.
6566

66-
For GPT-4:
67+
For GPT-4:
6768

68-
```bash
69-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION turbo-2024-04-09
70-
```
69+
```bash
70+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION turbo-2024-04-09
71+
```
7172

72-
For GPT-4o:
73+
For GPT-4o:
7374

74-
```bash
75-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION 2024-05-13
76-
```
75+
```bash
76+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION 2024-05-13
77+
```
7778

78-
For GPT-4o mini:
79+
For GPT-4o mini:
7980

80-
```bash
81-
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION 2024-07-18
82-
```
81+
```bash
82+
azd env set AZURE_OPENAI_CHAT_DEPLOYMENT_VERSION 2024-07-18
83+
```
8384

8485
1. To update the deployment with the new parameters, run this command.
8586

86-
```bash
87-
azd up
88-
```
87+
```bash
88+
azd up
89+
```
8990

9091
> [!NOTE]
9192
> To revert back to GPT 3.5, run the following commands:
@@ -105,25 +106,25 @@ By default, the deployed Azure web app uses the `text-embedding-ada-002` embeddi
105106

106107
1. Run one of the following commands to set the desired model:
107108

108-
```shell
109-
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-small
110-
```
109+
```shell
110+
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-small
111+
```
111112

112-
```shell
113-
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-large
114-
```
113+
```shell
114+
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-large
115+
```
115116

116117
2. Specify the desired dimensions of the model: (from 256-3072, model dependent)
117118

118-
```shell
119-
azd env set AZURE_OPENAI_EMB_DIMENSIONS 256
120-
```
119+
```shell
120+
azd env set AZURE_OPENAI_EMB_DIMENSIONS 256
121+
```
121122

122123
3. Set the model version to "1" (the only version as of March 2024):
123124

124-
```shell
125-
azd env set AZURE_OPENAI_EMB_DEPLOYMENT_VERSION 1
126-
```
125+
```shell
126+
azd env set AZURE_OPENAI_EMB_DEPLOYMENT_VERSION 1
127+
```
127128

128129
4. When prompted during `azd up`, make sure to select a region for the OpenAI resource group location that supports the text-embedding-3 models. There are [limited regions available](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#embeddings-models).
129130

@@ -143,5 +144,5 @@ To then limit access to a specific set of users or groups, you can follow the st
143144

144145
## Adding an OpenAI load balancer
145146

146-
As discussed in more details in our [productionizing guide](./productionizing.md), you may want to consider implementing a load balancer between OpenAI instances if you are consistently going over the TPM limit.
147+
As discussed in more details in our [productionizing guide](./prod.md), you may want to consider implementing a load balancer between OpenAI instances if you are consistently going over the TPM limit.
147148
Fortunately, this repository is designed for easy integration with other repositories that create load balancers for OpenAI instances.
Loading

0 commit comments

Comments
 (0)