Skip to content

Commit

Permalink
[azopenai] prep release (Azure#21612)
Browse files Browse the repository at this point in the history
  • Loading branch information
richardpark-msft authored Sep 26, 2023
1 parent 3299e11 commit aeca1e7
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 148 deletions.
6 changes: 1 addition & 5 deletions sdk/ai/azopenai/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release History

## 0.3.0 (Unreleased)
## 0.3.0 (2023-09-26)

### Features Added
- Support for Whisper audio APIs for transcription and translation using `GetAudioTranscription` and `GetAudioTranslation`.
Expand All @@ -9,10 +9,6 @@
- ChatChoiceContentFilterResults content filtering fields are now all typed as ContentFilterResult, instead of unique types for each field.
- `PromptAnnotations` renamed to `PromptFilterResults` in `ChatCompletions` and `Completions`.

### Bugs Fixed

### Other Changes

## 0.2.0 (2023-08-28)

### Features Added
Expand Down
21 changes: 19 additions & 2 deletions sdk/ai/azopenai/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ directive:
fix($.AudioTranslationOptions.properties.response_format);
fix($.AudioTranslation.properties.task);
- from:
- options.go
- models_serde.go
- models.go
where: $
transform: |
return $
.replace(/AvgLogprob \*float32/g, "AvgLogProb *float32")
.replace(/(a|c)\.AvgLogprob/g, "$1.AvgLogProb")
#
# [END] Whisper
#
Expand Down Expand Up @@ -253,10 +264,16 @@ directive:
where: $
transform: |
return $
// InnerError is actually a recursive type, no need for this innererrorinnererror type
// remove some types that were generated to support the recursive error.
.replace(/\/\/ AzureCoreFoundationsInnerErrorInnererror.+?\n}/s, "")
// also, remove its marshalling functions
.replace(/\/\/ (Unmarshal|Marshal)JSON implements[^\n]+?AzureCoreFoundationsInnerErrorInnererror.+?\n}/sg, "")
.replace(/\/\/ (Unmarshal|Marshal)JSON implements[^\n]+?for type AzureCoreFoundationsInnerErrorInnererror.+?\n}/sg, "")
.replace(/\/\/ AzureCoreFoundationsErrorInnererror.+?\n}/s, "")
.replace(/\/\/ (Unmarshal|Marshal)JSON implements[^\n]+?for type AzureCoreFoundationsErrorInnererror.+?\n}/sg, "")
.replace(/\/\/ AzureCoreFoundationsErrorResponseError.+?\n}/s, "")
.replace(/\/\/ (Unmarshal|Marshal)JSON implements[^\n]+?for type AzureCoreFoundationsErrorResponseError.+?\n}/sg, "")
.replace(/\/\/ AzureCoreFoundationsErrorResponse.+?\n}/s, "")
.replace(/\/\/ (Unmarshal|Marshal)JSON implements[^\n]+?for type AzureCoreFoundationsErrorResponse.+?\n}/sg, "")
// Remove any references to the type and replace them with InnerError.
.replace(/Innererror \*(AzureCoreFoundationsInnerErrorInnererror|AzureCoreFoundationsErrorInnererror)/g, "InnerError *InnerError")
Expand Down
11 changes: 11 additions & 0 deletions sdk/ai/azopenai/client_chat_completions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"context"
"errors"
"io"
"net/http"
"os"
"testing"

Expand Down Expand Up @@ -89,6 +90,11 @@ func testGetChatCompletions(t *testing.T, client *azopenai.Client, tv testVars)
}

resp, err := client.GetChatCompletions(context.Background(), newTestChatCompletionOptions(tv), nil)

if respErr := (*azcore.ResponseError)(nil); errors.As(err, &respErr) && respErr.StatusCode == http.StatusTooManyRequests {
t.Skipf("OpenAI resource overloaded, skipping this test")
}

require.NoError(t, err)

if tv.Endpoint.Azure {
Expand All @@ -111,6 +117,11 @@ func testGetChatCompletions(t *testing.T, client *azopenai.Client, tv testVars)

func testGetChatCompletionsStream(t *testing.T, client *azopenai.Client, tv testVars) {
streamResp, err := client.GetChatCompletionsStream(context.Background(), newTestChatCompletionOptions(tv), nil)

if respErr := (*azcore.ResponseError)(nil); errors.As(err, &respErr) && respErr.StatusCode == http.StatusTooManyRequests {
t.Skipf("OpenAI resource overloaded, skipping this test")
}

require.NoError(t, err)

// the data comes back differently for streaming
Expand Down
38 changes: 2 additions & 36 deletions sdk/ai/azopenai/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

109 changes: 4 additions & 105 deletions sdk/ai/azopenai/models_serde.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit aeca1e7

Please sign in to comment.