diff --git a/.github/workflows/azure-dev.yml b/.github/workflows/azure-dev.yml index 97eff757..5e1376d9 100644 --- a/.github/workflows/azure-dev.yml +++ b/.github/workflows/azure-dev.yml @@ -32,7 +32,6 @@ jobs: AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }} AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME }} AZURE_OPENAI_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }} - AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME }} AZURE_OPENAI_NAME: ${{ vars.AZURE_OPENAI_NAME }} AZURE_CONTAINER_REGISTRY_NAME: ${{ vars.AZURE_CONTAINER_REGISTRY_NAME }} AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} diff --git a/.github/workflows/evaluate.yml b/.github/workflows/evaluate.yml index 30f49d24..a5f97566 100644 --- a/.github/workflows/evaluate.yml +++ b/.github/workflows/evaluate.yml @@ -26,7 +26,6 @@ jobs: AZURE_OPENAI_API_VERSION: ${{ vars.AZURE_OPENAI_API_VERSION }} AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME }} AZURE_OPENAI_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_DEPLOYMENT_NAME }} - AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME: ${{ vars.AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME }} AZURE_RESOURCE_GROUP: ${{ vars.AZURE_RESOURCE_GROUP }} AZURE_SEARCH_ENDPOINT: ${{ vars.AZURE_SEARCH_ENDPOINT }} AZURE_OPENAI_NAME: ${{ vars.AZURE_OPENAI_NAME }} diff --git a/README.md b/README.md index 9202c2fb..67a14009 100644 --- a/README.md +++ b/README.md @@ -68,8 +68,8 @@ This project template provides the following features: * **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. See [guide to deploying with the free trial](docs/deploy_lowcost.md). * **Azure subscription with access enabled for the Azure OpenAI Service**. If your access request to Azure OpenAI Service doesn't match the [acceptance criteria](https://learn.microsoft.com/legal/cognitive-services/openai/limited-access?context=%2Fazure%2Fcognitive-services%2Fopenai%2Fcontext%2Fcontext), you can use [OpenAI public API](https://platform.openai.com/docs/api-reference/introduction) instead. - - Ability to deploy `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13`. - - We recommend using Canada East, as this region has access to all models and services required. + - Ability to deploy `gpt-4o` and `gpt-4o-mini`. + - We recommend using `swedencentral`, as this region has access to all models and services required. * **Azure subscription with access enabled for [Bing Search API](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)** * **Azure subscription with access enabled for [Azure AI Search](https://azure.microsoft.com/en-gb/products/ai-services/ai-search)** @@ -105,9 +105,9 @@ The easiest way to get started is GitHub Codespaces, since it will setup all the azd up ``` - You will be prompted to select some details about your deployed resources, including location. As a reminder we recommend Canada East as the region for this project. + You will be prompted to select some details about your deployed resources, including location. As a reminder we recommend `Sweden Central` as the region for this project. Once the deployment is complete you should be able to scroll up in your terminal and see the url that the app has been deployed to. It should look similar to this - `Ingress Updated. Access your app at https://env-name.codespacesname.eastus2.azurecontainerapps.io/`. Navigate to the link to try out the app straight away! + `Ingress Updated. Access your app at https://env-name.codespacesname.swedencentral.azurecontainerapps.io/`. Navigate to the link to try out the app straight away! 5. Once the above steps are completed you can [test the sample](#testing-the-sample). @@ -185,7 +185,7 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain azd up ``` - This project uses `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly. We recommend using Canada East for this project. + This project uses `gpt-4o` and `gpt-4o-mini which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly. We recommend using Sweden Central for this project. After running azd up, you may be asked the following question during `Github Setup`: @@ -308,8 +308,8 @@ azd pipeline config ### Region Availability -This template uses `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly - * We recommend using Canada East +This template uses `gpt-4o` and `gpt-4o-mini` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly + * We recommend using Sweden Central ### Costs diff --git a/azure.yaml b/azure.yaml index a523a5f5..8f56e760 100644 --- a/azure.yaml +++ b/azure.yaml @@ -36,7 +36,6 @@ pipeline: - AZURE_RESOURCE_GROUP - AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME - AZURE_OPENAI_DEPLOYMENT_NAME - - AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME - AZURE_SEARCH_ENDPOINT - BING_SEARCH_ENDPOINT - AZURE_OPENAI_NAME diff --git a/data/create-azure-search.ipynb b/data/create-azure-search.ipynb index ee208c4c..1457ff0a 100644 --- a/data/create-azure-search.ipynb +++ b/data/create-azure-search.ipynb @@ -63,7 +63,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 2, "metadata": {}, "outputs": [], "source": [ @@ -74,7 +74,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 3, "metadata": {}, "outputs": [], "source": [ @@ -161,7 +161,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 9, "metadata": {}, "outputs": [], "source": [ @@ -174,7 +174,7 @@ " azure_credential = DefaultAzureCredential()\n", " token_provider = get_bearer_token_provider(azure_credential,\"https://cognitiveservices.azure.com/.default\")\n", " client = AzureOpenAI(\n", - " api_version=\"2023-07-01-preview\",\n", + " api_version=\"2024-08-01-preview\",\n", " azure_endpoint=openai_service_endoint,\n", " azure_deployment=openai_deployment,\n", " azure_ad_token_provider=token_provider\n", @@ -242,9 +242,21 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3 (ipykernel)", + "display_name": "Python 3", "language": "python", "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.11" } }, "nbformat": 4, diff --git a/data/create-azure-search.py b/data/create-azure-search.py index d6000249..bc8916e0 100644 --- a/data/create-azure-search.py +++ b/data/create-azure-search.py @@ -143,7 +143,8 @@ def create_index_definition(name: str) -> SearchIndex: return index -# In[5]: + +# In[7]: def gen_products( @@ -155,7 +156,7 @@ def gen_products( azure_credential = DefaultAzureCredential() token_provider = get_bearer_token_provider(azure_credential,"https://cognitiveservices.azure.com/.default") client = AzureOpenAI( - api_version="2023-07-01-preview", + api_version="2024-08-01-preview", azure_endpoint=openai_service_endoint, azure_deployment=openai_deployment, azure_ad_token_provider=token_provider @@ -182,7 +183,7 @@ def gen_products( return items -# In[6]: +# In[8]: aisearch_endpoint = os.environ["AZURE_SEARCH_ENDPOINT"] @@ -199,7 +200,7 @@ def gen_products( print(f"index {index_name} created") -# In[7]: +# In[9]: print(f"indexing documents") diff --git a/docs/README.md b/docs/README.md index 8c05dc3a..67a14009 100644 --- a/docs/README.md +++ b/docs/README.md @@ -34,10 +34,11 @@ description: Using Azure OpenAI agent with Python, integrating Bing Search API a - [Initializing the project](#initializing-the-project) - [Deployment](#deployment) - [Testing the sample](#testing-the-sample) - - [Evaluating prompt flow results](#evaluating-prompt-flow-results) -- [Costs](#costs) -- [Security Guidelines](#security-guidelines) + - [Evaluating results](#evaluating-results) - [Guidance](#guidance) + - [Region Availability](#region-availability) + - [Costs](#costs) + - [Security Guidelines](#security) - [Resources](#resources) - [Code of Conduct](#code-of-conduct) @@ -66,9 +67,9 @@ This project template provides the following features: **IMPORTANT:** In order to deploy and run this example, you'll need: * **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. See [guide to deploying with the free trial](docs/deploy_lowcost.md). -* **Azure subscription with access enabled for the Azure OpenAI Service**. You can request access with [this form](https://aka.ms/oaiapply). If your access request to Azure OpenAI Service doesn't match the [acceptance criteria](https://learn.microsoft.com/legal/cognitive-services/openai/limited-access?context=%2Fazure%2Fcognitive-services%2Fopenai%2Fcontext%2Fcontext), you can use [OpenAI public API](https://platform.openai.com/docs/api-reference/introduction) instead. - - Ability to deploy `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13`. - - We recommend using Canada East, as this region has access to all models and services required. +* **Azure subscription with access enabled for the Azure OpenAI Service**. If your access request to Azure OpenAI Service doesn't match the [acceptance criteria](https://learn.microsoft.com/legal/cognitive-services/openai/limited-access?context=%2Fazure%2Fcognitive-services%2Fopenai%2Fcontext%2Fcontext), you can use [OpenAI public API](https://platform.openai.com/docs/api-reference/introduction) instead. + - Ability to deploy `gpt-4o` and `gpt-4o-mini`. + - We recommend using `swedencentral`, as this region has access to all models and services required. * **Azure subscription with access enabled for [Bing Search API](https://www.microsoft.com/en-us/bing/apis/bing-web-search-api)** * **Azure subscription with access enabled for [Azure AI Search](https://azure.microsoft.com/en-gb/products/ai-services/ai-search)** @@ -104,9 +105,9 @@ The easiest way to get started is GitHub Codespaces, since it will setup all the azd up ``` - You will be prompted to select some details about your deployed resources, including location. As a reminder we recommend Canada East as the region for this project. + You will be prompted to select some details about your deployed resources, including location. As a reminder we recommend `Sweden Central` as the region for this project. Once the deployment is complete you should be able to scroll up in your terminal and see the url that the app has been deployed to. It should look similar to this - `Ingress Updated. Access your app at https://env-name.codespacesname.eastus2.azurecontainerapps.io/`. Navigate to the link to try out the app straight away! + `Ingress Updated. Access your app at https://env-name.codespacesname.swedencentral.azurecontainerapps.io/`. Navigate to the link to try out the app straight away! 5. Once the above steps are completed you can [test the sample](#testing-the-sample). @@ -184,7 +185,7 @@ Once you've opened the project in [Codespaces](#github-codespaces), [Dev Contain azd up ``` - This project uses `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly. We recommend using Canada East for this project. + This project uses `gpt-4o` and `gpt-4o-mini which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly. We recommend using Sweden Central for this project. After running azd up, you may be asked the following question during `Github Setup`: @@ -215,8 +216,8 @@ To test the sample: ``` **Important Note**: If you are running in Codespaces, you will need to change the visibility of the API's 8000 and 5173 ports to `public` in your VS Code terminal's `PORTS` tab. The ports tab should look like this: - - Screenshot showing setting port-visibility + + ![Screenshot showing setting port-visibility](images/ports-resized.png) If you open the server link in a browser, you will see a URL not found error, this is because we haven't created a home url route in FastAPI. We have instead created a `/get_article` route which is used to pass context and instructions directly to the get_article.py file which runs the agent workflow. @@ -274,21 +275,26 @@ python -m orchestrator Once you can see the article has been generated, a `.runs` folder should appear in the `./src/api` . Select this folder and click the `.tracy` file in it. This shows you all the Python functions that were called in order to generate the article. Explore each section and see what helpful information you can find. -## Evaluating prompt flow results - -To understand how well our prompt flow performs using defined metrics like **groundedness**, **coherence** etc we can evaluate the results. To evaluate the prompt flow, we need to be able to compare it to what we see as "good results" in order to understand how well it aligns with our expectations. - -We may be able to evaluate the flow manually (e.g., using Azure AI Foundry) but for now, we'll evaluate this by running the prompt flow using **gpt-4** and comparing our performance to the results obtained there. To do this, follow the instructions and steps in the notebook `evaluate-chat-prompt-flow.ipynb` under the `eval` folder. +## Evaluating results -You can also view the evaluation metrics by running the following command from the src/api folder. +Contoso Creative Writer uses evaluators to assess application response quality. The 4 metrics the evaluators in this project assess are Coherence, Fluency, Relevance and Groundedness. A custom `evaluate.py` script has been written to run all evaulations for you. -Run evaluation: +1. To run the script run the following commands: ```shell cd ./src/api python -m evaluate.evaluate ``` +- Check: You see scores for Coherence, Fluency, Relevance and Groundedness. +- Check: The scores are between 1 and 5 + + +2. To understand what is being evaluated open the `src/api/evaluate/eval_inputs.jsonl` file. + - Observe that 3 examples of research, product and assignment context are stored in this file. This data will be sent to the orchestrator so that each example will have: + - each example will have the evaluations run and will incoperate all of the context, research, products, and final article when grading the response. + + ## Setting up CI/CD with GitHub actions This template is set up to run CI/CD when you push changes to your repo. When CI/CD is configured, evaluations will in GitHub actions and then automatically deploy your app on push to main. @@ -302,8 +308,8 @@ azd pipeline config ### Region Availability -This template uses `gpt-35-turbo-0613`,`gpt-4-1106-Preview` and `gpt-4o-2024-05-13` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly - * We recommend using Canada East +This template uses `gpt-4o` and `gpt-4o-mini` which may not be available in all Azure regions. Check for [up-to-date region availability](https://learn.microsoft.com/azure/ai-services/openai/concepts/models#standard-deployment-model-availability) and select a region during deployment accordingly + * We recommend using Sweden Central ### Costs @@ -322,6 +328,7 @@ This template has either [Managed Identity](https://learn.microsoft.com/entra/id ## Resources * [Prompty Documentation](https://prompty.ai/) +* [Quickstart: Multi-agent applications using Azure OpenAI article](https://learn.microsoft.com/en-us/azure/developer/ai/get-started-multi-agents?tabs=github-codespaces): The Microsoft Learn Quickstart article for this sample, walks through both deployment and the relevant code for orchestrating multi-agents in chat. * [Develop Python apps that use Azure AI services](https://learn.microsoft.com/azure/developer/python/azure-ai-for-python-developers) ## Code of Conduct diff --git a/docs/workshop/lab_setup.py b/docs/workshop/lab_setup.py index 3f1db939..3ca47d48 100755 --- a/docs/workshop/lab_setup.py +++ b/docs/workshop/lab_setup.py @@ -149,7 +149,7 @@ def create_azd_environment(*, azure_env_name: str, subscription: str): # Create new environment if it doesn't exist azd_cmd = [ 'azd', 'env', 'new', azure_env_name, - '--location', 'canadaeast', + '--location', 'swedencentral', '--subscription', subscription ] subprocess.run(azd_cmd, check=True) diff --git a/docs/workshop/researcher/researcher-0.prompty b/docs/workshop/researcher/researcher-0.prompty index 1c649a3d..f269cc15 100644 --- a/docs/workshop/researcher/researcher-0.prompty +++ b/docs/workshop/researcher/researcher-0.prompty @@ -9,8 +9,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview sample: instructions: Can you generate queries to find the latest winter camping trends? Use 'en-US' as the market code. --- diff --git a/docs/workshop/researcher/researcher-1.prompty b/docs/workshop/researcher/researcher-1.prompty index fd75d905..3761d7c1 100644 --- a/docs/workshop/researcher/researcher-1.prompty +++ b/docs/workshop/researcher/researcher-1.prompty @@ -9,8 +9,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview inputs: participant: type: object diff --git a/docs/workshop/researcher/researcher-2.prompty b/docs/workshop/researcher/researcher-2.prompty index 9daf4f4c..e8c576ed 100644 --- a/docs/workshop/researcher/researcher-2.prompty +++ b/docs/workshop/researcher/researcher-2.prompty @@ -9,8 +9,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview parameters: tools: ${file:functions.json} sample: diff --git a/docs/workshop/socialmedia/social.prompty b/docs/workshop/socialmedia/social.prompty index fe900154..1b6f9a0d 100644 --- a/docs/workshop/socialmedia/social.prompty +++ b/docs/workshop/socialmedia/social.prompty @@ -8,7 +8,7 @@ model: configuration: type: azure_openai azure_deployment: gpt-4 - api_version: 2023-07-01-preview + api_version: 2024-08-01-preview parameters: max_tokens: 50 sample: diff --git a/docs/workshop/workshop-1-intro.ipynb b/docs/workshop/workshop-1-intro.ipynb index dc292046..9484e77f 100644 --- a/docs/workshop/workshop-1-intro.ipynb +++ b/docs/workshop/workshop-1-intro.ipynb @@ -72,7 +72,7 @@ " configuration: \n", " type: azure_openai\n", " azure_deployment: gpt-35-turbo\n", - " api_version: 2023-07-01-preview\n", + " api_version: 2024-05-13\n", " sample:\n", " instructions: Can you tell me more about Prompty? \n", " ---\n", diff --git a/infra/ai.yaml b/infra/ai.yaml index 820b17c4..78fda4bb 100644 --- a/infra/ai.yaml +++ b/infra/ai.yaml @@ -1,14 +1,6 @@ # yaml-language-server: $schema=ai.yaml.json deployments: - - name: gpt-35-turbo - model: - format: OpenAI - name: gpt-35-turbo - version: "1106" - sku: - name: Standard - capacity: 20 - name: text-embedding-ada-002 model: format: OpenAI @@ -24,12 +16,12 @@ deployments: version: "2024-05-13" sku: name: "GlobalStandard" - capacity: 19 + capacity: 20 - name: gpt-4-evals model: format: OpenAI - name: gpt-4 - version: "0613" + name: gpt-4o-mini + version: "2024-07-18" sku: name: "Standard" capacity: 8 diff --git a/infra/app/api.bicep b/infra/app/api.bicep index 4ce19910..66d76a8d 100644 --- a/infra/app/api.bicep +++ b/infra/app/api.bicep @@ -7,7 +7,6 @@ param identityId string param containerAppsEnvironmentName string param containerRegistryName string param serviceName string = 'api' -param openAi_35_turbo_DeploymentName string param openAi_4_DeploymentName string param openAi_4_eval_DeploymentName string param openAiEndpoint string @@ -66,10 +65,6 @@ module app '../core/host/container-app-upsert.bicep' = { name: 'AZURE_OPENAI_NAME' value: openAiName } - { - name: 'AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME' - value: openAi_35_turbo_DeploymentName - } { name: 'AZURE_OPENAI_DEPLOYMENT_NAME' value: openAi_4_DeploymentName diff --git a/infra/core/ai/hub.bicep b/infra/core/ai/hub.bicep index c4b95360..1016114e 100644 --- a/infra/core/ai/hub.bicep +++ b/infra/core/ai/hub.bicep @@ -67,7 +67,7 @@ resource hub 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' = isSharedToAll: true target: openAi.properties.endpoints['OpenAI Language Model Instance API'] metadata: { - ApiVersion: '2023-07-01-preview' + ApiVersion: '2024-08-01-preview' ApiType: 'azure' ResourceId: openAi.id } @@ -85,7 +85,7 @@ resource hub 'Microsoft.MachineLearningServices/workspaces@2024-01-01-preview' = isSharedToAll: true target: openAi.properties.endpoints['Content Safety'] metadata: { - ApiVersion: '2023-07-01-preview' + ApiVersion: '2024-08-01-preview' ApiType: 'azure' ResourceId: openAi.id } diff --git a/infra/hooks/postprovision.ps1 b/infra/hooks/postprovision.ps1 index 1f8f3092..bd6180d1 100644 --- a/infra/hooks/postprovision.ps1 +++ b/infra/hooks/postprovision.ps1 @@ -21,8 +21,7 @@ if ([string]::IsNullOrEmpty($resourceGroupName) -or [string]::IsNullOrEmpty($sea # Set additional environment variables expected by app # TODO: Standardize these and remove need for setting here -azd env set AZURE_OPENAI_API_VERSION 2023-03-15-preview -azd env set AZURE_OPENAI_CHAT_DEPLOYMENT gpt-35-turbo +azd env set AZURE_OPENAI_API_VERSION 2024-08-01-preview azd env set AZURE_SEARCH_ENDPOINT $env:AZURE_SEARCH_ENDPOINT azd env set REACT_APP_API_BASE_URL $env:WEB_SERVICE_ACA_URI diff --git a/infra/hooks/postprovision.sh b/infra/hooks/postprovision.sh index 1dc8f956..400f41bb 100755 --- a/infra/hooks/postprovision.sh +++ b/infra/hooks/postprovision.sh @@ -20,8 +20,7 @@ fi # Set additional environment variables expected by app # TODO: Standardize these and remove need for setting here -azd env set AZURE_OPENAI_API_VERSION 2023-03-15-preview -azd env set AZURE_OPENAI_CHAT_DEPLOYMENT gpt-35-turbo +azd env set AZURE_OPENAI_API_VERSION 2024-08-01-preview azd env set AZURE_SEARCH_ENDPOINT $AZURE_SEARCH_ENDPOINT azd env set REACT_APP_API_BASE_URL $WEB_SERVICE_ACA_URI diff --git a/infra/main.bicep b/infra/main.bicep index 04cf6c0b..3163e6b8 100644 --- a/infra/main.bicep +++ b/infra/main.bicep @@ -5,16 +5,7 @@ targetScope = 'subscription' @description('Name which is used to generate a short unique hash for each resource') param environmentName string -@allowed([ - 'canadaeast' - 'eastus' - 'eastus2' - 'northcentralus' - 'southcentralus' - 'swedencentral' - 'westus' - 'westus3' -]) +@allowed(['swedencentral','eastus2','northcentralus','francecentral']) @minLength(1) @description('Primary location for all resources') @metadata({ @@ -22,7 +13,7 @@ param environmentName string type: 'location' } }) -param location string +param location string = 'swedencentral' param containerRegistryName string = '' param aiHubName string = '' @@ -57,7 +48,7 @@ param resourceGroupName string = '' param searchConnectionName string = '' @description('The API version of the OpenAI resource') -param openAiApiVersion string = '2023-07-01-preview' +param openAiApiVersion string = '2024-08-01-preview' @description('The type of the OpenAI resource') param openAiType string = 'azure' @@ -71,10 +62,6 @@ param bingSearchName string = '' @description('The name of the AI search index') param aiSearchIndexName string = 'contoso-products' -@description('The name of the 35 turbo OpenAI deployment') -param openAi_35_turbo_DeploymentName string = 'gpt-35-turbo' - - @description('The name of the 4 OpenAI deployment') param openAi_4_DeploymentName string = 'gpt-4' @@ -181,7 +168,6 @@ module apiContainerApp 'app/api.bicep' = { identityId: managedIdentity.outputs.managedIdentityClientId containerAppsEnvironmentName: containerApps.outputs.environmentName containerRegistryName: containerApps.outputs.registryName - openAi_35_turbo_DeploymentName: !empty(openAi_35_turbo_DeploymentName) ? openAi_35_turbo_DeploymentName : 'gpt-35-turbo' openAi_4_DeploymentName: !empty(openAi_4_DeploymentName) ? openAi_4_DeploymentName : 'gpt-4' openAi_4_eval_DeploymentName: !empty(openAi_4_eval_DeploymentName) ? openAi_4_eval_DeploymentName : 'gpt-4-evals' openAiEmbeddingDeploymentName: openAiEmbeddingDeploymentName @@ -286,7 +272,6 @@ module openaiRoleUser 'core/security/role.bicep' = if (!empty(principalId)) { output AZURE_LOCATION string = location output AZURE_RESOURCE_GROUP string = resourceGroup.name -output AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME string = openAi_35_turbo_DeploymentName output AZURE_OPENAI_DEPLOYMENT_NAME string = openAi_4_DeploymentName output AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME string = openAi_4_eval_DeploymentName output AZURE_OPENAI_API_VERSION string = openAiApiVersion diff --git a/infra/main.parameters.json b/infra/main.parameters.json index 191552f8..d251fb50 100644 --- a/infra/main.parameters.json +++ b/infra/main.parameters.json @@ -15,16 +15,7 @@ "value": "${AZURE_OPENAI_RESOURCE_LOCATION}" }, "openAiApiVersion": { - "value": "${AZURE_OPENAI_API_VERSION=2023-07-01-preview}" - }, - "openAi_35_turbo_DeploymentName": { - "value": "${AZURE_OPENAI_35_TURBO_DEPLOYMENT_NAME=gpt-35-turbo}" - }, - "openAi_35_ModelName": { - "value": "${AZURE_OPENAI_35_MODEL_NAME=gpt-35-turbo}" - }, - "openAi_35_ModelVersion": { - "value": "${AZURE_OPENAI_35_MODEL_VERSION=0613}" + "value": "${AZURE_OPENAI_API_VERSION=2024-08-01-preview}" }, "openAi_4_DeploymentName": { "value": "${AZURE_OPENAI_DEPLOYMENT_NAME=gpt-4}" @@ -39,10 +30,10 @@ "value": "${AZURE_OPENAI_4_EVAL_DEPLOYMENT_NAME=gpt-4-evals}" }, "openAi_4_eval_ModelName": { - "value": "${AZURE_OPENAI_4_EVAL_MODEL_NAME=gpt-4o}" + "value": "${AZURE_OPENAI_4_EVAL_MODEL_NAME=gpt-4o-mini}" }, "openAi_4_eval_ModelVersion": { - "value": "${AZURE_OPENAI_4_EVAL_MODEL_VERSION=2024-05-13}" + "value": "${AZURE_OPENAI_4_EVAL_MODEL_VERSION=2024-07-18}" }, "openAiEmbeddingDeploymentName": { "value": "${AZURE_EMBEDDING_NAME=text-embedding-ada-002}" diff --git a/src/api/agents/editor/editor.prompty b/src/api/agents/editor/editor.prompty index 3c9bc9a6..07acdb68 100644 --- a/src/api/agents/editor/editor.prompty +++ b/src/api/agents/editor/editor.prompty @@ -7,8 +7,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview parameters: max_tokens: 1200 temperature: 0.2 diff --git a/src/api/agents/product/product.prompty b/src/api/agents/product/product.prompty index 7ee5394b..bb84be11 100644 --- a/src/api/agents/product/product.prompty +++ b/src/api/agents/product/product.prompty @@ -7,8 +7,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview parameters: max_tokens: 1500 sample: diff --git a/src/api/agents/product/product.py b/src/api/agents/product/product.py index a86f360b..f844bb33 100644 --- a/src/api/agents/product/product.py +++ b/src/api/agents/product/product.py @@ -15,12 +15,11 @@ QueryCaptionType, QueryAnswerType, ) -from azure.core.credentials import AzureKeyCredential load_dotenv() AZURE_OPENAI_ENDPOINT = os.getenv("AZURE_OPENAI_ENDPOINT") -AZURE_OPENAI_VERSION = "2023-07-01-preview" +AZURE_OPENAI_VERSION = os.getenv("AZURE_OPENAI_API_VERSION") AZURE_OPENAI_DEPLOYMENT = "text-embedding-ada-002" AZURE_AI_SEARCH_ENDPOINT = os.getenv("AI_SEARCH_ENDPOINT") AZURE_AI_SEARCH_INDEX = "contoso-products" diff --git a/src/api/agents/researcher/researcher.prompty b/src/api/agents/researcher/researcher.prompty index d21e50a8..dd159262 100644 --- a/src/api/agents/researcher/researcher.prompty +++ b/src/api/agents/researcher/researcher.prompty @@ -9,8 +9,8 @@ model: api: chat configuration: type: azure_openai - azure_deployment: gpt-35-turbo - api_version: 2023-07-01-preview + azure_deployment: gpt-4 + api_version: 2024-08-01-preview parameters: tools: ${file:functions.json} sample: diff --git a/src/api/agents/writer/writer.prompty b/src/api/agents/writer/writer.prompty index 53529476..9798dde6 100644 --- a/src/api/agents/writer/writer.prompty +++ b/src/api/agents/writer/writer.prompty @@ -8,7 +8,7 @@ model: configuration: type: azure_openai azure_deployment: gpt-4 - api_version: 2023-07-01-preview + api_version: 2024-08-01-preview parameters: max_tokens: 2000 sample: diff --git a/src/api/evaluate/friendliness.prompty b/src/api/evaluate/friendliness.prompty index 619471b6..80e98d72 100644 --- a/src/api/evaluate/friendliness.prompty +++ b/src/api/evaluate/friendliness.prompty @@ -7,7 +7,7 @@ model: api: chat configuration: type: azure_openai - api_version: 2023-07-01-preview + api_version: 2024-08-01-preview azure_deployment: gpt-4-evals parameters: max_tokens: 3000 diff --git a/src/api/prompty.json b/src/api/prompty.json index 676217b1..a6c888cb 100644 --- a/src/api/prompty.json +++ b/src/api/prompty.json @@ -1,7 +1,7 @@ { "default": { "type": "azure", - "api_version": "2023-07-01-preview", + "api_version": "${AZURE_OPENAI_API_VERSION}", "azure_endpoint": "${AZURE_OPENAI_ENDPOINT}", "azure_deployment": "${AZURE_OPENAI_DEPLOYMENT:gpt-4}" }