Skip to content

Commit da3b7a1

Browse files
authored
Update Azure OpenAI to 2024-04-01-preview. (Azure#22798)
Update Azure OpenAI to 2024-04-01-preview. * Fixing some more common throttled areas.
1 parent 968139f commit da3b7a1

File tree

12 files changed

+176
-33
lines changed

12 files changed

+176
-33
lines changed

sdk/ai/azopenai/CHANGELOG.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
# Release History
22

3-
## 0.5.2 (Unreleased)
3+
## 0.5.2 (2024-05-07)
44

55
### Features Added
66

7-
### Breaking Changes
7+
- Updating to the `2024-04-01-preview` API version for Azure OpenAI. (PR#22798)
88

99
### Bugs Fixed
1010

1111
- EventReader can now handle chunks of text larger than 64k. Thank you @ChrisTrenkamp for finding the issue and suggesting a fix. (PR#22703)
1212

13-
### Other Changes
14-
1513
## 0.5.1 (2024-04-02)
1614

1715
### Features Added

sdk/ai/azopenai/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "go",
44
"TagPrefix": "go/ai/azopenai",
5-
"Tag": "go/ai/azopenai_e3045131df"
5+
"Tag": "go/ai/azopenai_d0d55a804a"
66
}

sdk/ai/azopenai/client.go

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/azopenai/client_audio_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,6 @@ func TestClient_GetAudioTranslation(t *testing.T) {
160160

161161
args := newTranslationOptions(azopenai.AudioTranslationFormatVerboseJSON, model, "testdata/sampledata_audiofiles_myVoiceIsMyPassportVerifyMe01.mp3")
162162
transcriptResp, err := client.GetAudioTranslation(context.Background(), args, nil)
163-
require.NoError(t, err)
164163
customRequireNoError(t, err, true)
165164

166165
require.NotEmpty(t, *transcriptResp.Text)

sdk/ai/azopenai/client_rai_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ func TestClient_GetChatCompletions_AzureOpenAI_ContentFilter_WithResponse(t *tes
6262
Temperature: to.Ptr(float32(0.0)),
6363
DeploymentName: &azureOpenAI.ChatCompletionsRAI.Model,
6464
}, nil)
65-
66-
require.NoError(t, err)
65+
customRequireNoError(t, err, true)
6766

6867
require.Equal(t, safeContentFilter, resp.ChatCompletions.Choices[0].ContentFilterResults)
6968
}

sdk/ai/azopenai/client_shared_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,12 @@ func customRequireNoError(t *testing.T, err error, throttlingAllowed bool) {
450450

451451
if throttlingAllowed {
452452
if respErr := (*azcore.ResponseError)(nil); errors.As(err, &respErr) && respErr.StatusCode == http.StatusTooManyRequests {
453-
t.Skip("Skipping test because of throttling")
453+
t.Skip("Skipping test because of throttling (http.StatusTooManyRequests)")
454454
return
455455
}
456456

457457
if errors.Is(err, context.DeadlineExceeded) {
458-
t.Skip("Skipping test because of throttling")
458+
t.Skip("Skipping test because of throttling (DeadlineExceeded)")
459459
return
460460
}
461461
}

sdk/ai/azopenai/constants.go

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/azopenai/custom_client_image_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ func TestImageGeneration_AzureOpenAI(t *testing.T) {
2525
}
2626

2727
client := newTestClient(t, azureOpenAI.DallE.Endpoint)
28-
testImageGeneration(t, client, azureOpenAI.DallE.Model, azopenai.ImageGenerationResponseFormatURL)
28+
testImageGeneration(t, client, azureOpenAI.DallE.Model, azopenai.ImageGenerationResponseFormatURL, true)
2929
}
3030

3131
func TestImageGeneration_OpenAI(t *testing.T) {
3232
client := newTestClient(t, openAI.DallE.Endpoint)
33-
testImageGeneration(t, client, openAI.DallE.Model, azopenai.ImageGenerationResponseFormatURL)
33+
testImageGeneration(t, client, openAI.DallE.Model, azopenai.ImageGenerationResponseFormatURL, false)
3434
}
3535

3636
func TestImageGeneration_AzureOpenAI_WithError(t *testing.T) {
@@ -57,11 +57,11 @@ func TestImageGeneration_OpenAI_Base64(t *testing.T) {
5757
}
5858

5959
client := newTestClient(t, openAI.DallE.Endpoint)
60-
testImageGeneration(t, client, openAI.DallE.Model, azopenai.ImageGenerationResponseFormatBase64)
60+
testImageGeneration(t, client, openAI.DallE.Model, azopenai.ImageGenerationResponseFormatBase64, false)
6161
}
6262

63-
func testImageGeneration(t *testing.T, client *azopenai.Client, model string, responseFormat azopenai.ImageGenerationResponseFormat) {
64-
ctx, cancel := context.WithTimeout(context.Background(), time.Minute)
63+
func testImageGeneration(t *testing.T, client *azopenai.Client, model string, responseFormat azopenai.ImageGenerationResponseFormat, azure bool) {
64+
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute)
6565
defer cancel()
6666

6767
resp, err := client.GetImageGenerations(ctx, azopenai.ImageGenerationOptions{
@@ -72,7 +72,7 @@ func testImageGeneration(t *testing.T, client *azopenai.Client, model string, re
7272
ResponseFormat: &responseFormat,
7373
DeploymentName: &model,
7474
}, nil)
75-
require.NoError(t, err)
75+
customRequireNoError(t, err, azure)
7676

7777
if recording.GetRecordMode() == recording.LiveMode {
7878
switch responseFormat {

sdk/ai/azopenai/models.go

Lines changed: 35 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)