This document covers optional features that can be enabled in the deployed Azure resources.
You should typically enable these features before running azd up
. Once you've set them, return to the deployment steps.
- Using GPT-4
- Using text-embedding-3 models
- Enabling GPT-4 Turbo with Vision
- Enabling Integrated Vectorization
- Enabling authentication
- Enabling login and document level access control
- Enabling CORS for an alternate frontend
- Using local parsers
We generally find that most developers are able to get high quality answers using GPT 3.5. However, if you want to try GPT-4, you can do so by following these steps:
Execute the following commands inside your terminal:
-
To set the name of the deployment, run this command with a new unique name.
azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT chat4
-
To set the GPT model name to a gpt-4 version from the available models, run this command with the appropriate gpt model name.
azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-4
-
To set the Azure OpenAI deploymemnt capacity, run this command with the desired capacity.
azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY 10
-
To set the Azure OpenAI deploymemnt version from the available versions, run this command with the appropriate version.
azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION 0125-Preview
-
To updat the deployment with the new parameters, run this command.
azd up
Note
To revert back to GPT 3.5, run the following commands:
azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT chat
to set the name of your old GPT 3.5 deployment.azd env set AZURE_OPENAI_CHATGPT_MODEL gpt-35-turbo
to set the name of your old GPT 3.5 model.azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_CAPACITY 30
to set the capacity of your old GPT 3.5 deployment.azd env set AZURE_OPENAI_CHATGPT_DEPLOYMENT_VERSION 0613
to set the version number of your old GPT 3.5.azd up
to update the provisioned resources.
Note that this does not delete your GPT-4 deployment; it just makes your application create a new or reuse an old GPT 3.5 deployment. If you want to delete it, you can go to your Azure OpenAI studio and do so.
By default, the deployed Azure web app uses the text-embedding-ada-002
embedding model. If you want to use one of the text-embedding-3 models, you can do so by following these steps:
-
Run one of the following commands to set the desired model:
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-small
azd env set AZURE_OPENAI_EMB_MODEL_NAME text-embedding-3-large
-
Specify the desired dimensions of the model: (from 256-3072, model dependent)
azd env set AZURE_OPENAI_EMB_DIMENSIONS 256
-
Set the model version to "1" (the only version as of March 2024):
azd env set AZURE_OPENAI_EMB_DEPLOYMENT_VERSION 1
-
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.
If you have already deployed:
- You'll need to change the deployment name by running
azd env set AZURE_OPENAI_EMB_DEPLOYMENT <new-deployment-name>
- You'll need to create a new index, and re-index all of the data using the new model. You can either delete the current index in the Azure Portal, or create an index with a different name by running
azd env set AZURE_SEARCH_INDEX new-index-name
. When you next runazd up
, the new index will be created and the data will be re-indexed. - If your OpenAI resource is not in one of the supported regions, you should delete
openAiResourceGroupLocation
from.azure/YOUR-ENV-NAME/config.json
. When runningazd up
, you will be prompted to select a new region.
![NOTE] The text-embedding-3 models are not currently supported by the integrated vectorization feature.
This section covers the integration of GPT-4 Vision with Azure AI Search. Learn how to enhance your search capabilities with the power of image and text indexing, enabling advanced search functionalities over diverse document types. For a detailed guide on setup and usage, visit our Enabling GPT-4 Turbo with Vision page.
Azure AI search recently introduced an integrated vectorization feature in preview mode. This feature is a cloud-based approach to data ingestion, which takes care of document format cracking, data extraction, chunking, vectorization, and indexing, all with Azure technologies.
To enable integrated vectorization with this sample:
- If you've previously deployed, delete the existing search index.
- Run
azd env set USE_FEATURE_INT_VECTORIZATION true
- Run
azd up
to update system and user roles - You can view the resources such as the indexer and skillset in Azure Portal and monitor the status of the vectorization process.
This feature is not currently compatible with GPT4-vision or the newer text-embedding-3 models.
By default, the deployed Azure web app will have no authentication or access restrictions enabled, meaning anyone with routable network access to the web app can chat with your indexed data. If you'd like to automatically setup authentication and user login as part of the azd up
process, see this guide.
Alternatively, you can manually require authentication to your Azure Active Directory by following the Add app authentication tutorial and set it up against the deployed web app.
To then limit access to a specific set of users or groups, you can follow the steps from Restrict your Azure AD app to a set of users by changing "Assignment Required?" option under the Enterprise Application, and then assigning users/groups access. Users not granted explicit access will receive the error message -AADSTS50105: Your administrator has configured the application <app_name> to block users unless they are specifically granted ('assigned') access to the application.-
By default, the deployed Azure web app allows users to chat with all your indexed data. You can enable an optional login system using Azure Active Directory to restrict access to indexed data based on the logged in user. Enable the optional login and document level access control system by following this guide.
By default, the deployed Azure web app will only allow requests from the same origin. To enable CORS for a frontend hosted on a different origin, run:
- Run
azd env set ALLOWED_ORIGIN https://<your-domain.com>
- Run
azd up
For the frontend code, change BACKEND_URI
in api.ts
to point at the deployed backend URL, so that all fetch requests will be sent to the deployed backend.
For an alternate frontend that's written in Web Components and deployed to Static Web Apps, check out azure-search-openai-javascript and its guide on using a different backend. Both these repositories adhere to the same HTTP protocol for RAG chat apps.
If you want to decrease the charges by using local parsers instead of Azure Document Intelligence, you can set environment variables before running the data ingestion script. Note that local parsers will generally be not as sophisticated.
- Run
azd env set USE_LOCAL_PDF_PARSER true
to use the local PDF parser. - Run
azd env set USE_LOCAL_HTML_PARSER true
to use the local HTML parser.