From 03d1d50130a6013bb478fc026c1816c6bd37abe4 Mon Sep 17 00:00:00 2001 From: Christian Tzolov Date: Mon, 22 Jul 2024 14:51:11 +0200 Subject: [PATCH] Update the Azure OpenAI Chat Model to defult to the gpt-4o --- .../metadata/AzureOpenAiChatModelMetadataTests.java | 4 ++-- .../ROOT/pages/api/chat/azure-openai-chat.adoc | 12 ++++++------ .../azure/openai/AzureOpenAiChatProperties.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/metadata/AzureOpenAiChatModelMetadataTests.java b/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/metadata/AzureOpenAiChatModelMetadataTests.java index 63d231205..a87450103 100644 --- a/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/metadata/AzureOpenAiChatModelMetadataTests.java +++ b/models/spring-ai-azure-openai/src/test/java/org/springframework/ai/azure/openai/metadata/AzureOpenAiChatModelMetadataTests.java @@ -188,7 +188,7 @@ class AzureOpenAiChatModelMetadataTests { @SuppressWarnings("all") static class SpringAzureOpenAiChatCompletionsController { - @PostMapping("/openai/deployments/gpt-35-turbo/chat/completions") + @PostMapping("/openai/deployments/gpt-4o/chat/completions") ResponseEntity chatCompletions(WebRequest request) { String json = getJson(); @@ -207,7 +207,7 @@ class AzureOpenAiChatModelMetadataTests { "id": "chatcmpl-6v7mkQj980V1yBec6ETrKPRqFjNw9", "object": "chat.completion", "created": 1679072642, - "model": "gpt-35-turbo", + "model": "gpt-4o", "choices":[{ "index": 0, "content_filter_results" : { diff --git a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/azure-openai-chat.adoc b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/azure-openai-chat.adoc index 64fc8ddda..e856fc3a4 100644 --- a/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/azure-openai-chat.adoc +++ b/spring-ai-docs/src/main/antora/modules/ROOT/pages/api/chat/azure-openai-chat.adoc @@ -52,8 +52,8 @@ For example, a deployment named 'MyAiDeployment' could be configured to use eith To get started, follow these steps to create a deployment with the default settings: - Deployment Name: `gpt-35-turbo` - Model Name: `gpt-35-turbo` + Deployment Name: `gpt-4o` + Model Name: `gpt-4o` This Azure configuration aligns with the default configurations of the Spring Boot Azure AI Starter and its Autoconfiguration feature. If you use a different Deployment Name, make sure to update the configuration property accordingly: @@ -132,7 +132,7 @@ The prefix `spring.ai.azure.openai.chat` is the property prefix that configures It's important to note that within an Azure OpenAI deployment, the "Deployment Name" is distinct from the model itself. The confusion around these terms stems from the intention to make the Azure OpenAI client library compatible with the original OpenAI endpoint. The deployment structures offered by Azure OpenAI and Sam Altman's OpenAI differ significantly. -Deployments model name to provide as part of this completions request. | gpt-35-turbo +Deployments model name to provide as part of this completions request. | gpt-4o | spring.ai.azure.openai.chat.options.maxTokens | The maximum number of tokens to generate. | - | spring.ai.azure.openai.chat.options.temperature | The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. | 0.7 | spring.ai.azure.openai.chat.options.topP | An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass. | - @@ -225,7 +225,7 @@ Add a `application.properties` file, under the `src/main/resources` directory, t ---- spring.ai.azure.openai.api-key=YOUR_API_KEY spring.ai.azure.openai.endpoint=YOUR_ENDPOINT -spring.ai.azure.openai.chat.options.deployment-name=gpt-35-turbo +spring.ai.azure.openai.chat.options.deployment-name=gpt-4o spring.ai.azure.openai.chat.options.temperature=0.7 ---- @@ -296,7 +296,7 @@ var openAIClient = new OpenAIClientBuilder() .buildClient(); var openAIChatOptions = AzureOpenAiChatOptions.builder() - .withDeploymentName("gpt-35-turbo") + .withDeploymentName("gpt-4o") .withTemperature(0.4f) .withMaxTokens(200) .build(); @@ -312,5 +312,5 @@ Flux response = chatModel.stream( ---- -NOTE: the `gpt-35-turbo` is actually the `Deployment Name` as presented in the Azure AI Portal. +NOTE: the `gpt-4o` is actually the `Deployment Name` as presented in the Azure AI Portal. diff --git a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/azure/openai/AzureOpenAiChatProperties.java b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/azure/openai/AzureOpenAiChatProperties.java index 7e974c1a9..7e0055802 100644 --- a/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/azure/openai/AzureOpenAiChatProperties.java +++ b/spring-ai-spring-boot-autoconfigure/src/main/java/org/springframework/ai/autoconfigure/azure/openai/AzureOpenAiChatProperties.java @@ -24,7 +24,7 @@ public class AzureOpenAiChatProperties { public static final String CONFIG_PREFIX = "spring.ai.azure.openai.chat"; - public static final String DEFAULT_DEPLOYMENT_NAME = "gpt-35-turbo"; + public static final String DEFAULT_DEPLOYMENT_NAME = "gpt-4o"; private static final Double DEFAULT_TEMPERATURE = 0.7;