Skip to content

Commit

Permalink
CodeGen from PR 24652 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge fc29d6dd3a8f1890ff67340561f2513dea60bd35 into e994b93c82c5d23eb377f35434354438e748cb87
  • Loading branch information
SDKAuto committed Jul 12, 2023
1 parent b2a3869 commit 3f649f8
Show file tree
Hide file tree
Showing 26 changed files with 1,138 additions and 134 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponse(
/**
* Return the embeddings for a given prompt.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the
* relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
* scenarios.
Expand All @@ -282,10 +283,11 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Embeddings> getEmbeddings(String deploymentId, EmbeddingsOptions embeddingsOptions) {
public Mono<Embeddings> getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions) {
// Generated convenience method for getEmbeddingsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getEmbeddingsWithResponse(deploymentId, BinaryData.fromObject(embeddingsOptions), requestOptions)
return getEmbeddingsWithResponse(
deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions)
.flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Embeddings.class));
}
Expand All @@ -294,7 +296,8 @@ public Mono<Embeddings> getEmbeddings(String deploymentId, EmbeddingsOptions emb
* Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text
* that continues from or "completes" provided prompt data.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param completionsOptions The configuration information for a completions request. Completions support a wide
* variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
Expand All @@ -308,10 +311,11 @@ public Mono<Embeddings> getEmbeddings(String deploymentId, EmbeddingsOptions emb
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Completions> getCompletions(String deploymentId, CompletionsOptions completionsOptions) {
public Mono<Completions> getCompletions(String deploymentOrModelName, CompletionsOptions completionsOptions) {
// Generated convenience method for getCompletionsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getCompletionsWithResponse(deploymentId, BinaryData.fromObject(completionsOptions), requestOptions)
return getCompletionsWithResponse(
deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions)
.flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(Completions.class));
}
Expand Down Expand Up @@ -369,7 +373,8 @@ public Flux<Completions> getCompletionsStream(String deploymentId, CompletionsOp
* Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate
* text that continues from or "completes" provided prompt data.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a
* wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
Expand All @@ -384,11 +389,11 @@ public Flux<Completions> getCompletionsStream(String deploymentId, CompletionsOp
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<ChatCompletions> getChatCompletions(
String deploymentId, ChatCompletionsOptions chatCompletionsOptions) {
String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) {
// Generated convenience method for getChatCompletionsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getChatCompletionsWithResponse(
deploymentId, BinaryData.fromObject(chatCompletionsOptions), requestOptions)
deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions)
.flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(ChatCompletions.class));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public Response<BinaryData> getChatCompletionsWithResponse(
/**
* Return the embeddings for a given prompt.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param embeddingsOptions The configuration information for an embeddings request. Embeddings measure the
* relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
* scenarios.
Expand All @@ -277,10 +278,11 @@ public Response<BinaryData> getChatCompletionsWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Embeddings getEmbeddings(String deploymentId, EmbeddingsOptions embeddingsOptions) {
public Embeddings getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions) {
// Generated convenience method for getEmbeddingsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getEmbeddingsWithResponse(deploymentId, BinaryData.fromObject(embeddingsOptions), requestOptions)
return getEmbeddingsWithResponse(
deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions)
.getValue()
.toObject(Embeddings.class);
}
Expand All @@ -289,7 +291,8 @@ public Embeddings getEmbeddings(String deploymentId, EmbeddingsOptions embedding
* Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text
* that continues from or "completes" provided prompt data.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param completionsOptions The configuration information for a completions request. Completions support a wide
* variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
Expand All @@ -303,10 +306,11 @@ public Embeddings getEmbeddings(String deploymentId, EmbeddingsOptions embedding
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Completions getCompletions(String deploymentId, CompletionsOptions completionsOptions) {
public Completions getCompletions(String deploymentOrModelName, CompletionsOptions completionsOptions) {
// Generated convenience method for getCompletionsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getCompletionsWithResponse(deploymentId, BinaryData.fromObject(completionsOptions), requestOptions)
return getCompletionsWithResponse(
deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions)
.getValue()
.toObject(Completions.class);
}
Expand Down Expand Up @@ -365,7 +369,8 @@ public IterableStream<Completions> getCompletionsStream(
* Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate
* text that continues from or "completes" provided prompt data.
*
* @param deploymentId deployment id of the deployed model.
* @param deploymentOrModelName Specifies either the model deployment name (when using Azure OpenAI) or model name
* (when using non-Azure OpenAI) to use for this request.
* @param chatCompletionsOptions The configuration information for a chat completions request. Completions support a
* wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
Expand All @@ -379,11 +384,12 @@ public IterableStream<Completions> getCompletionsStream(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public ChatCompletions getChatCompletions(String deploymentId, ChatCompletionsOptions chatCompletionsOptions) {
public ChatCompletions getChatCompletions(
String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) {
// Generated convenience method for getChatCompletionsWithResponse
RequestOptions requestOptions = new RequestOptions();
return getChatCompletionsWithResponse(
deploymentId, BinaryData.fromObject(chatCompletionsOptions), requestOptions)
deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions)
.getValue()
.toObject(ChatCompletions.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@ public enum OpenAIServiceVersion implements ServiceVersion {
V2023_05_15("2023-05-15"),

/** Enum value 2023-06-01-preview. */
V2023_06_01_PREVIEW("2023-06-01-preview");
V2023_06_01_PREVIEW("2023-06-01-preview"),

/** Enum value 2023-07-01-preview. */
V2023_07_01_PREVIEW("2023-07-01-preview");

private final String version;

Expand All @@ -35,6 +38,6 @@ public String getVersion() {
* @return The latest {@link OpenAIServiceVersion}.
*/
public static OpenAIServiceVersion getLatest() {
return V2023_06_01_PREVIEW;
return V2023_07_01_PREVIEW;
}
}
Loading

0 comments on commit 3f649f8

Please sign in to comment.