fix: Update Azure OpenAI API versions and improve version selection (#4232)

Update Azure OpenAI API versions and improve version selection

This PR updates the `AZURE_OPENAI_API_VERSIONS` list in the `AzureChatOpenAIComponent` class to include the latest GA and preview versions of the Azure OpenAI API. It also improves the default version selection logic.

Changes:
- Updated `AZURE_OPENAI_API_VERSIONS` list:
  - Added the latest GA version: "2024-06-01"
  - Added recent preview versions: "2024-07-01-preview", "2024-08-01-preview", "2024-09-01-preview", "2024-10-01-preview"
  - Removed older versions that are no longer relevant
  - Reordered the list to prioritize newer versions
- Improved the `api_version` DropdownInput:
  - Now sorts options in reverse chronological order
  - Default value now selects the latest non-preview version, falling back to the first version if all are preview

The updated list now reflects the most current API versions as of the latest documentation update, and the improved selection logic ensures users are presented with the most appropriate default version.
This commit is contained in:
Edwin Jose 2024-10-22 13:24:49 -04:00 committed by GitHub
commit 21bdad0ffb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -16,15 +16,15 @@ class AzureChatOpenAIComponent(LCModelComponent):
name = "AzureOpenAIModel"
AZURE_OPENAI_API_VERSIONS = [
"2023-03-15-preview",
"2024-06-01",
"2024-07-01-preview",
"2024-08-01-preview",
"2024-09-01-preview",
"2024-10-01-preview",
"2023-05-15",
"2023-06-01-preview",
"2023-07-01-preview",
"2023-08-01-preview",
"2023-09-01-preview",
"2023-12-01-preview",
"2024-04-09",
"2024-05-13",
"2024-02-15-preview",
"2024-03-01-preview",
]
inputs = [
@ -40,8 +40,15 @@ class AzureChatOpenAIComponent(LCModelComponent):
DropdownInput(
name="api_version",
display_name="API Version",
options=AZURE_OPENAI_API_VERSIONS,
value=AZURE_OPENAI_API_VERSIONS[-1],
options=sorted(AZURE_OPENAI_API_VERSIONS, reverse=True),
value=next(
(
version
for version in sorted(AZURE_OPENAI_API_VERSIONS, reverse=True)
if not version.endswith("-preview")
),
AZURE_OPENAI_API_VERSIONS[0],
),
),
FloatInput(name="temperature", display_name="Temperature", value=0.7),
IntInput(