Skip to content

Commit

Permalink
[azopenai] Inference changes for 2024-10-01-preview (#23672)
Browse files Browse the repository at this point in the history
  • Loading branch information
glecaros authored Nov 12, 2024
1 parent e87686e commit b6d204f
Show file tree
Hide file tree
Showing 27 changed files with 1,977 additions and 793 deletions.
6 changes: 6 additions & 0 deletions sdk/ai/azopenai/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@

### Features Added

- `StreamOptions` parameter added to `ChatCompletionsOptions` and `CompletionsOptions`.
- `MaxCompletionTokens` parameter added to `ChatCompletionsOptions`.
- `ParallelToolCalls` parameter added to `ChatCompletionsOptions`.

### Breaking Changes

- `MongoDBChatExtensionParameters.Authentication`'s type has been changed to a `OnYourDataUsernameAndPasswordAuthenticationOptions`. (PR#23620)
- `GetCompletions` and `GetCompletionsStream` now receive different options (`CompletionsOptions` and `CompletionsStreamOptions` respectively)
- `GetChatCompletions` and `GetChatCompletionsStream` now receive different options (`ChatCompletionsOptions` and `ChatCompletionsStreamOptions` respectively)

### Bugs Fixed

Expand Down
2 changes: 1 addition & 1 deletion sdk/ai/azopenai/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "go",
"TagPrefix": "go/ai/azopenai",
"Tag": "go/ai/azopenai_2bbe5b3db2"
"Tag": "go/ai/azopenai_cb43c9a227"
}
20 changes: 11 additions & 9 deletions sdk/ai/azopenai/autorest.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ directive:
'.+?)runtime\.JoinPaths\\(client\\.endpoint, urlPath\\)',
'gs');
return $.replace(re, "$1client.formatURL(urlPath, getDeployment(body))");
return $.replace(re, "$1client.formatURL(urlPath, body.DeploymentName)");
- from: client.go
where: $
transform: return $.replace(/runtime\.JoinPaths\(client\.endpoint, urlPath\)/g, "client.formatURL(urlPath, nil)");
Expand All @@ -322,14 +322,6 @@ directive:
- from: swagger-document
where: $.paths
transform: delete $["/operations/images/{operationId}"]

# Remove stream property from CompletionsOptions and ChatCompletionsOptions
- from: swagger-document
where: $.definitions["CompletionsOptions"]
transform: delete $.properties.stream;
- from: swagger-document
where: $.definitions["ChatCompletionsOptions"]
transform: delete $.properties.stream;
```
Changes for audio/whisper APIs.
Expand Down Expand Up @@ -904,6 +896,16 @@ directive:
transform: $["x-ms-client-name"] = "ListBatchesPage"; return $;
```
```yaml
directive:
- from: swagger-document
where: $.definitions.ChatCompletionsOptions.properties.stream_options
transform: $["$ref"] = "#/definitions/ChatCompletionStreamOptions"
- from: swagger-document
where: $.definitions.CompletionsOptions.properties.stream_options
transform: $["$ref"] = "#/definitions/ChatCompletionStreamOptions"
```
## Doc updates
Hoisting the description for an anonymous type.
Expand Down
20 changes: 20 additions & 0 deletions sdk/ai/azopenai/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,26 @@
//go:generate go mod tidy
//go:generate goimports -w .

//go:generate pwsh ./testdata/rename_custom_and_tests.ps1
//go:generate go run ./internal/transform/cmd -op rename-method -file client.go -name "(*Client).GetChatCompletions" -new-name getChatCompletions
//go:generate go run ./internal/transform/cmd -op rename-method -file client.go -name "(*Client).GetCompletions" -new-name getCompletions
//go:generate go run ./internal/transform/cmd -op rename-struct -file models.go -name ChatCompletionsOptions -new-name chatCompletionsOptions
//go:generate go run ./internal/transform/cmd -op rename-struct -file models.go -name CompletionsOptions -new-name completionsOptions
//go:generate go run ./internal/transform/cmd -op copy-struct -file models.go -name completionsOptions -new-name CompletionsOptions
//go:generate go run ./internal/transform/cmd -op copy-struct -file models.go -name completionsOptions -new-name CompletionsStreamOptions
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct CompletionsOptions -field Stream
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct CompletionsOptions -field StreamOptions
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct CompletionsStreamOptions -field Stream
//go:generate go run ./internal/transform/cmd -op copy-struct -file models.go -name chatCompletionsOptions -new-name ChatCompletionsOptions
//go:generate go run ./internal/transform/cmd -op copy-struct -file models.go -name chatCompletionsOptions -new-name ChatCompletionsStreamOptions
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct ChatCompletionsOptions -field Stream
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct ChatCompletionsOptions -field StreamOptions
//go:generate go run ./internal/transform/cmd -op remove-field -file models.go -struct ChatCompletionsStreamOptions -field Stream
//go:generate pwsh ./testdata/rename_custom_and_tests.ps1 -Reverse

//go:generate go mod tidy
//go:generate goimports -w .

// running the tests that check that generation went the way we expected to.
//go:go test -v ./internal

Expand Down
Loading

0 comments on commit b6d204f

Please sign in to comment.