diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 4797a09f9902..fd5d8239a8b9 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-java": "0.10.0" + "@azure-tools/typespec-java": "0.11.1" } } \ No newline at end of file diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java index 72393823a3de..5bb0ecf45448 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIAsyncClient.java @@ -15,6 +15,7 @@ import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIClientImpl; import com.azure.ai.openai.implementation.OpenAIServerSentEvents; +import com.azure.ai.openai.implementation.models.BatchImageGenerationOperationResponse; import com.azure.ai.openai.models.AudioTranscription; import com.azure.ai.openai.models.AudioTranscriptionOptions; import com.azure.ai.openai.models.AudioTranslation; @@ -47,11 +48,14 @@ import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; -/** Initializes a new instance of the asynchronous OpenAIClient type. */ +/** + * Initializes a new instance of the asynchronous OpenAIClient type. + */ @ServiceClient(builder = OpenAIClientBuilder.class, isAsync = true) public final class OpenAIAsyncClient { - @Generated private final OpenAIClientImpl serviceClient; + @Generated + private final OpenAIClientImpl serviceClient; private static final ClientLogger LOGGER = new ClientLogger(OpenAIAsyncClient.class); @@ -84,7 +88,8 @@ public final class OpenAIAsyncClient { /** * Return the embeddings for a given prompt. * - *
Request Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -96,7 +101,8 @@ public final class OpenAIAsyncClient {
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -116,34 +122,34 @@ public final class OpenAIAsyncClient {
* }
*
* @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.
+ * (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.
+ * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
+ * scenarios.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response} on successful completion of {@link Mono}.
+ * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
+ * with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -171,7 +177,8 @@ public Mono> getEmbeddingsWithResponse(
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -209,33 +216,33 @@ public Mono> getEmbeddingsWithResponse(
* }
*
* @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.
+ * (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.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response} on successful completion
- * of {@link Mono}.
+ * that continues from or "completes" provided prompt data along with {@link Response} on successful completion
+ * of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -263,7 +270,8 @@ public Mono> getCompletionsWithResponse(
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -292,32 +300,33 @@ public Mono> getCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return 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 along with {@link Response} on successful
- * completion of {@link Mono}.
+ * text that continues from or "completes" provided prompt data along with {@link Response} on successful
+ * completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -329,7 +338,8 @@ public Mono> getChatCompletionsWithResponse(
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -349,24 +359,24 @@ public Mono> getChatCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
+ * scenarios.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response} on successful completion of {@link Mono}.
+ * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
+ * with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -402,7 +413,8 @@ public Mono> getEmbeddingsWithResponse(
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -440,23 +452,23 @@ public Mono> getEmbeddingsWithResponse(
* }
*
* @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.
+ * (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.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response} on successful completion
- * of {@link Mono}.
+ * that continues from or "completes" provided prompt data along with {@link Response} on successful completion
+ * of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema + *
+ * Request Body Schema * *
{@code
* {
@@ -492,7 +505,8 @@ public Mono> getCompletionsWithResponse(
* }
* }
*
- * Response Body Schema + *
+ * Response Body Schema * *
{@code
* {
@@ -521,25 +535,23 @@ public Mono> getCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return 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 along with {@link Response} on successful
- * completion of {@link Mono}.
+ * text that continues from or "completes" provided prompt data along with {@link Response} on successful
+ * completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public MonoRequest Body Schema - * + *
+ * Request Body Schema + *
*{@code
* {
* prompt: String (Required)
@@ -767,9 +768,9 @@ public Mono getImages(ImageGenerationOptions imageGenerationOptio
* user: String (Optional)
* }
* }
- *
- * Response Body Schema - * + *
+ * Response Body Schema + *
*{@code
* {
* id: String (Required)
@@ -777,7 +778,7 @@ public Mono getImages(ImageGenerationOptions imageGenerationOptio
* expires: Long (Optional)
* result (Optional): {
* created: long (Required)
- * data: DataModelBase (Required)
+ * data: BinaryData (Required)
* }
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): {
@@ -802,24 +803,22 @@ public Mono getImages(ImageGenerationOptions imageGenerationOptio
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the {@link PollerFlux} for polling of a polling status update or final response payload for an image
- * operation.
+ * operation.
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- PollerFlux beginBeginAzureBatchImageGeneration(
- BinaryData imageGenerationOptions, RequestOptions requestOptions) {
- // Convenience API is not generated, as operation 'beginAzureBatchImageGeneration' refers Union 'ImageLocation[]
- // | ImagePayload[]'
+ PollerFlux beginBeginAzureBatchImageGeneration(BinaryData imageGenerationOptions,
+ RequestOptions requestOptions) {
return this.serviceClient.beginBeginAzureBatchImageGenerationAsync(imageGenerationOptions, requestOptions);
}
/**
- * Gets chat completions for the provided chat messages. This is an Azure-specific version of chat completions that
- * supports integration with configured data sources and other augmentations to the base chat completions
- * capabilities.
- *
- * Request Body Schema
- *
+ * Gets chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities.
+ *
+ * Request Body Schema
+ *
* {@code
* {
* messages (Required): [
@@ -845,7 +844,7 @@ PollerFlux beginBeginAzureBatchImageGeneration(
* parameters: Object (Optional)
* }
* ]
- * function_call: FunctionCallModelBase (Optional)
+ * function_call: BinaryData (Optional)
* max_tokens: Integer (Optional)
* temperature: Double (Optional)
* top_p: Double (Optional)
@@ -869,9 +868,9 @@ PollerFlux beginBeginAzureBatchImageGeneration(
* ]
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* id: String (Required)
@@ -933,34 +932,34 @@ PollerFlux beginBeginAzureBatchImageGeneration(
* }
*
* @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.
+ * (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.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return chat completions for the provided chat messages. This is an Azure-specific version of chat completions
- * that supports integration with configured data sources and other augmentations to the base chat completions
- * capabilities along with {@link Response} on successful completion of {@link Mono}.
+ * @return chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities along with {@link Response} on successful
+ * completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Mono> getChatCompletionsWithAzureExtensionsWithResponse(
- String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
- // Convenience API is not generated, as operation 'getChatCompletionsWithAzureExtensions' refers Union
- // 'FunctionCallPreset | FunctionName'
- return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponseAsync(
- deploymentOrModelName, chatCompletionsOptions, requestOptions);
+ Mono> getChatCompletionsWithAzureExtensionsWithResponse(String deploymentOrModelName,
+ BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponseAsync(deploymentOrModelName,
+ chatCompletionsOptions, requestOptions);
}
/**
* Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
* written language corresponding to the language it was spoken in.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -971,9 +970,9 @@ Mono> getChatCompletionsWithAzureExtensionsWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* text: String (Required)
@@ -1000,7 +999,7 @@ Mono> getChatCompletionsWithAzureExtensionsWithResponse(
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1008,16 +1007,16 @@ Mono> getChatCompletionsWithAzureExtensionsWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return transcribed text and associated metadata from provided spoken audio data along with {@link Response} on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Mono> getAudioTranscriptionAsResponseObjectWithResponse(
- String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ Mono> getAudioTranscriptionAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'getAudioTranscriptionAsResponseObject' is 'multipart/form-data'
- return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(
- deploymentOrModelName, audioTranscriptionOptions, requestOptions);
+ return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(deploymentOrModelName,
+ audioTranscriptionOptions, requestOptions);
}
/**
@@ -1025,7 +1024,7 @@ Mono> getAudioTranscriptionAsResponseObjectWithResponse(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1035,13 +1034,13 @@ Mono> getAudioTranscriptionAsResponseObjectWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranscription(
- String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public Mono getAudioTranscription(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
return getAudioTranscriptionWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
- .map(Response::getValue);
+ .map(Response::getValue);
}
/**
@@ -1049,7 +1048,7 @@ public Mono getAudioTranscription(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1060,14 +1059,11 @@ public Mono getAudioTranscription(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranscriptionWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranscriptionOptions audioTranscriptionOptions,
- RequestOptions requestOptions) {
+ public Mono> getAudioTranscriptionWithResponse(String deploymentOrModelName,
+ String fileName, AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions) {
// checking allowed formats for a JSON response
try {
validateAudioResponseFormatForTranscription(audioTranscriptionOptions);
@@ -1082,16 +1078,13 @@ public Mono> getAudioTranscriptionWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Mono> response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(
- deploymentOrModelName, data, requestOptions);
- return response.map(
- responseBinaryData ->
- new SimpleResponse<>(
- responseBinaryData, responseBinaryData.getValue().toObject(AudioTranscription.class)));
+ Mono> response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(deploymentOrModelName,
+ data, requestOptions)
+ : this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponseAsync(deploymentOrModelName, data,
+ requestOptions);
+ return response.map(responseBinaryData -> new SimpleResponse<>(responseBinaryData,
+ responseBinaryData.getValue().toObject(AudioTranscription.class)));
}
/**
@@ -1099,7 +1092,7 @@ public Mono> getAudioTranscriptionWithResponse(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1109,13 +1102,13 @@ public Mono> getAudioTranscriptionWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return transcribed text and associated metadata from provided spoken audio data on successful completion of
- * {@link Mono}.
+ * {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranscriptionText(
- String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public Mono getAudioTranscriptionText(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
return getAudioTranscriptionTextWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
- .map(Response::getValue);
+ .map(Response::getValue);
}
/**
@@ -1123,7 +1116,7 @@ public Mono getAudioTranscriptionText(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1134,14 +1127,11 @@ public Mono getAudioTranscriptionText(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return transcribed text and associated metadata from provided spoken audio file data along with {@link Response}
- * on successful completion of {@link Mono}.
+ * on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranscriptionTextWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranscriptionOptions audioTranscriptionOptions,
- RequestOptions requestOptions) {
+ public Mono> getAudioTranscriptionTextWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions) {
// checking allowed formats for a plain text response
try {
validateAudioResponseFormatForTranscriptionText(audioTranscriptionOptions);
@@ -1156,12 +1146,11 @@ public Mono> getAudioTranscriptionTextWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Mono> response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(
- deploymentOrModelName, data, requestOptions);
+ Mono> response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(deploymentOrModelName, data,
+ requestOptions);
return response.map(dataResponse -> new SimpleResponse<>(dataResponse, dataResponse.getValue().toString()));
}
@@ -1169,7 +1158,7 @@ public Mono> getAudioTranscriptionTextWithResponse(
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1179,20 +1168,20 @@ public Mono> getAudioTranscriptionTextWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken
- * audio file data on successful completion of {@link Mono}.
+ * audio file data on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranslation(
- String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
+ public Mono getAudioTranslation(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions) {
return getAudioTranslationWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
- .map(Response::getValue);
+ .map(Response::getValue);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1203,14 +1192,11 @@ public Mono getAudioTranslation(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken
- * audio file data along with {@link Response} on successful completion of {@link Mono}.
+ * audio file data along with {@link Response} on successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranslationWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranslationOptions audioTranslationOptions,
- RequestOptions requestOptions) {
+ public Mono> getAudioTranslationWithResponse(String deploymentOrModelName,
+ String fileName, AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions) {
// checking allowed formats for a JSON response
try {
validateAudioResponseFormatForTranslation(audioTranslationOptions);
@@ -1225,23 +1211,20 @@ public Mono> getAudioTranslationWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Mono> response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranslationAsResponseObjectWithResponseAsync(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync(
- deploymentOrModelName, data, requestOptions);
- return response.map(
- responseBinaryData ->
- new SimpleResponse<>(
- responseBinaryData, responseBinaryData.getValue().toObject(AudioTranslation.class)));
+ Mono> response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranslationAsResponseObjectWithResponseAsync(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync(deploymentOrModelName, data,
+ requestOptions);
+ return response.map(responseBinaryData -> new SimpleResponse<>(responseBinaryData,
+ responseBinaryData.getValue().toObject(AudioTranslation.class)));
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1251,20 +1234,20 @@ public Mono> getAudioTranslationWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return english language transcribed text and associated metadata from provided spoken audio file data on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranslationText(
- String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
+ public Mono getAudioTranslationText(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions) {
return getAudioTranslationTextWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
- .map(Response::getValue);
+ .map(Response::getValue);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1275,14 +1258,11 @@ public Mono getAudioTranslationText(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return english language transcribed text and associated metadata from provided spoken audio file data on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranslationTextWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranslationOptions audioTranslationOptions,
- RequestOptions requestOptions) {
+ public Mono> getAudioTranslationTextWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions) {
// checking allowed formats for a JSON response
try {
validateAudioResponseFormatForTranslationText(audioTranslationOptions);
@@ -1297,23 +1277,21 @@ public Mono> getAudioTranslationTextWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Mono> response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponseAsync(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync(
- deploymentOrModelName, data, requestOptions);
+ Mono> response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponseAsync(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync(deploymentOrModelName, data,
+ requestOptions);
return response.map(
- responseBinaryData ->
- new SimpleResponse<>(responseBinaryData, responseBinaryData.getValue().toString()));
+ responseBinaryData -> new SimpleResponse<>(responseBinaryData, responseBinaryData.getValue().toString()));
}
/**
* Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
* written language corresponding to the language it was spoken in.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1324,15 +1302,15 @@ public Mono> getAudioTranslationTextWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* String
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1340,21 +1318,21 @@ public Mono> getAudioTranslationTextWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return transcribed text and associated metadata from provided spoken audio data along with {@link Response} on
- * successful completion of {@link Mono}.
+ * successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranscriptionAsPlainTextWithResponse(
- String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
- return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(
- deploymentOrModelName, audioTranscriptionOptions, requestOptions);
+ public Mono> getAudioTranscriptionAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponseAsync(deploymentOrModelName,
+ audioTranscriptionOptions, requestOptions);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio data.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1364,9 +1342,9 @@ public Mono> getAudioTranscriptionAsPlainTextWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* text: String (Required)
@@ -1393,7 +1371,7 @@ public Mono> getAudioTranscriptionAsPlainTextWithResponse(
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1401,23 +1379,23 @@ public Mono> getAudioTranscriptionAsPlainTextWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return english language transcribed text and associated metadata from provided spoken audio data along with
- * {@link Response} on successful completion of {@link Mono}.
+ * {@link Response} on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Mono> getAudioTranslationAsResponseObjectWithResponse(
- String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ Mono> getAudioTranslationAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'getAudioTranslationAsResponseObject' is 'multipart/form-data'
- return this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync(
- deploymentOrModelName, audioTranslationOptions, requestOptions);
+ return this.serviceClient.getAudioTranslationAsResponseObjectWithResponseAsync(deploymentOrModelName,
+ audioTranslationOptions, requestOptions);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio data.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1427,15 +1405,15 @@ Mono> getAudioTranslationAsResponseObjectWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* String
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1443,14 +1421,14 @@ Mono> getAudioTranslationAsResponseObjectWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return english language transcribed text and associated metadata from provided spoken audio data along with
- * {@link Response} on successful completion of {@link Mono}.
+ * {@link Response} on successful completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getAudioTranslationAsPlainTextWithResponse(
- String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) {
- return this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync(
- deploymentOrModelName, audioTranslationOptions, requestOptions);
+ public Mono> getAudioTranslationAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getAudioTranslationAsPlainTextWithResponseAsync(deploymentOrModelName,
+ audioTranslationOptions, requestOptions);
}
/**
@@ -1458,7 +1436,7 @@ public Mono> getAudioTranslationAsPlainTextWithResponse(
* written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1467,17 +1445,16 @@ public Mono> getAudioTranslationAsPlainTextWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return transcribed text and associated metadata from provided spoken audio data on successful completion of
- * {@link Mono}.
+ * {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranscriptionAsPlainText(
- String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public Mono getAudioTranscriptionAsPlainText(String deploymentOrModelName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
// Generated convenience method for getAudioTranscriptionAsPlainTextWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions)
- .flatMap(FluxUtil::toMono)
+ return getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(audioTranscriptionOptions), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(String.class));
}
@@ -1485,7 +1462,7 @@ public Mono getAudioTranscriptionAsPlainText(
* Gets English language transcribed text and associated metadata from provided spoken audio data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1494,17 +1471,70 @@ public Mono getAudioTranscriptionAsPlainText(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return english language transcribed text and associated metadata from provided spoken audio data on successful
- * completion of {@link Mono}.
+ * completion of {@link Mono}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono getAudioTranslationAsPlainText(
- String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) {
+ public Mono getAudioTranslationAsPlainText(String deploymentOrModelName,
+ AudioTranslationOptions audioTranslationOptions) {
// Generated convenience method for getAudioTranslationAsPlainTextWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions)
- .flatMap(FluxUtil::toMono)
+ return getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(audioTranslationOptions), requestOptions).flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(String.class));
}
+
+ /**
+ * Gets chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities.
+ *
+ * @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.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities on successful completion of {@link Mono}.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ Mono getChatCompletionsWithAzureExtensions(String deploymentOrModelName,
+ ChatCompletionsOptions chatCompletionsOptions) {
+ // Generated convenience method for getChatCompletionsWithAzureExtensionsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getChatCompletionsWithAzureExtensionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions).flatMap(FluxUtil::toMono)
+ .map(protocolMethodData -> protocolMethodData.toObject(ChatCompletions.class));
+ }
+
+ /**
+ * Starts the generation of a batch of images from a text caption.
+ *
+ * @param imageGenerationOptions Represents the request data used to generate images.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link PollerFlux} for polling of a polling status update or final response payload for an image
+ * operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ PollerFlux
+ beginBeginAzureBatchImageGeneration(ImageGenerationOptions imageGenerationOptions) {
+ // Generated convenience method for beginBeginAzureBatchImageGenerationWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginBeginAzureBatchImageGenerationWithModelAsync(
+ BinaryData.fromObject(imageGenerationOptions), requestOptions);
+ }
}
diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java
index 7e9e3d8cc174..ee4a52f60126 100644
--- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java
+++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClient.java
@@ -14,6 +14,7 @@
import com.azure.ai.openai.implementation.NonAzureOpenAIClientImpl;
import com.azure.ai.openai.implementation.OpenAIClientImpl;
import com.azure.ai.openai.implementation.OpenAIServerSentEvents;
+import com.azure.ai.openai.implementation.models.BatchImageGenerationOperationResponse;
import com.azure.ai.openai.models.AudioTranscription;
import com.azure.ai.openai.models.AudioTranscriptionOptions;
import com.azure.ai.openai.models.AudioTranslation;
@@ -45,13 +46,16 @@
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
-/** Initializes a new instance of the synchronous OpenAIClient type. */
+/**
+ * Initializes a new instance of the synchronous OpenAIClient type.
+ */
@ServiceClient(builder = OpenAIClientBuilder.class)
public final class OpenAIClient {
private static final ClientLogger LOGGER = new ClientLogger(OpenAIClient.class);
- @Generated private final OpenAIClientImpl serviceClient;
+ @Generated
+ private final OpenAIClientImpl serviceClient;
private final NonAzureOpenAIClientImpl openAIServiceClient;
@@ -78,7 +82,8 @@ public final class OpenAIClient {
/**
* Return the embeddings for a given prompt.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -90,7 +95,8 @@ public final class OpenAIClient {
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -110,33 +116,33 @@ public final class OpenAIClient {
* }
*
* @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.
+ * (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.
+ * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
+ * scenarios.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response}.
+ * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
+ * with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getEmbeddingsWithResponse(
- String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions) {
+ public Response getEmbeddingsWithResponse(String deploymentOrModelName, BinaryData embeddingsOptions,
+ RequestOptions requestOptions) {
return openAIServiceClient != null
- ? openAIServiceClient.getEmbeddingsWithResponse(
- deploymentOrModelName, embeddingsOptions, requestOptions)
- : serviceClient.getEmbeddingsWithResponse(deploymentOrModelName, embeddingsOptions, requestOptions);
+ ? openAIServiceClient.getEmbeddingsWithResponse(deploymentOrModelName, embeddingsOptions, requestOptions)
+ : serviceClient.getEmbeddingsWithResponse(deploymentOrModelName, embeddingsOptions, requestOptions);
}
/**
* 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.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -164,7 +170,8 @@ public Response getEmbeddingsWithResponse(
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -202,31 +209,31 @@ public Response getEmbeddingsWithResponse(
* }
*
* @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.
+ * (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.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response}.
+ * that continues from or "completes" provided prompt data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getCompletionsWithResponse(
- String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) {
+ public Response getCompletionsWithResponse(String deploymentOrModelName, BinaryData completionsOptions,
+ RequestOptions requestOptions) {
return openAIServiceClient != null
- ? openAIServiceClient.getCompletionsWithResponse(
- deploymentOrModelName, completionsOptions, requestOptions)
- : serviceClient.getCompletionsWithResponse(deploymentOrModelName, completionsOptions, requestOptions);
+ ? openAIServiceClient.getCompletionsWithResponse(deploymentOrModelName, completionsOptions, requestOptions)
+ : serviceClient.getCompletionsWithResponse(deploymentOrModelName, completionsOptions, requestOptions);
}
/**
* 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.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -254,7 +261,8 @@ public Response getCompletionsWithResponse(
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -283,31 +291,32 @@ public Response getCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return 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 along with {@link Response}.
+ * text that continues from or "completes" provided prompt data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getChatCompletionsWithResponse(
- String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
+ public Response getChatCompletionsWithResponse(String deploymentOrModelName,
+ BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
return openAIServiceClient != null
- ? openAIServiceClient.getChatCompletionsWithResponse(
- deploymentOrModelName, chatCompletionsOptions, requestOptions)
- : serviceClient.getChatCompletionsWithResponse(
- deploymentOrModelName, chatCompletionsOptions, requestOptions);
+ ? openAIServiceClient.getChatCompletionsWithResponse(deploymentOrModelName, chatCompletionsOptions,
+ requestOptions)
+ : serviceClient.getChatCompletionsWithResponse(deploymentOrModelName, chatCompletionsOptions,
+ requestOptions);
}
/**
* Return the embeddings for a given prompt.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -319,7 +328,8 @@ public Response getChatCompletionsWithResponse(
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -339,25 +349,24 @@ public Response getChatCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * relatedness of text strings and are commonly used for search, clustering, recommendations, and other similar
+ * scenarios.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response}.
+ * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
+ * with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getEmbeddingsWithResponse(
- String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions) {
- Response response =
- getEmbeddingsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions);
+ public Response getEmbeddingsWithResponse(String deploymentOrModelName,
+ EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions) {
+ Response response = getEmbeddingsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(embeddingsOptions), requestOptions);
return new SimpleResponse<>(response, response.getValue().toObject(Embeddings.class));
}
@@ -365,7 +374,8 @@ public Response getEmbeddingsWithResponse(
* 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.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -393,7 +403,8 @@ public Response getEmbeddingsWithResponse(
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -431,23 +442,22 @@ public Response getEmbeddingsWithResponse(
* }
*
* @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.
+ * (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.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response}.
+ * that continues from or "completes" provided prompt data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getCompletionsWithResponse(
- String deploymentOrModelName, CompletionsOptions completionsOptions, RequestOptions requestOptions) {
- Response response =
- getCompletionsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions);
+ public Response getCompletionsWithResponse(String deploymentOrModelName,
+ CompletionsOptions completionsOptions, RequestOptions requestOptions) {
+ Response response = getCompletionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(completionsOptions), requestOptions);
return new SimpleResponse<>(response, response.getValue().toObject(Completions.class));
}
@@ -455,7 +465,8 @@ public Response getCompletionsWithResponse(
* 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.
*
- * Request Body Schema
+ *
+ * Request Body Schema
*
*
{@code
* {
@@ -483,7 +494,8 @@ public Response getCompletionsWithResponse(
* }
* }
*
- * Response Body Schema
+ *
+ * Response Body Schema
*
*
{@code
* {
@@ -512,25 +524,22 @@ public Response getCompletionsWithResponse(
* }
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return 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 along with {@link Response}.
+ * text that continues from or "completes" provided prompt data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getChatCompletionsWithResponse(
- String deploymentOrModelName,
- ChatCompletionsOptions chatCompletionsOptions,
- RequestOptions requestOptions) {
- Response response =
- getChatCompletionsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions);
+ public Response getChatCompletionsWithResponse(String deploymentOrModelName,
+ ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions) {
+ Response response = getChatCompletionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions);
return new SimpleResponse<>(response, response.getValue().toObject(ChatCompletions.class));
}
@@ -538,56 +547,56 @@ public Response getChatCompletionsWithResponse(
* Return the embeddings for a given prompt.
*
* @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.
+ * (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.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios.
+ * @return representation of the response data from an embeddings request.
+ * Embeddings measure the relatedness of text strings and are commonly used for search, clustering,
+ * recommendations, and other similar scenarios.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Embeddings getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions) {
// Generated convenience method for getEmbeddingsWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getEmbeddingsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(embeddingsOptions), requestOptions)
- .getValue()
- .toObject(Embeddings.class);
+ return getEmbeddingsWithResponse(deploymentOrModelName, BinaryData.fromObject(embeddingsOptions),
+ requestOptions).getValue().toObject(Embeddings.class);
}
/**
- * 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.
+ * 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 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.
+ * (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.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
- * @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data.
+ * @return completions for the provided input prompts.
+ * Completions support a wide variety of tasks and generate text that continues from or "completes"
+ * provided prompt data.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
public Completions getCompletions(String deploymentOrModelName, CompletionsOptions completionsOptions) {
// Generated convenience method for getCompletionsWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getCompletionsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions)
- .getValue()
- .toObject(Completions.class);
+ return getCompletionsWithResponse(deploymentOrModelName, BinaryData.fromObject(completionsOptions),
+ requestOptions).getValue().toObject(Completions.class);
}
/**
@@ -595,7 +604,7 @@ public Completions getCompletions(String deploymentOrModelName, CompletionsOptio
* that continues from or "completes" provided prompt data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param prompt The prompt to generate completion text from.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -604,7 +613,7 @@ public Completions getCompletions(String deploymentOrModelName, CompletionsOptio
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data.
+ * that continues from or "completes" provided prompt data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Completions getCompletions(String deploymentOrModelName, String prompt) {
@@ -616,9 +625,9 @@ public Completions getCompletions(String deploymentOrModelName, String prompt) {
* generate text that continues from or "completes" provided prompt data.
*
* @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.
+ * (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.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -626,20 +635,17 @@ public Completions getCompletions(String deploymentOrModelName, String prompt) {
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return an {@link IterableStream} of completions for the provided input prompts. Completions support a wide
- * variety of tasks and generate text that continues from or "completes" provided prompt data.
+ * variety of tasks and generate text that continues from or "completes" provided prompt data.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public IterableStream getCompletionsStream(
- String deploymentOrModelName, CompletionsOptions completionsOptions) {
+ public IterableStream getCompletionsStream(String deploymentOrModelName,
+ CompletionsOptions completionsOptions) {
completionsOptions.setStream(true);
RequestOptions requestOptions = new RequestOptions();
- Flux responseStream =
- getCompletionsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(completionsOptions), requestOptions)
- .getValue()
- .toFluxByteBuffer();
- OpenAIServerSentEvents completionsStream =
- new OpenAIServerSentEvents<>(responseStream, Completions.class);
+ Flux responseStream = getCompletionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(completionsOptions), requestOptions).getValue().toFluxByteBuffer();
+ OpenAIServerSentEvents completionsStream
+ = new OpenAIServerSentEvents<>(responseStream, Completions.class);
return new IterableStream<>(completionsStream.getEvents());
}
@@ -648,9 +654,9 @@ public IterableStream getCompletionsStream(
* text that continues from or "completes" provided prompt data.
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -658,19 +664,18 @@ public IterableStream getCompletionsStream(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return 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.
+ * text that continues from or "completes" provided prompt data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public ChatCompletions getChatCompletions(
- String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) {
+ public ChatCompletions getChatCompletions(String deploymentOrModelName,
+ ChatCompletionsOptions chatCompletionsOptions) {
RequestOptions requestOptions = new RequestOptions();
if (chatCompletionsOptions.getDataSources() == null || chatCompletionsOptions.getDataSources().isEmpty()) {
return getChatCompletionsWithResponse(deploymentOrModelName, chatCompletionsOptions, requestOptions)
- .getValue();
+ .getValue();
} else {
- return getChatCompletionsWithAzureExtensionsWithResponse(
- deploymentOrModelName, BinaryData.fromObject(chatCompletionsOptions), requestOptions)
- .getValue()
+ return getChatCompletionsWithAzureExtensionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions).getValue()
.toObject(ChatCompletions.class);
}
}
@@ -680,9 +685,9 @@ public ChatCompletions getChatCompletions(
* generate text that continues from or "completes" provided prompt data.
*
* @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.
+ * (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.
+ * wide variety of tasks and generate text that continues from or "completes" provided prompt data.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
@@ -690,33 +695,23 @@ public ChatCompletions getChatCompletions(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return chat completions stream for the provided chat messages. Completions support a wide variety of tasks and
- * generate text that continues from or "completes" provided prompt data.
+ * generate text that continues from or "completes" provided prompt data.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
- public IterableStream getChatCompletionsStream(
- String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions) {
+ public IterableStream getChatCompletionsStream(String deploymentOrModelName,
+ ChatCompletionsOptions chatCompletionsOptions) {
chatCompletionsOptions.setStream(true);
RequestOptions requestOptions = new RequestOptions();
Flux responseStream;
if (chatCompletionsOptions.getDataSources() == null || chatCompletionsOptions.getDataSources().isEmpty()) {
- responseStream =
- getChatCompletionsWithResponse(
- deploymentOrModelName,
- BinaryData.fromObject(chatCompletionsOptions),
- requestOptions)
- .getValue()
- .toFluxByteBuffer();
+ responseStream = getChatCompletionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions).getValue().toFluxByteBuffer();
} else {
- responseStream =
- getChatCompletionsWithAzureExtensionsWithResponse(
- deploymentOrModelName,
- BinaryData.fromObject(chatCompletionsOptions),
- requestOptions)
- .getValue()
- .toFluxByteBuffer();
+ responseStream = getChatCompletionsWithAzureExtensionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions).getValue().toFluxByteBuffer();
}
- OpenAIServerSentEvents chatCompletionsStream =
- new OpenAIServerSentEvents<>(responseStream, ChatCompletions.class);
+ OpenAIServerSentEvents chatCompletionsStream
+ = new OpenAIServerSentEvents<>(responseStream, ChatCompletions.class);
return new IterableStream<>(chatCompletionsStream.getEvents());
}
@@ -737,23 +732,19 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) {
RequestOptions requestOptions = new RequestOptions();
BinaryData imageGenerationOptionsBinaryData = BinaryData.fromObject(imageGenerationOptions);
if (openAIServiceClient != null) {
- return openAIServiceClient
- .generateImageWithResponse(imageGenerationOptionsBinaryData, requestOptions)
- .getValue()
- .toObject(ImageResponse.class);
+ return openAIServiceClient.generateImageWithResponse(imageGenerationOptionsBinaryData, requestOptions)
+ .getValue().toObject(ImageResponse.class);
} else {
return beginBeginAzureBatchImageGeneration(imageGenerationOptionsBinaryData, requestOptions)
- .getFinalResult()
- .toObject(ImageOperationResponse.class)
- .getResult();
+ .getFinalResult().toObject(ImageOperationResponse.class).getResult();
}
}
/**
* Starts the generation of a batch of images from a text caption.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* prompt: String (Required)
@@ -763,9 +754,9 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) {
* user: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* id: String (Required)
@@ -773,7 +764,7 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) {
* expires: Long (Optional)
* result (Optional): {
* created: long (Required)
- * data: DataModelBase (Required)
+ * data: BinaryData (Required)
* }
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): {
@@ -798,24 +789,22 @@ public ImageResponse getImages(ImageGenerationOptions imageGenerationOptions) {
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return the {@link SyncPoller} for polling of a polling status update or final response payload for an image
- * operation.
+ * operation.
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
- SyncPoller beginBeginAzureBatchImageGeneration(
- BinaryData imageGenerationOptions, RequestOptions requestOptions) {
- // Convenience API is not generated, as operation 'beginAzureBatchImageGeneration' refers Union 'ImageLocation[]
- // | ImagePayload[]'
+ SyncPoller beginBeginAzureBatchImageGeneration(BinaryData imageGenerationOptions,
+ RequestOptions requestOptions) {
return this.serviceClient.beginBeginAzureBatchImageGeneration(imageGenerationOptions, requestOptions);
}
/**
- * Gets chat completions for the provided chat messages. This is an Azure-specific version of chat completions that
- * supports integration with configured data sources and other augmentations to the base chat completions
- * capabilities.
- *
- * Request Body Schema
- *
+ * Gets chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities.
+ *
+ * Request Body Schema
+ *
* {@code
* {
* messages (Required): [
@@ -841,7 +830,7 @@ SyncPoller beginBeginAzureBatchImageGeneration(
* parameters: Object (Optional)
* }
* ]
- * function_call: FunctionCallModelBase (Optional)
+ * function_call: BinaryData (Optional)
* max_tokens: Integer (Optional)
* temperature: Double (Optional)
* top_p: Double (Optional)
@@ -865,9 +854,9 @@ SyncPoller beginBeginAzureBatchImageGeneration(
* ]
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* id: String (Required)
@@ -929,26 +918,25 @@ SyncPoller beginBeginAzureBatchImageGeneration(
* }
*
* @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.
+ * (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.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return chat completions for the provided chat messages. This is an Azure-specific version of chat completions
- * that supports integration with configured data sources and other augmentations to the base chat completions
- * capabilities along with {@link Response}.
+ * @return chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities along with {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Response getChatCompletionsWithAzureExtensionsWithResponse(
- String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
- // Convenience API is not generated, as operation 'getChatCompletionsWithAzureExtensions' refers Union
- // 'FunctionCallPreset | FunctionName'
- return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponse(
- deploymentOrModelName, chatCompletionsOptions, requestOptions);
+ Response getChatCompletionsWithAzureExtensionsWithResponse(String deploymentOrModelName,
+ BinaryData chatCompletionsOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getChatCompletionsWithAzureExtensionsWithResponse(deploymentOrModelName,
+ chatCompletionsOptions, requestOptions);
}
/**
@@ -956,7 +944,7 @@ Response getChatCompletionsWithAzureExtensionsWithResponse(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -968,10 +956,10 @@ Response getChatCompletionsWithAzureExtensionsWithResponse(
* @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public AudioTranscription getAudioTranscription(
- String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public AudioTranscription getAudioTranscription(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
return getAudioTranscriptionWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
- .getValue();
+ .getValue();
}
/**
@@ -979,7 +967,7 @@ public AudioTranscription getAudioTranscription(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -990,14 +978,11 @@ public AudioTranscription getAudioTranscription(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranscription} transcribed text and associated metadata from provided spoken audio data along
- * with {@link Response}.
+ * with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranscriptionWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranscriptionOptions audioTranscriptionOptions,
- RequestOptions requestOptions) {
+ public Response getAudioTranscriptionWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions) {
// checking allowed formats for a JSON response
validateAudioResponseFormatForTranscription(audioTranscriptionOptions);
// embedding the `model` in the request for non-Azure case
@@ -1008,12 +993,11 @@ public Response getAudioTranscriptionWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Response response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions);
+ Response response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions);
return new SimpleResponse<>(response, response.getValue().toObject(AudioTranscription.class));
}
@@ -1022,7 +1006,7 @@ public Response getAudioTranscriptionWithResponse(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1034,10 +1018,10 @@ public Response getAudioTranscriptionWithResponse(
* @return transcribed text and associated metadata from provided spoken audio data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public String getAudioTranscriptionText(
- String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public String getAudioTranscriptionText(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
return getAudioTranscriptionTextWithResponse(deploymentOrModelName, fileName, audioTranscriptionOptions, null)
- .getValue();
+ .getValue();
}
/**
@@ -1045,7 +1029,7 @@ public String getAudioTranscriptionText(
* the written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranscriptionOptions}.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1058,11 +1042,8 @@ public String getAudioTranscriptionText(
* @return transcribed text and associated metadata from provided spoken audio data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranscriptionTextWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranscriptionOptions audioTranscriptionOptions,
- RequestOptions requestOptions) {
+ public Response getAudioTranscriptionTextWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions) {
// checking allowed formats for a plain text response
validateAudioResponseFormatForTranscriptionText(audioTranscriptionOptions);
// embedding the `model` in the request for non-Azure case
@@ -1073,12 +1054,11 @@ public Response getAudioTranscriptionTextWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranscriptionOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Response response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions);
+ Response response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions);
return new SimpleResponse<>(response, response.getValue().toString());
}
@@ -1086,7 +1066,7 @@ public Response getAudioTranscriptionTextWithResponse(
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1096,20 +1076,20 @@ public Response getAudioTranscriptionTextWithResponse(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranscription} english language transcribed text and associated metadata from provided spoken
- * audio file data.
+ * audio file data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public AudioTranslation getAudioTranslation(
- String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
+ public AudioTranslation getAudioTranslation(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions) {
return getAudioTranslationWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
- .getValue();
+ .getValue();
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1120,14 +1100,11 @@ public AudioTranslation getAudioTranslation(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return {@link AudioTranslation} english language transcribed text and associated metadata from provided spoken
- * audio file data along with {@link Response}.
+ * audio file data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranslationWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranslationOptions audioTranslationOptions,
- RequestOptions requestOptions) {
+ public Response getAudioTranslationWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions) {
// checking allowed formats for a JSON response
validateAudioResponseFormatForTranslation(audioTranslationOptions);
// embedding the `model` in the request for non-Azure case
@@ -1138,12 +1115,11 @@ public Response getAudioTranslationWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Response response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions);
+ Response response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions);
return new SimpleResponse<>(response, response.getValue().toObject(AudioTranslation.class));
}
@@ -1151,7 +1127,7 @@ public Response getAudioTranslationWithResponse(
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
@@ -1163,17 +1139,17 @@ public Response getAudioTranslationWithResponse(
* @return english language transcribed text and associated metadata from provided spoken audio file data.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public String getAudioTranslationText(
- String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions) {
+ public String getAudioTranslationText(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions) {
return getAudioTranslationTextWithResponse(deploymentOrModelName, fileName, audioTranslationOptions, null)
- .getValue();
+ .getValue();
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio file data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param fileName The file name that is represented in the {@code file} field of {@link AudioTranslationOptions}.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
@@ -1184,14 +1160,11 @@ public String getAudioTranslationText(
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return english language transcribed text and associated metadata from provided spoken audio file data along with
- * {@link Response}.
+ * {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranslationTextWithResponse(
- String deploymentOrModelName,
- String fileName,
- AudioTranslationOptions audioTranslationOptions,
- RequestOptions requestOptions) {
+ public Response getAudioTranslationTextWithResponse(String deploymentOrModelName, String fileName,
+ AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions) {
// checking allowed formats for a plain text response
validateAudioResponseFormatForTranslationText(audioTranslationOptions);
// embedding the `model` in the request for non-Azure case
@@ -1202,21 +1175,20 @@ public Response getAudioTranslationTextWithResponse(
final MultipartDataSerializationResult result = helper.serializeRequest(audioTranslationOptions, fileName);
final BinaryData data = result.getData();
requestOptions = helper.getRequestOptionsForMultipartFormData(requestOptions, result, helper.getBoundary());
- Response response =
- openAIServiceClient != null
- ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions)
- : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, data, requestOptions);
+ Response response = openAIServiceClient != null
+ ? this.openAIServiceClient.getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions)
+ : this.serviceClient.getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName, data,
+ requestOptions);
return new SimpleResponse<>(response, response.getValue().toString());
}
/**
* Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
* written language corresponding to the language it was spoken in.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1227,9 +1199,9 @@ public Response getAudioTranslationTextWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* text: String (Required)
@@ -1256,7 +1228,7 @@ public Response getAudioTranslationTextWithResponse(
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1267,20 +1239,20 @@ public Response getAudioTranslationTextWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Response getAudioTranscriptionAsResponseObjectWithResponse(
- String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ Response getAudioTranscriptionAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'getAudioTranscriptionAsResponseObject' is 'multipart/form-data'
- return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponse(
- deploymentOrModelName, audioTranscriptionOptions, requestOptions);
+ return this.serviceClient.getAudioTranscriptionAsResponseObjectWithResponse(deploymentOrModelName,
+ audioTranscriptionOptions, requestOptions);
}
/**
* Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
* written language corresponding to the language it was spoken in.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1291,15 +1263,15 @@ Response getAudioTranscriptionAsResponseObjectWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* String
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1310,17 +1282,17 @@ Response getAudioTranscriptionAsResponseObjectWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranscriptionAsPlainTextWithResponse(
- String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
- return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, audioTranscriptionOptions, requestOptions);
+ public Response getAudioTranscriptionAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName,
+ audioTranscriptionOptions, requestOptions);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio data.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1330,9 +1302,9 @@ public Response getAudioTranscriptionAsPlainTextWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
* text: String (Required)
@@ -1359,7 +1331,7 @@ public Response getAudioTranscriptionAsPlainTextWithResponse(
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1367,23 +1339,23 @@ public Response getAudioTranscriptionAsPlainTextWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return english language transcribed text and associated metadata from provided spoken audio data along with
- * {@link Response}.
+ * {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- Response getAudioTranslationAsResponseObjectWithResponse(
- String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ Response getAudioTranslationAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
// Protocol API requires serialization of parts with content-disposition and data, as operation
// 'getAudioTranslationAsResponseObject' is 'multipart/form-data'
- return this.serviceClient.getAudioTranslationAsResponseObjectWithResponse(
- deploymentOrModelName, audioTranslationOptions, requestOptions);
+ return this.serviceClient.getAudioTranslationAsResponseObjectWithResponse(deploymentOrModelName,
+ audioTranslationOptions, requestOptions);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio data.
- *
- * Request Body Schema
- *
+ *
+ * Request Body Schema
+ *
* {@code
* {
* file: byte[] (Required)
@@ -1393,15 +1365,15 @@ Response getAudioTranslationAsResponseObjectWithResponse(
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* String
* }
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1409,14 +1381,14 @@ Response getAudioTranslationAsResponseObjectWithResponse(
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @return english language transcribed text and associated metadata from provided spoken audio data along with
- * {@link Response}.
+ * {@link Response}.
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getAudioTranslationAsPlainTextWithResponse(
- String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) {
- return this.serviceClient.getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, audioTranslationOptions, requestOptions);
+ public Response getAudioTranslationAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ return this.serviceClient.getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName,
+ audioTranslationOptions, requestOptions);
}
/**
@@ -1424,7 +1396,7 @@ public Response getAudioTranslationAsPlainTextWithResponse(
* written language corresponding to the language it was spoken in.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1436,21 +1408,19 @@ public Response getAudioTranslationAsPlainTextWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public String getAudioTranscriptionAsPlainText(
- String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions) {
+ public String getAudioTranscriptionAsPlainText(String deploymentOrModelName,
+ AudioTranscriptionOptions audioTranscriptionOptions) {
// Generated convenience method for getAudioTranscriptionAsPlainTextWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getAudioTranscriptionAsPlainTextWithResponse(
- deploymentOrModelName, BinaryData.fromObject(audioTranscriptionOptions), requestOptions)
- .getValue()
- .toObject(String.class);
+ return getAudioTranscriptionAsPlainTextWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(audioTranscriptionOptions), requestOptions).getValue().toObject(String.class);
}
/**
* Gets English language transcribed text and associated metadata from provided spoken audio data.
*
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
* @param audioTranslationOptions The configuration information for an audio translation request.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
@@ -1462,13 +1432,64 @@ public String getAudioTranscriptionAsPlainText(
*/
@Generated
@ServiceMethod(returns = ReturnType.SINGLE)
- public String getAudioTranslationAsPlainText(
- String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions) {
+ public String getAudioTranslationAsPlainText(String deploymentOrModelName,
+ AudioTranslationOptions audioTranslationOptions) {
// Generated convenience method for getAudioTranslationAsPlainTextWithResponse
RequestOptions requestOptions = new RequestOptions();
- return getAudioTranslationAsPlainTextWithResponse(
- deploymentOrModelName, BinaryData.fromObject(audioTranslationOptions), requestOptions)
- .getValue()
- .toObject(String.class);
+ return getAudioTranslationAsPlainTextWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(audioTranslationOptions), requestOptions).getValue().toObject(String.class);
+ }
+
+ /**
+ * Gets chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities.
+ *
+ * @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.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return chat completions for the provided chat messages.
+ * This is an Azure-specific version of chat completions that supports integration with configured data sources and
+ * other augmentations to the base chat completions capabilities.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ ChatCompletions getChatCompletionsWithAzureExtensions(String deploymentOrModelName,
+ ChatCompletionsOptions chatCompletionsOptions) {
+ // Generated convenience method for getChatCompletionsWithAzureExtensionsWithResponse
+ RequestOptions requestOptions = new RequestOptions();
+ return getChatCompletionsWithAzureExtensionsWithResponse(deploymentOrModelName,
+ BinaryData.fromObject(chatCompletionsOptions), requestOptions).getValue().toObject(ChatCompletions.class);
+ }
+
+ /**
+ * Starts the generation of a batch of images from a text caption.
+ *
+ * @param imageGenerationOptions Represents the request data used to generate images.
+ * @throws IllegalArgumentException thrown if parameters fail the validation.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
+ * @return the {@link SyncPoller} for polling of a polling status update or final response payload for an image
+ * operation.
+ */
+ @Generated
+ @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
+ SyncPoller
+ beginBeginAzureBatchImageGeneration(ImageGenerationOptions imageGenerationOptions) {
+ // Generated convenience method for beginBeginAzureBatchImageGenerationWithModel
+ RequestOptions requestOptions = new RequestOptions();
+ return serviceClient.beginBeginAzureBatchImageGenerationWithModel(BinaryData.fromObject(imageGenerationOptions),
+ requestOptions);
}
}
diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java
index 4ec8a75131c2..2ab76b509fc2 100644
--- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java
+++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIClientBuilder.java
@@ -46,28 +46,32 @@
import java.util.Map;
import java.util.Objects;
-/** A builder for creating a new instance of the OpenAIClient type. */
-@ServiceClientBuilder(serviceClients = {OpenAIClient.class, OpenAIAsyncClient.class})
-public final class OpenAIClientBuilder
- implements HttpTrait,
- ConfigurationTrait,
- TokenCredentialTrait,
- KeyCredentialTrait,
- EndpointTrait {
+/**
+ * A builder for creating a new instance of the OpenAIClient type.
+ */
+@ServiceClientBuilder(serviceClients = { OpenAIClient.class, OpenAIAsyncClient.class })
+public final class OpenAIClientBuilder implements HttpTrait,
+ ConfigurationTrait, TokenCredentialTrait,
+ KeyCredentialTrait, EndpointTrait {
- @Generated private static final String SDK_NAME = "name";
+ @Generated
+ private static final String SDK_NAME = "name";
- @Generated private static final String SDK_VERSION = "version";
+ @Generated
+ private static final String SDK_VERSION = "version";
@Generated
- private static final String[] DEFAULT_SCOPES = new String[] {"https://cognitiveservices.azure.com/.default"};
+ private static final String[] DEFAULT_SCOPES = new String[] { "https://cognitiveservices.azure.com/.default" };
@Generated
private static final Map PROPERTIES = CoreUtils.getProperties("azure-ai-openai.properties");
- @Generated private final List pipelinePolicies;
+ @Generated
+ private final List pipelinePolicies;
- /** Create an instance of the OpenAIClientBuilder. */
+ /**
+ * Create an instance of the OpenAIClientBuilder.
+ */
@Generated
public OpenAIClientBuilder() {
this.pipelinePolicies = new ArrayList<>();
@@ -76,9 +80,12 @@ public OpenAIClientBuilder() {
/*
* The HTTP pipeline to send requests through.
*/
- @Generated private HttpPipeline pipeline;
+ @Generated
+ private HttpPipeline pipeline;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder pipeline(HttpPipeline pipeline) {
@@ -92,9 +99,12 @@ public OpenAIClientBuilder pipeline(HttpPipeline pipeline) {
/*
* The HTTP client used to send the request.
*/
- @Generated private HttpClient httpClient;
+ @Generated
+ private HttpClient httpClient;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder httpClient(HttpClient httpClient) {
@@ -105,9 +115,12 @@ public OpenAIClientBuilder httpClient(HttpClient httpClient) {
/*
* The logging configuration for HTTP requests and responses.
*/
- @Generated private HttpLogOptions httpLogOptions;
+ @Generated
+ private HttpLogOptions httpLogOptions;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
@@ -118,9 +131,12 @@ public OpenAIClientBuilder httpLogOptions(HttpLogOptions httpLogOptions) {
/*
* The client options such as application ID and custom headers to set on a request.
*/
- @Generated private ClientOptions clientOptions;
+ @Generated
+ private ClientOptions clientOptions;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder clientOptions(ClientOptions clientOptions) {
@@ -131,9 +147,12 @@ public OpenAIClientBuilder clientOptions(ClientOptions clientOptions) {
/*
* The retry options to configure retry policy for failed requests.
*/
- @Generated private RetryOptions retryOptions;
+ @Generated
+ private RetryOptions retryOptions;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder retryOptions(RetryOptions retryOptions) {
@@ -141,7 +160,9 @@ public OpenAIClientBuilder retryOptions(RetryOptions retryOptions) {
return this;
}
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
@@ -153,9 +174,12 @@ public OpenAIClientBuilder addPolicy(HttpPipelinePolicy customPolicy) {
/*
* The configuration store that is used during construction of the service client.
*/
- @Generated private Configuration configuration;
+ @Generated
+ private Configuration configuration;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder configuration(Configuration configuration) {
@@ -166,9 +190,12 @@ public OpenAIClientBuilder configuration(Configuration configuration) {
/*
* The TokenCredential used for authentication.
*/
- @Generated private TokenCredential tokenCredential;
+ @Generated
+ private TokenCredential tokenCredential;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder credential(TokenCredential tokenCredential) {
@@ -176,10 +203,14 @@ public OpenAIClientBuilder credential(TokenCredential tokenCredential) {
return this;
}
- /** The KeyCredential used for OpenAi authentication. It could be either of Azure or Non-Azure OpenAI API key. */
+ /**
+ * The KeyCredential used for OpenAi authentication. It could be either of Azure or Non-Azure OpenAI API key.
+ */
private KeyCredential keyCredential;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder credential(KeyCredential keyCredential) {
@@ -190,9 +221,12 @@ public OpenAIClientBuilder credential(KeyCredential keyCredential) {
/*
* The service endpoint
*/
- @Generated private String endpoint;
+ @Generated
+ private String endpoint;
- /** {@inheritDoc}. */
+ /**
+ * {@inheritDoc}.
+ */
@Generated
@Override
public OpenAIClientBuilder endpoint(String endpoint) {
@@ -203,7 +237,8 @@ public OpenAIClientBuilder endpoint(String endpoint) {
/*
* Service version
*/
- @Generated private OpenAIServiceVersion serviceVersion;
+ @Generated
+ private OpenAIServiceVersion serviceVersion;
/**
* Sets Service version.
@@ -220,7 +255,8 @@ public OpenAIClientBuilder serviceVersion(OpenAIServiceVersion serviceVersion) {
/*
* The retry policy that will attempt to retry failed requests, if applicable.
*/
- @Generated private RetryPolicy retryPolicy;
+ @Generated
+ private RetryPolicy retryPolicy;
/**
* Sets The retry policy that will attempt to retry failed requests, if applicable.
@@ -242,20 +278,16 @@ public OpenAIClientBuilder retryPolicy(RetryPolicy retryPolicy) {
@Generated
private OpenAIClientImpl buildInnerClient() {
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
- OpenAIServiceVersion localServiceVersion =
- (serviceVersion != null) ? serviceVersion : OpenAIServiceVersion.getLatest();
- OpenAIClientImpl client =
- new OpenAIClientImpl(
- localPipeline,
- JacksonAdapter.createDefaultSerializerAdapter(),
- this.endpoint,
- localServiceVersion);
+ OpenAIServiceVersion localServiceVersion
+ = (serviceVersion != null) ? serviceVersion : OpenAIServiceVersion.getLatest();
+ OpenAIClientImpl client = new OpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter(),
+ this.endpoint, localServiceVersion);
return client;
}
private HttpPipeline createHttpPipeline() {
- Configuration buildConfiguration =
- (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
+ Configuration buildConfiguration
+ = (configuration == null) ? Configuration.getGlobalConfiguration() : configuration;
HttpLogOptions localHttpLogOptions = this.httpLogOptions == null ? new HttpLogOptions() : this.httpLogOptions;
ClientOptions localClientOptions = this.clientOptions == null ? new ClientOptions() : this.clientOptions;
List policies = new ArrayList<>();
@@ -270,40 +302,32 @@ private HttpPipeline createHttpPipeline() {
if (headers.getSize() > 0) {
policies.add(new AddHeadersPolicy(headers));
}
- this.pipelinePolicies.stream()
- .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
- .forEach(p -> policies.add(p));
+ this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_CALL)
+ .forEach(p -> policies.add(p));
HttpPolicyProviders.addBeforeRetryPolicies(policies);
policies.add(ClientBuilderUtil.validateAndGetRetryPolicy(retryPolicy, retryOptions, new RetryPolicy()));
policies.add(new AddDatePolicy());
policies.add(new CookiePolicy());
if (keyCredential != null) {
- policies.add(
- useNonAzureOpenAIService()
- ? new KeyCredentialPolicy("Authorization", keyCredential, "Bearer")
- : new KeyCredentialPolicy("api-key", keyCredential));
+ policies.add(useNonAzureOpenAIService() ? new KeyCredentialPolicy("Authorization", keyCredential, "Bearer")
+ : new KeyCredentialPolicy("api-key", keyCredential));
}
if (tokenCredential != null) {
policies.add(new BearerTokenAuthenticationPolicy(tokenCredential, DEFAULT_SCOPES));
}
- this.pipelinePolicies.stream()
- .filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
- .forEach(p -> policies.add(p));
+ this.pipelinePolicies.stream().filter(p -> p.getPipelinePosition() == HttpPipelinePosition.PER_RETRY)
+ .forEach(p -> policies.add(p));
HttpPolicyProviders.addAfterRetryPolicies(policies);
policies.add(new HttpLoggingPolicy(httpLogOptions));
- HttpPipeline httpPipeline =
- new HttpPipelineBuilder()
- .policies(policies.toArray(new HttpPipelinePolicy[0]))
- .httpClient(httpClient)
- .clientOptions(localClientOptions)
- .build();
+ HttpPipeline httpPipeline = new HttpPipelineBuilder().policies(policies.toArray(new HttpPipelinePolicy[0]))
+ .httpClient(httpClient).clientOptions(localClientOptions).build();
return httpPipeline;
}
private NonAzureOpenAIClientImpl buildInnerNonAzureOpenAIClient() {
HttpPipeline localPipeline = (pipeline != null) ? pipeline : createHttpPipeline();
- NonAzureOpenAIClientImpl client =
- new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter());
+ NonAzureOpenAIClientImpl client
+ = new NonAzureOpenAIClientImpl(localPipeline, JacksonAdapter.createDefaultSerializerAdapter());
return client;
}
@@ -313,9 +337,8 @@ private NonAzureOpenAIClientImpl buildInnerNonAzureOpenAIClient() {
* @return an instance of OpenAIAsyncClient.
*/
public OpenAIAsyncClient buildAsyncClient() {
- return useNonAzureOpenAIService()
- ? new OpenAIAsyncClient(buildInnerNonAzureOpenAIClient())
- : new OpenAIAsyncClient(buildInnerClient());
+ return useNonAzureOpenAIService() ? new OpenAIAsyncClient(buildInnerNonAzureOpenAIClient())
+ : new OpenAIAsyncClient(buildInnerClient());
}
/**
@@ -324,9 +347,8 @@ public OpenAIAsyncClient buildAsyncClient() {
* @return an instance of OpenAIClient.
*/
public OpenAIClient buildClient() {
- return useNonAzureOpenAIService()
- ? new OpenAIClient(buildInnerNonAzureOpenAIClient())
- : new OpenAIClient(buildInnerClient());
+ return useNonAzureOpenAIService() ? new OpenAIClient(buildInnerNonAzureOpenAIClient())
+ : new OpenAIClient(buildInnerClient());
}
private static final ClientLogger LOGGER = new ClientLogger(OpenAIClientBuilder.class);
diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java
index 19923a82e45b..6ba5e78bef59 100644
--- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java
+++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/OpenAIServiceVersion.java
@@ -6,24 +6,38 @@
import com.azure.core.util.ServiceVersion;
-/** Service version of OpenAIClient. */
+/**
+ * Service version of OpenAIClient.
+ */
public enum OpenAIServiceVersion implements ServiceVersion {
- /** Enum value 2022-12-01. */
+ /**
+ * Enum value 2022-12-01.
+ */
V2022_12_01("2022-12-01"),
- /** Enum value 2023-05-15. */
+ /**
+ * Enum value 2023-05-15.
+ */
V2023_05_15("2023-05-15"),
- /** Enum value 2023-06-01-preview. */
+ /**
+ * Enum value 2023-06-01-preview.
+ */
V2023_06_01_PREVIEW("2023-06-01-preview"),
- /** Enum value 2023-07-01-preview. */
+ /**
+ * Enum value 2023-07-01-preview.
+ */
V2023_07_01_PREVIEW("2023-07-01-preview"),
- /** Enum value 2023-08-01-preview. */
+ /**
+ * Enum value 2023-08-01-preview.
+ */
V2023_08_01_PREVIEW("2023-08-01-preview"),
- /** Enum value 2023-09-01-preview. */
+ /**
+ * Enum value 2023-09-01-preview.
+ */
V2023_09_01_PREVIEW("2023-09-01-preview");
private final String version;
@@ -32,7 +46,9 @@ public enum OpenAIServiceVersion implements ServiceVersion {
this.version = version;
}
- /** {@inheritDoc} */
+ /**
+ * {@inheritDoc}
+ */
@Override
public String getVersion() {
return this.version;
@@ -40,7 +56,7 @@ public String getVersion() {
/**
* Gets the latest service version supported by this client library.
- *
+ *
* @return The latest {@link OpenAIServiceVersion}.
*/
public static OpenAIServiceVersion getLatest() {
diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java
index 9bdc7d60d521..432a05065e11 100644
--- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java
+++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java
@@ -5,6 +5,7 @@
package com.azure.ai.openai.implementation;
import com.azure.ai.openai.OpenAIServiceVersion;
+import com.azure.ai.openai.implementation.models.BatchImageGenerationOperationResponse;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.HeaderParam;
@@ -42,9 +43,13 @@
import java.time.Duration;
import reactor.core.publisher.Mono;
-/** Initializes a new instance of the OpenAIClient type. */
+/**
+ * Initializes a new instance of the OpenAIClient type.
+ */
public final class OpenAIClientImpl {
- /** The proxy service used to perform REST calls. */
+ /**
+ * The proxy service used to perform REST calls.
+ */
private final OpenAIClientService service;
/**
@@ -56,43 +61,49 @@ public final class OpenAIClientImpl {
/**
* Gets Supported Cognitive Services endpoints (protocol and hostname, for example:
* https://westus.api.cognitive.microsoft.com).
- *
+ *
* @return the endpoint value.
*/
public String getEndpoint() {
return this.endpoint;
}
- /** Service version. */
+ /**
+ * Service version.
+ */
private final OpenAIServiceVersion serviceVersion;
/**
* Gets Service version.
- *
+ *
* @return the serviceVersion value.
*/
public OpenAIServiceVersion getServiceVersion() {
return this.serviceVersion;
}
- /** The HTTP pipeline to send requests through. */
+ /**
+ * The HTTP pipeline to send requests through.
+ */
private final HttpPipeline httpPipeline;
/**
* Gets The HTTP pipeline to send requests through.
- *
+ *
* @return the httpPipeline value.
*/
public HttpPipeline getHttpPipeline() {
return this.httpPipeline;
}
- /** The serializer to serialize an object into a string. */
+ /**
+ * The serializer to serialize an object into a string.
+ */
private final SerializerAdapter serializerAdapter;
/**
* Gets The serializer to serialize an object into a string.
- *
+ *
* @return the serializerAdapter value.
*/
public SerializerAdapter getSerializerAdapter() {
@@ -101,25 +112,22 @@ public SerializerAdapter getSerializerAdapter() {
/**
* Initializes an instance of OpenAIClient client.
- *
+ *
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
- * https://westus.api.cognitive.microsoft.com).
+ * https://westus.api.cognitive.microsoft.com).
* @param serviceVersion Service version.
*/
public OpenAIClientImpl(String endpoint, OpenAIServiceVersion serviceVersion) {
- this(
- new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
- JacksonAdapter.createDefaultSerializerAdapter(),
- endpoint,
- serviceVersion);
+ this(new HttpPipelineBuilder().policies(new UserAgentPolicy(), new RetryPolicy()).build(),
+ JacksonAdapter.createDefaultSerializerAdapter(), endpoint, serviceVersion);
}
/**
* Initializes an instance of OpenAIClient client.
- *
+ *
* @param httpPipeline The HTTP pipeline to send requests through.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
- * https://westus.api.cognitive.microsoft.com).
+ * https://westus.api.cognitive.microsoft.com).
* @param serviceVersion Service version.
*/
public OpenAIClientImpl(HttpPipeline httpPipeline, String endpoint, OpenAIServiceVersion serviceVersion) {
@@ -128,18 +136,15 @@ public OpenAIClientImpl(HttpPipeline httpPipeline, String endpoint, OpenAIServic
/**
* Initializes an instance of OpenAIClient client.
- *
+ *
* @param httpPipeline The HTTP pipeline to send requests through.
* @param serializerAdapter The serializer to serialize an object into a string.
* @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
- * https://westus.api.cognitive.microsoft.com).
+ * https://westus.api.cognitive.microsoft.com).
* @param serviceVersion Service version.
*/
- public OpenAIClientImpl(
- HttpPipeline httpPipeline,
- SerializerAdapter serializerAdapter,
- String endpoint,
- OpenAIServiceVersion serviceVersion) {
+ public OpenAIClientImpl(HttpPipeline httpPipeline, SerializerAdapter serializerAdapter, String endpoint,
+ OpenAIServiceVersion serviceVersion) {
this.httpPipeline = httpPipeline;
this.serializerAdapter = serializerAdapter;
this.endpoint = endpoint;
@@ -153,692 +158,804 @@ public OpenAIClientImpl(
@Host("{endpoint}/openai")
@ServiceInterface(name = "OpenAIClient")
public interface OpenAIClientService {
- @Post("/deployments/{deploymentId}/embeddings")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/audio/transcriptions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getEmbeddings(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData embeddingsOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getAudioTranscriptionAsPlainText(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData audioTranscriptionOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/embeddings")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/audio/transcriptions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getEmbeddingsSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData embeddingsOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getAudioTranscriptionAsPlainTextSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData audioTranscriptionOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ // @Multipart not supported by RestProxy
+ @Post("/deployments/{deploymentId}/audio/transcriptions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getCompletions(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData completionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getAudioTranscriptionAsResponseObject(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, RequestOptions requestOptions,
+ Context context);
- @Post("/deployments/{deploymentId}/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ // @Multipart not supported by RestProxy
+ @Post("/deployments/{deploymentId}/audio/transcriptions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getCompletionsSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData completionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getAudioTranscriptionAsResponseObjectSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, RequestOptions requestOptions,
+ Context context);
- @Post("/deployments/{deploymentId}/chat/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/audio/translations")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getChatCompletions(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData chatCompletionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getAudioTranslationAsPlainText(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData audioTranslationOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/chat/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/audio/translations")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getChatCompletionsSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData chatCompletionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getAudioTranslationAsPlainTextSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData audioTranslationOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/extensions/chat/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ // @Multipart not supported by RestProxy
+ @Post("/deployments/{deploymentId}/audio/translations")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getChatCompletionsWithAzureExtensions(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData chatCompletionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getAudioTranslationAsResponseObject(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, RequestOptions requestOptions,
+ Context context);
- @Post("/deployments/{deploymentId}/extensions/chat/completions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ // @Multipart not supported by RestProxy
+ @Post("/deployments/{deploymentId}/audio/translations")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getChatCompletionsWithAzureExtensionsSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData chatCompletionsOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getAudioTranslationAsResponseObjectSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("content-type") String contentType, @HeaderParam("accept") String accept,
+ @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, RequestOptions requestOptions,
+ Context context);
- @Post("/images/generations:submit")
- @ExpectedResponses({202})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> beginAzureBatchImageGeneration(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData imageGenerationOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getCompletions(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData completionsOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/images/generations:submit")
- @ExpectedResponses({202})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response beginAzureBatchImageGenerationSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData imageGenerationOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getCompletionsSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData completionsOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/audio/transcriptions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/chat/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getAudioTranscriptionAsPlainText(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData audioTranscriptionOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getChatCompletions(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData chatCompletionsOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/audio/transcriptions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/chat/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getAudioTranscriptionAsPlainTextSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData audioTranscriptionOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getChatCompletionsSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData chatCompletionsOptions,
+ RequestOptions requestOptions, Context context);
- // @Multipart not supported by RestProxy
- @Post("/deployments/{deploymentId}/audio/transcriptions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/extensions/chat/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getAudioTranscriptionAsResponseObject(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("content-type") String contentType,
- @HeaderParam("accept") String accept,
- @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getChatCompletionsWithAzureExtensions(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData chatCompletionsOptions,
+ RequestOptions requestOptions, Context context);
- // @Multipart not supported by RestProxy
- @Post("/deployments/{deploymentId}/audio/transcriptions")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/extensions/chat/completions")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getAudioTranscriptionAsResponseObjectSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("content-type") String contentType,
- @HeaderParam("accept") String accept,
- @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getChatCompletionsWithAzureExtensionsSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData chatCompletionsOptions,
+ RequestOptions requestOptions, Context context);
- @Post("/deployments/{deploymentId}/audio/translations")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/images/generations:submit")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getAudioTranslationAsPlainText(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData audioTranslationOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> beginAzureBatchImageGeneration(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions,
+ Context context);
- @Post("/deployments/{deploymentId}/audio/translations")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/images/generations:submit")
+ @ExpectedResponses({ 202 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getAudioTranslationAsPlainTextSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("accept") String accept,
- @BodyParam("application/json") BinaryData audioTranslationOptions,
- RequestOptions requestOptions,
- Context context);
+ Response beginAzureBatchImageGenerationSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @HeaderParam("accept") String accept,
+ @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions,
+ Context context);
- // @Multipart not supported by RestProxy
- @Post("/deployments/{deploymentId}/audio/translations")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/embeddings")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Mono> getAudioTranslationAsResponseObject(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("content-type") String contentType,
- @HeaderParam("accept") String accept,
- @BodyParam("multipart/form-data") BinaryData audioTranslationOptions,
- RequestOptions requestOptions,
- Context context);
+ Mono> getEmbeddings(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData embeddingsOptions,
+ RequestOptions requestOptions, Context context);
- // @Multipart not supported by RestProxy
- @Post("/deployments/{deploymentId}/audio/translations")
- @ExpectedResponses({200})
- @UnexpectedResponseExceptionType(
- value = ClientAuthenticationException.class,
- code = {401})
- @UnexpectedResponseExceptionType(
- value = ResourceNotFoundException.class,
- code = {404})
- @UnexpectedResponseExceptionType(
- value = ResourceModifiedException.class,
- code = {409})
+ @Post("/deployments/{deploymentId}/embeddings")
+ @ExpectedResponses({ 200 })
+ @UnexpectedResponseExceptionType(value = ClientAuthenticationException.class, code = { 401 })
+ @UnexpectedResponseExceptionType(value = ResourceNotFoundException.class, code = { 404 })
+ @UnexpectedResponseExceptionType(value = ResourceModifiedException.class, code = { 409 })
@UnexpectedResponseExceptionType(HttpResponseException.class)
- Response getAudioTranslationAsResponseObjectSync(
- @HostParam("endpoint") String endpoint,
- @QueryParam("api-version") String apiVersion,
- @PathParam("deploymentId") String deploymentOrModelName,
- @HeaderParam("content-type") String contentType,
- @HeaderParam("accept") String accept,
- @BodyParam("multipart/form-data") BinaryData audioTranslationOptions,
- RequestOptions requestOptions,
- Context context);
+ Response getEmbeddingsSync(@HostParam("endpoint") String endpoint,
+ @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName,
+ @HeaderParam("accept") String accept, @BodyParam("application/json") BinaryData embeddingsOptions,
+ RequestOptions requestOptions, Context context);
}
/**
- * Return the embeddings for a given prompt.
- *
- * Request Body Schema
- *
+ * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
+ * written language corresponding to the language it was spoken in.
+ *
+ * Request Body Schema
+ *
* {@code
* {
- * user: String (Optional)
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * language: String (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
* model: String (Optional)
- * input (Required): [
- * String (Required)
- * ]
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
- * {
- * data (Required): [
- * (Required){
- * embedding (Required): [
- * double (Required)
- * ]
- * index: int (Required)
- * }
- * ]
- * usage (Required): {
- * prompt_tokens: int (Required)
- * total_tokens: int (Required)
- * }
- * }
+ * String
* }
- *
+ *
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
+ * @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response} on successful completion of {@link Mono}.
+ * @return transcribed text and associated metadata from provided spoken audio data along with {@link Response} on
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getEmbeddingsWithResponseAsync(
- String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions) {
+ public Mono> getAudioTranscriptionAsPlainTextWithResponseAsync(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
final String accept = "application/json";
- return FluxUtil.withContext(
- context ->
- service.getEmbeddings(
- this.getEndpoint(),
- this.getServiceVersion().getVersion(),
- deploymentOrModelName,
- accept,
- embeddingsOptions,
- requestOptions,
- context));
+ return FluxUtil.withContext(context -> service.getAudioTranscriptionAsPlainText(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), deploymentOrModelName, accept, audioTranscriptionOptions,
+ requestOptions, context));
}
/**
- * Return the embeddings for a given prompt.
- *
- * Request Body Schema
- *
+ * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
+ * written language corresponding to the language it was spoken in.
+ *
+ * Request Body Schema
+ *
* {@code
* {
- * user: String (Optional)
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * language: String (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
* model: String (Optional)
- * input (Required): [
- * String (Required)
- * ]
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
- * {
- * data (Required): [
- * (Required){
- * embedding (Required): [
- * double (Required)
- * ]
- * index: int (Required)
- * }
- * ]
- * usage (Required): {
- * prompt_tokens: int (Required)
- * total_tokens: int (Required)
- * }
- * }
+ * String
* }
- *
+ *
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
+ * @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return representation of the response data from an embeddings request. Embeddings measure the relatedness of
- * text strings and are commonly used for search, clustering, recommendations, and other similar scenarios along
- * with {@link Response}.
+ * @return transcribed text and associated metadata from provided spoken audio data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getEmbeddingsWithResponse(
- String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions) {
+ public Response getAudioTranscriptionAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
final String accept = "application/json";
- return service.getEmbeddingsSync(
- this.getEndpoint(),
- this.getServiceVersion().getVersion(),
- deploymentOrModelName,
- accept,
- embeddingsOptions,
- requestOptions,
- Context.NONE);
+ return service.getAudioTranscriptionAsPlainTextSync(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ deploymentOrModelName, accept, audioTranscriptionOptions, requestOptions, Context.NONE);
}
/**
- * 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.
- *
- * Request Body Schema
- *
+ * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
+ * written language corresponding to the language it was spoken in.
+ *
+ * Request Body Schema
+ *
* {@code
* {
- * prompt (Required): [
- * String (Required)
- * ]
- * max_tokens: Integer (Optional)
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * language: String (Optional)
+ * prompt: String (Optional)
* temperature: Double (Optional)
- * top_p: Double (Optional)
- * logit_bias (Optional): {
- * String: int (Optional)
- * }
- * user: String (Optional)
- * n: Integer (Optional)
- * logprobs: Integer (Optional)
- * echo: Boolean (Optional)
- * stop (Optional): [
- * String (Optional)
- * ]
- * presence_penalty: Double (Optional)
- * frequency_penalty: Double (Optional)
- * best_of: Integer (Optional)
- * stream: Boolean (Optional)
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
- * id: String (Required)
- * created: long (Required)
- * prompt_filter_results (Optional): [
+ * text: String (Required)
+ * task: String(transcribe/translate) (Optional)
+ * language: String (Optional)
+ * duration: Double (Optional)
+ * segments (Optional): [
* (Optional){
- * prompt_index: int (Required)
- * content_filter_results (Optional): {
- * sexual (Optional): {
- * severity: String(safe/low/medium/high) (Required)
- * filtered: boolean (Required)
- * }
- * violence (Optional): (recursive schema, see violence above)
- * hate (Optional): (recursive schema, see hate above)
- * self_harm (Optional): (recursive schema, see self_harm above)
- * error (Optional): {
- * code: String (Required)
- * message: String (Required)
- * target: String (Optional)
- * details (Optional): [
- * (recursive schema, see above)
- * ]
- * innererror (Optional): {
- * code: String (Optional)
- * innererror (Optional): (recursive schema, see innererror above)
- * }
- * }
- * }
- * }
- * ]
- * choices (Required): [
- * (Required){
+ * id: int (Required)
+ * start: double (Required)
+ * end: double (Required)
* text: String (Required)
- * index: int (Required)
- * content_filter_results (Optional): (recursive schema, see content_filter_results above)
- * logprobs (Required): {
- * tokens (Required): [
- * String (Required)
- * ]
- * token_logprobs (Required): [
- * double (Required)
- * ]
- * top_logprobs (Required): [
- * (Required){
- * String: double (Required)
- * }
- * ]
- * text_offset (Required): [
- * int (Required)
- * ]
- * }
- * finish_reason: String(stop/length/content_filter/function_call) (Required)
+ * temperature: double (Required)
+ * avg_logprob: double (Required)
+ * compression_ratio: double (Required)
+ * no_speech_prob: double (Required)
+ * tokens (Required): [
+ * int (Required)
+ * ]
+ * seek: int (Required)
* }
* ]
- * usage (Required): {
- * completion_tokens: int (Required)
- * prompt_tokens: int (Required)
- * total_tokens: int (Required)
- * }
* }
* }
- *
+ *
* @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.
+ * (when using non-Azure OpenAI) to use for this request.
+ * @param audioTranscriptionOptions The configuration information for an audio transcription request.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response} on successful completion
- * of {@link Mono}.
+ * @return transcribed text and associated metadata from provided spoken audio data along with {@link Response} on
+ * successful completion of {@link Mono}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Mono> getCompletionsWithResponseAsync(
- String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) {
+ public Mono> getAudioTranscriptionAsResponseObjectWithResponseAsync(
+ String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
final String accept = "application/json";
- return FluxUtil.withContext(
- context ->
- service.getCompletions(
- this.getEndpoint(),
- this.getServiceVersion().getVersion(),
- deploymentOrModelName,
- accept,
- completionsOptions,
- requestOptions,
- context));
+ return FluxUtil.withContext(context -> service.getAudioTranscriptionAsResponseObject(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), deploymentOrModelName, contentType, accept,
+ audioTranscriptionOptions, requestOptions, context));
}
/**
- * 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.
- *
- * Request Body Schema
- *
+ * Gets transcribed text and associated metadata from provided spoken audio data. Audio will be transcribed in the
+ * written language corresponding to the language it was spoken in.
+ *
+ * Request Body Schema
+ *
* {@code
* {
- * prompt (Required): [
- * String (Required)
- * ]
- * max_tokens: Integer (Optional)
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * language: String (Optional)
+ * prompt: String (Optional)
* temperature: Double (Optional)
- * top_p: Double (Optional)
- * logit_bias (Optional): {
- * String: int (Optional)
- * }
- * user: String (Optional)
- * n: Integer (Optional)
- * logprobs: Integer (Optional)
- * echo: Boolean (Optional)
- * stop (Optional): [
- * String (Optional)
- * ]
- * presence_penalty: Double (Optional)
- * frequency_penalty: Double (Optional)
- * best_of: Integer (Optional)
- * stream: Boolean (Optional)
* model: String (Optional)
* }
* }
- *
- * Response Body Schema
- *
+ *
+ * Response Body Schema
+ *
* {@code
* {
- * id: String (Required)
- * created: long (Required)
- * prompt_filter_results (Optional): [
+ * text: String (Required)
+ * task: String(transcribe/translate) (Optional)
+ * language: String (Optional)
+ * duration: Double (Optional)
+ * segments (Optional): [
* (Optional){
- * prompt_index: int (Required)
- * content_filter_results (Optional): {
- * sexual (Optional): {
- * severity: String(safe/low/medium/high) (Required)
- * filtered: boolean (Required)
- * }
- * violence (Optional): (recursive schema, see violence above)
- * hate (Optional): (recursive schema, see hate above)
- * self_harm (Optional): (recursive schema, see self_harm above)
- * error (Optional): {
+ * id: int (Required)
+ * start: double (Required)
+ * end: double (Required)
+ * text: String (Required)
+ * temperature: double (Required)
+ * avg_logprob: double (Required)
+ * compression_ratio: double (Required)
+ * no_speech_prob: double (Required)
+ * tokens (Required): [
+ * int (Required)
+ * ]
+ * seek: int (Required)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * @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 audioTranscriptionOptions The configuration information for an audio transcription request.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return transcribed text and associated metadata from provided spoken audio data along with {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAudioTranscriptionAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranscriptionOptions, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
+ final String accept = "application/json";
+ return service.getAudioTranscriptionAsResponseObjectSync(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), deploymentOrModelName, contentType, accept,
+ audioTranscriptionOptions, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Gets English language transcribed text and associated metadata from provided spoken audio data.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * String
+ * }
+ *
+ * @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 audioTranslationOptions The configuration information for an audio translation request.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return english language transcribed text and associated metadata from provided spoken audio data along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAudioTranslationAsPlainTextWithResponseAsync(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil.withContext(
+ context -> service.getAudioTranslationAsPlainText(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ deploymentOrModelName, accept, audioTranslationOptions, requestOptions, context));
+ }
+
+ /**
+ * Gets English language transcribed text and associated metadata from provided spoken audio data.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * String
+ * }
+ *
+ * @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 audioTranslationOptions The configuration information for an audio translation request.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return english language transcribed text and associated metadata from provided spoken audio data along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAudioTranslationAsPlainTextWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return service.getAudioTranslationAsPlainTextSync(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ deploymentOrModelName, accept, audioTranslationOptions, requestOptions, Context.NONE);
+ }
+
+ /**
+ * Gets English language transcribed text and associated metadata from provided spoken audio data.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * text: String (Required)
+ * task: String(transcribe/translate) (Optional)
+ * language: String (Optional)
+ * duration: Double (Optional)
+ * segments (Optional): [
+ * (Optional){
+ * id: int (Required)
+ * start: double (Required)
+ * end: double (Required)
+ * text: String (Required)
+ * temperature: double (Required)
+ * avg_logprob: double (Required)
+ * compression_ratio: double (Required)
+ * no_speech_prob: double (Required)
+ * tokens (Required): [
+ * int (Required)
+ * ]
+ * seek: int (Required)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * @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 audioTranslationOptions The configuration information for an audio translation request.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return english language transcribed text and associated metadata from provided spoken audio data along with
+ * {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getAudioTranslationAsResponseObjectWithResponseAsync(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
+ final String accept = "application/json";
+ return FluxUtil.withContext(context -> service.getAudioTranslationAsResponseObject(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), deploymentOrModelName, contentType, accept, audioTranslationOptions,
+ requestOptions, context));
+ }
+
+ /**
+ * Gets English language transcribed text and associated metadata from provided spoken audio data.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * file: byte[] (Required)
+ * response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+ * prompt: String (Optional)
+ * temperature: Double (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * text: String (Required)
+ * task: String(transcribe/translate) (Optional)
+ * language: String (Optional)
+ * duration: Double (Optional)
+ * segments (Optional): [
+ * (Optional){
+ * id: int (Required)
+ * start: double (Required)
+ * end: double (Required)
+ * text: String (Required)
+ * temperature: double (Required)
+ * avg_logprob: double (Required)
+ * compression_ratio: double (Required)
+ * no_speech_prob: double (Required)
+ * tokens (Required): [
+ * int (Required)
+ * ]
+ * seek: int (Required)
+ * }
+ * ]
+ * }
+ * }
+ *
+ * @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 audioTranslationOptions The configuration information for an audio translation request.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return english language transcribed text and associated metadata from provided spoken audio data along with
+ * {@link Response}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Response getAudioTranslationAsResponseObjectWithResponse(String deploymentOrModelName,
+ BinaryData audioTranslationOptions, RequestOptions requestOptions) {
+ final String contentType = "multipart/form-data";
+ final String accept = "application/json";
+ return service.getAudioTranslationAsResponseObjectSync(this.getEndpoint(),
+ this.getServiceVersion().getVersion(), deploymentOrModelName, contentType, accept, audioTranslationOptions,
+ requestOptions, Context.NONE);
+ }
+
+ /**
+ * 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.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * prompt (Required): [
+ * String (Required)
+ * ]
+ * max_tokens: Integer (Optional)
+ * temperature: Double (Optional)
+ * top_p: Double (Optional)
+ * logit_bias (Optional): {
+ * String: int (Optional)
+ * }
+ * user: String (Optional)
+ * n: Integer (Optional)
+ * logprobs: Integer (Optional)
+ * echo: Boolean (Optional)
+ * stop (Optional): [
+ * String (Optional)
+ * ]
+ * presence_penalty: Double (Optional)
+ * frequency_penalty: Double (Optional)
+ * best_of: Integer (Optional)
+ * stream: Boolean (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * created: long (Required)
+ * prompt_filter_results (Optional): [
+ * (Optional){
+ * prompt_index: int (Required)
+ * content_filter_results (Optional): {
+ * sexual (Optional): {
+ * severity: String(safe/low/medium/high) (Required)
+ * filtered: boolean (Required)
+ * }
+ * violence (Optional): (recursive schema, see violence above)
+ * hate (Optional): (recursive schema, see hate above)
+ * self_harm (Optional): (recursive schema, see self_harm above)
+ * error (Optional): {
+ * code: String (Required)
+ * message: String (Required)
+ * target: String (Optional)
+ * details (Optional): [
+ * (recursive schema, see above)
+ * ]
+ * innererror (Optional): {
+ * code: String (Optional)
+ * innererror (Optional): (recursive schema, see innererror above)
+ * }
+ * }
+ * }
+ * }
+ * ]
+ * choices (Required): [
+ * (Required){
+ * text: String (Required)
+ * index: int (Required)
+ * content_filter_results (Optional): (recursive schema, see content_filter_results above)
+ * logprobs (Required): {
+ * tokens (Required): [
+ * String (Required)
+ * ]
+ * token_logprobs (Required): [
+ * double (Required)
+ * ]
+ * top_logprobs (Required): [
+ * (Required){
+ * String: double (Required)
+ * }
+ * ]
+ * text_offset (Required): [
+ * int (Required)
+ * ]
+ * }
+ * finish_reason: String(stop/length/content_filter/function_call) (Required)
+ * }
+ * ]
+ * usage (Required): {
+ * completion_tokens: int (Required)
+ * prompt_tokens: int (Required)
+ * total_tokens: int (Required)
+ * }
+ * }
+ * }
+ *
+ * @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.
+ * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
+ * @throws HttpResponseException thrown if the request is rejected by server.
+ * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
+ * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
+ * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
+ * @return completions for the provided input prompts.
+ * Completions support a wide variety of tasks and generate text that continues from or "completes"
+ * provided prompt data along with {@link Response} on successful completion of {@link Mono}.
+ */
+ @ServiceMethod(returns = ReturnType.SINGLE)
+ public Mono> getCompletionsWithResponseAsync(String deploymentOrModelName,
+ BinaryData completionsOptions, RequestOptions requestOptions) {
+ final String accept = "application/json";
+ return FluxUtil
+ .withContext(context -> service.getCompletions(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ deploymentOrModelName, accept, completionsOptions, requestOptions, context));
+ }
+
+ /**
+ * 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.
+ *
+ * Request Body Schema
+ *
+ * {@code
+ * {
+ * prompt (Required): [
+ * String (Required)
+ * ]
+ * max_tokens: Integer (Optional)
+ * temperature: Double (Optional)
+ * top_p: Double (Optional)
+ * logit_bias (Optional): {
+ * String: int (Optional)
+ * }
+ * user: String (Optional)
+ * n: Integer (Optional)
+ * logprobs: Integer (Optional)
+ * echo: Boolean (Optional)
+ * stop (Optional): [
+ * String (Optional)
+ * ]
+ * presence_penalty: Double (Optional)
+ * frequency_penalty: Double (Optional)
+ * best_of: Integer (Optional)
+ * stream: Boolean (Optional)
+ * model: String (Optional)
+ * }
+ * }
+ *
+ * Response Body Schema
+ *
+ * {@code
+ * {
+ * id: String (Required)
+ * created: long (Required)
+ * prompt_filter_results (Optional): [
+ * (Optional){
+ * prompt_index: int (Required)
+ * content_filter_results (Optional): {
+ * sexual (Optional): {
+ * severity: String(safe/low/medium/high) (Required)
+ * filtered: boolean (Required)
+ * }
+ * violence (Optional): (recursive schema, see violence above)
+ * hate (Optional): (recursive schema, see hate above)
+ * self_harm (Optional): (recursive schema, see self_harm above)
+ * error (Optional): {
* code: String (Required)
* message: String (Required)
* target: String (Optional)
@@ -884,39 +1001,36 @@ public Mono> getCompletionsWithResponseAsync(
* }
* }
* }
- *
+ *
* @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.
+ * (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.
* @param requestOptions The options to configure the HTTP request before HTTP client sends it.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
- * @return completions for the provided input prompts. Completions support a wide variety of tasks and generate text
- * that continues from or "completes" provided prompt data along with {@link Response}.
+ * @return completions for the provided input prompts.
+ * Completions support a wide variety of tasks and generate text that continues from or "completes"
+ * provided prompt data along with {@link Response}.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
- public Response getCompletionsWithResponse(
- String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) {
+ public Response getCompletionsWithResponse(String deploymentOrModelName, BinaryData completionsOptions,
+ RequestOptions requestOptions) {
final String accept = "application/json";
- return service.getCompletionsSync(
- this.getEndpoint(),
- this.getServiceVersion().getVersion(),
- deploymentOrModelName,
- accept,
- completionsOptions,
- requestOptions,
- Context.NONE);
+ return service.getCompletionsSync(this.getEndpoint(), this.getServiceVersion().getVersion(),
+ deploymentOrModelName, accept, completionsOptions, requestOptions, Context.NONE);
}
/**
- * 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.
- *
- *