Update Azure OpenAI documentation and configurations

* Added instructions on how to set up and use the 'Deployment Name' for Azure AI applications in the documentation.

* Corrected the default chat model from 'gpt-3.5-turbo' to 'gpt-35-turbo' for alignment with Azure's naming conventions.
This commit is contained in:
Mark Pollack
2024-02-22 21:25:42 -05:00
parent b0019f403e
commit 6bcd719761
2 changed files with 31 additions and 2 deletions

View File

@@ -17,6 +17,34 @@ export SPRING_AI_AZURE_OPENAI_API_KEY=<INSERT KEY HERE>
export SPRING_AI_AZURE_OPENAI_ENDPOINT=<INSERT ENDPOINT URL HERE>
----
=== Deployment Name
To use run Azure AI applications, create an Azure AI Deployment through the [Azure AI Portal](https://oai.azure.com/portal).
In Azure, each client must specify a `Deployment Name` to connect to the Azure OpenAI service.
It's essential to understand that the `Deployment Name` is different from the model you choose to deploy
For instance, a deployment named 'MyAiDeployment' could be configured to use either the GPT 3.5 Turbo model or the GPT 4.0 model.
For now, to keep things simple, you can create a deployment using the following settings:
Deployment Name: `gpt-35-turbo`
Model Name: `gpt-35-turbo`
This Azure configuration will align with the default configurations of the Spring Boot Azure AI Starter and its Autoconfiguration feature.
If you use a different Deployment Name, update the configuration property accordingly:
```
spring.ai.azure.openai.chat.options.model=<my deployment name>
```
The different deployment structures of Azure OpenAI and OpenAI leads to a property in the Azure OpenAI client library named `deploymentOrModelName`.
This is because in OpenAI there is no `Deployment Name`, only a `Model Name`.
In a subsequent release, Spring AI will rename the property `spring.ai.azure.openai.chat.options.model` to `spring.ai.azure.openai.chat.options.deployment-name` to avoid confusion.
=== Add Repositories and BOM
Spring AI artifacts are published in Spring Milestone and Snapshot repositories. Refer to the xref:getting-started.adoc#repositories[Repositories] section to add these repositories to your build system.
@@ -67,7 +95,8 @@ The prefix `spring.ai.azure.openai.chat` is the property prefix that configures
|====
| Property | Description | Default
| spring.ai.azure.openai.chat.options.model | * The model name to provide as part of this completions request.
| spring.ai.azure.openai.chat.options.model | * In use with Azure, this actually refers to the "Deployment Name" of your model, which you can find at https://oai.azure.com/portal. 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. To clarify this distinction, we plan to rename this attribute to `deployment-name` in future updates.
Deployments model name to provide as part of this completions request.
| gpt-35-turbo
| 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

View File

@@ -25,7 +25,7 @@ public class AzureOpenAiChatProperties {
public static final String CONFIG_PREFIX = "spring.ai.azure.openai.chat";
public static final String DEFAULT_CHAT_MODEL = "gpt-3.5-turbo";
public static final String DEFAULT_CHAT_MODEL = "gpt-35-turbo";
private static final Double DEFAULT_TEMPERATURE = 0.7;