From 462249c534f9e6804e5abf4765185bf6a72cce6d Mon Sep 17 00:00:00 2001 From: Peter Dave Hello Date: Sun, 12 May 2024 14:40:35 +0800 Subject: [PATCH] Replace the retiring Azure OpenAI API version with the GA version Reference: - https://learn.microsoft.com/en-us/azure/ai-services/openai/api-version-deprecation#retiring-soon --- README.md | 12 ++++++------ azure/init.go | 2 +- config/config.example.yaml | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 018a230..b9f6b31 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ To successfully make a call against Azure OpenAI, you'll need the following: | Name | Desc | Default | | --------------------- | ------------------------------------------------------------ | ----------------------------- | | AZURE_OPENAI_ENDPOINT | This value can be found in the **Keys & Endpoint** section when examining your resource from the Azure portal. Alternatively, you can find the value in **Azure OpenAI Studio** > **Playground** > **Code View**. An example endpoint is: `https://docs-test-001.openai.azure.com/`. | N | -| AZURE_OPENAI_API_VER | [See here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api) or Azure OpenAI Studio | 2023-07-01-preview | +| AZURE_OPENAI_API_VER | [See here](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/quickstart?tabs=command-line&pivots=rest-api) or Azure OpenAI Studio | 2024-02-01 | | AZURE_OPENAI_MODEL_MAPPER | This value will correspond to the custom name you chose for your deployment when you deployed a model. This value can be found under **Resource Management** > **Deployments** in the Azure portal or alternatively under **Management** > **Deployments** in Azure OpenAI Studio. | N | `AZURE_OPENAI_MODEL_MAPPER` is a mapping from Azure OpenAI deployed model names to official OpenAI model names. You can use commas to separate multiple mappings. @@ -151,7 +151,7 @@ services: AZURE_OPENAI_ENDPOINT: AZURE_OPENAI_MODEL_MAPPER: # AZURE_OPENAI_MODEL_MAPPER: gpt-4=gpt-4,gpt-3.5-turbo=gpt-35-turbo - AZURE_OPENAI_API_VER: 2023-07-01-preview + AZURE_OPENAI_API_VER: "2024-02-01" networks: - chatgpt-ns @@ -203,7 +203,7 @@ services: environment: AZURE_OPENAI_ENDPOINT: AZURE_OPENAI_MODEL_MAPPER: - AZURE_OPENAI_API_VER: 2023-07-01-preview + AZURE_OPENAI_API_VER: "2024-02-01" networks: - chatgpt-ns @@ -231,17 +231,17 @@ deployment_config: model_name: "text-davinci-003" endpoint: "https://xxx-east-us.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" + api_version: "2024-02-01" - deployment_name: "yyy" model_name: "gpt-3.5-turbo" endpoint: "https://yyy.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" + api_version: "2024-02-01" - deployment_name: "zzzz" model_name: "text-embedding-ada-002" endpoint: "https://zzzz.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" + api_version: "2024-02-01" ```` By default, it reads `/config.yaml`, and you can pass the path through the parameter `-c config.yaml`. diff --git a/azure/init.go b/azure/init.go index b128ee4..1a5f851 100644 --- a/azure/init.go +++ b/azure/init.go @@ -33,7 +33,7 @@ func Init() error { openaiModelMapper = viper.GetString(constant.ENV_AZURE_OPENAI_MODEL_MAPPER) if endpoint != "" && openaiModelMapper != "" { if apiVersion == "" { - apiVersion = "2023-07-01-preview" + apiVersion = "2024-02-01" } InitFromEnvironmentVariables(apiVersion, endpoint, openaiModelMapper) } else { diff --git a/config/config.example.yaml b/config/config.example.yaml index 321ac29..4933074 100644 --- a/config/config.example.yaml +++ b/config/config.example.yaml @@ -4,14 +4,14 @@ deployment_config: model_name: "text-davinci-003" endpoint: "https://xxx-east-us.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" + api_version: "2024-02-01" - deployment_name: "yyy" model_name: "gpt-3.5-turbo" endpoint: "https://yyy.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" + api_version: "2024-02-01" - deployment_name: "zzzz" model_name: "text-embedding-ada-002" endpoint: "https://zzzz.openai.azure.com/" api_key: "11111111111" - api_version: "2023-03-15-preview" \ No newline at end of file + api_version: "2024-02-01" \ No newline at end of file