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..c8321f661ccd 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 @@ -153,7 +153,7 @@ public OpenAIClientImpl( @Host("{endpoint}/openai") @ServiceInterface(name = "OpenAIClient") public interface OpenAIClientService { - @Post("/deployments/{deploymentId}/embeddings") + @Post("/deployments/{deploymentId}/audio/transcriptions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -165,16 +165,16 @@ public interface OpenAIClientService { value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getEmbeddings( + Mono> getAudioTranscriptionAsPlainText( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData embeddingsOptions, + @BodyParam("application/json") BinaryData audioTranscriptionOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/embeddings") + @Post("/deployments/{deploymentId}/audio/transcriptions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -186,16 +186,17 @@ Mono> getEmbeddings( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getEmbeddingsSync( + Response getAudioTranscriptionAsPlainTextSync( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData embeddingsOptions, + @BodyParam("application/json") BinaryData audioTranscriptionOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/completions") + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/transcriptions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -207,16 +208,18 @@ Response getEmbeddingsSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getCompletions( + 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("application/json") BinaryData completionsOptions, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/completions") + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/transcriptions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -228,16 +231,17 @@ Mono> getCompletions( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getCompletionsSync( + 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("application/json") BinaryData completionsOptions, + @BodyParam("multipart/form-data") BinaryData audioTranscriptionOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/chat/completions") + @Post("/deployments/{deploymentId}/audio/translations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -249,16 +253,16 @@ Response getCompletionsSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getChatCompletions( + Mono> getAudioTranslationAsPlainText( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData chatCompletionsOptions, + @BodyParam("application/json") BinaryData audioTranslationOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/chat/completions") + @Post("/deployments/{deploymentId}/audio/translations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -270,16 +274,17 @@ Mono> getChatCompletions( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getChatCompletionsSync( + Response getAudioTranslationAsPlainTextSync( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData chatCompletionsOptions, + @BodyParam("application/json") BinaryData audioTranslationOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/extensions/chat/completions") + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/translations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -291,16 +296,18 @@ Response getChatCompletionsSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getChatCompletionsWithAzureExtensions( + 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("application/json") BinaryData chatCompletionsOptions, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/extensions/chat/completions") + // @Multipart not supported by RestProxy + @Post("/deployments/{deploymentId}/audio/translations") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -312,17 +319,18 @@ Mono> getChatCompletionsWithAzureExtensions( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getChatCompletionsWithAzureExtensionsSync( + 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("application/json") BinaryData chatCompletionsOptions, + @BodyParam("multipart/form-data") BinaryData audioTranslationOptions, RequestOptions requestOptions, Context context); - @Post("/images/generations:submit") - @ExpectedResponses({202}) + @Post("/deployments/{deploymentId}/completions") + @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, code = {401}) @@ -333,16 +341,17 @@ Response getChatCompletionsWithAzureExtensionsSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> beginAzureBatchImageGeneration( + Mono> getCompletions( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData imageGenerationOptions, + @BodyParam("application/json") BinaryData completionsOptions, RequestOptions requestOptions, Context context); - @Post("/images/generations:submit") - @ExpectedResponses({202}) + @Post("/deployments/{deploymentId}/completions") + @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, code = {401}) @@ -353,15 +362,16 @@ Mono> beginAzureBatchImageGeneration( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response beginAzureBatchImageGenerationSync( + Response getCompletionsSync( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, + @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData imageGenerationOptions, + @BodyParam("application/json") BinaryData completionsOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/audio/transcriptions") + @Post("/deployments/{deploymentId}/chat/completions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -373,16 +383,16 @@ Response beginAzureBatchImageGenerationSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAudioTranscriptionAsPlainText( + Mono> getChatCompletions( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData audioTranscriptionOptions, + @BodyParam("application/json") BinaryData chatCompletionsOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/audio/transcriptions") + @Post("/deployments/{deploymentId}/chat/completions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -394,17 +404,16 @@ Mono> getAudioTranscriptionAsPlainText( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAudioTranscriptionAsPlainTextSync( + Response getChatCompletionsSync( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData audioTranscriptionOptions, + @BodyParam("application/json") BinaryData chatCompletionsOptions, RequestOptions requestOptions, Context context); - // @Multipart not supported by RestProxy - @Post("/deployments/{deploymentId}/audio/transcriptions") + @Post("/deployments/{deploymentId}/extensions/chat/completions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -416,18 +425,16 @@ Response getAudioTranscriptionAsPlainTextSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAudioTranscriptionAsResponseObject( + Mono> getChatCompletionsWithAzureExtensions( @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, + @BodyParam("application/json") BinaryData chatCompletionsOptions, RequestOptions requestOptions, Context context); - // @Multipart not supported by RestProxy - @Post("/deployments/{deploymentId}/audio/transcriptions") + @Post("/deployments/{deploymentId}/extensions/chat/completions") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -439,18 +446,17 @@ Mono> getAudioTranscriptionAsResponseObject( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAudioTranscriptionAsResponseObjectSync( + Response getChatCompletionsWithAzureExtensionsSync( @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, + @BodyParam("application/json") BinaryData chatCompletionsOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/audio/translations") - @ExpectedResponses({200}) + @Post("/images/generations:submit") + @ExpectedResponses({202}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, code = {401}) @@ -461,17 +467,16 @@ Response getAudioTranscriptionAsResponseObjectSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAudioTranslationAsPlainText( + Mono> beginAzureBatchImageGeneration( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData audioTranslationOptions, + @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions, Context context); - @Post("/deployments/{deploymentId}/audio/translations") - @ExpectedResponses({200}) + @Post("/images/generations:submit") + @ExpectedResponses({202}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, code = {401}) @@ -482,17 +487,15 @@ Mono> getAudioTranslationAsPlainText( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAudioTranslationAsPlainTextSync( + Response beginAzureBatchImageGenerationSync( @HostParam("endpoint") String endpoint, @QueryParam("api-version") String apiVersion, - @PathParam("deploymentId") String deploymentOrModelName, @HeaderParam("accept") String accept, - @BodyParam("application/json") BinaryData audioTranslationOptions, + @BodyParam("application/json") BinaryData imageGenerationOptions, RequestOptions requestOptions, Context context); - // @Multipart not supported by RestProxy - @Post("/deployments/{deploymentId}/audio/translations") + @Post("/deployments/{deploymentId}/embeddings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -504,18 +507,16 @@ Response getAudioTranslationAsPlainTextSync( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Mono> getAudioTranslationAsResponseObject( + Mono> getEmbeddings( @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, + @BodyParam("application/json") BinaryData embeddingsOptions, RequestOptions requestOptions, Context context); - // @Multipart not supported by RestProxy - @Post("/deployments/{deploymentId}/audio/translations") + @Post("/deployments/{deploymentId}/embeddings") @ExpectedResponses({200}) @UnexpectedResponseExceptionType( value = ClientAuthenticationException.class, @@ -527,171 +528,126 @@ Mono> getAudioTranslationAsResponseObject( value = ResourceModifiedException.class, code = {409}) @UnexpectedResponseExceptionType(HttpResponseException.class) - Response getAudioTranslationAsResponseObjectSync( + Response getEmbeddingsSync( @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, + @BodyParam("application/json") BinaryData embeddingsOptions, RequestOptions requestOptions, Context context); } /** - * Return the embeddings for a given prompt. + * 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 * *

{@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. + * @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( + service.getAudioTranscriptionAsPlainText( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - embeddingsOptions, + audioTranscriptionOptions, requestOptions, context)); } /** - * Return the embeddings for a given prompt. + * 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 * *

{@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. + * @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( + return service.getAudioTranscriptionAsPlainTextSync( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - embeddingsOptions, + 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. + * 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)
      * }
      * }
@@ -700,123 +656,71 @@ public Response getEmbeddingsWithResponse( * *
{@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)
+     *     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)
-     *             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. + * @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( + service.getAudioTranscriptionAsResponseObject( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, + contentType, accept, - completionsOptions, + 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. + * 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)
      * }
      * }
@@ -825,437 +729,161 @@ public Mono> getCompletionsWithResponseAsync( * *
{@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. + * @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}. + * @return transcribed text and associated metadata from provided spoken audio data along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getCompletionsWithResponse( - String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) { + public Response getAudioTranscriptionAsResponseObjectWithResponse( + String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + final String contentType = "multipart/form-data"; final String accept = "application/json"; - return service.getCompletionsSync( + return service.getAudioTranscriptionAsResponseObjectSync( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, + contentType, accept, - completionsOptions, + audioTranscriptionOptions, 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. + * Gets English language transcribed text and associated metadata from provided spoken audio data. * *

Request Body Schema * *

{@code
      * {
-     *     messages (Required): [
-     *          (Required){
-     *             role: String(system/assistant/user/function/tool) (Required)
-     *             content: String (Required)
-     *             name: String (Optional)
-     *             function_call (Optional): {
-     *                 name: String (Required)
-     *                 arguments: String (Required)
-     *             }
-     *             context (Optional): {
-     *                 messages (Optional): [
-     *                     (recursive schema, see above)
-     *                 ]
-     *             }
-     *         }
-     *     ]
-     *     functions (Optional): [
-     *          (Optional){
-     *             name: String (Required)
-     *             description: String (Optional)
-     *             parameters: Object (Optional)
-     *         }
-     *     ]
-     *     function_call: FunctionCallModelBase (Optional)
-     *     max_tokens: Integer (Optional)
+     *     file: byte[] (Required)
+     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+     *     prompt: String (Optional)
      *     temperature: Double (Optional)
-     *     top_p: Double (Optional)
-     *     logit_bias (Optional): {
-     *         String: int (Optional)
-     *     }
-     *     user: String (Optional)
-     *     n: Integer (Optional)
-     *     stop (Optional): [
-     *         String (Optional)
-     *     ]
-     *     presence_penalty: Double (Optional)
-     *     frequency_penalty: Double (Optional)
-     *     stream: Boolean (Optional)
      *     model: String (Optional)
-     *     dataSources (Optional): [
-     *          (Optional){
-     *             type: String(AzureCognitiveSearch) (Required)
-     *             parameters: Object (Required)
-     *         }
-     *     ]
      * }
      * }
* *

Response Body Schema * *

{@code
-     * {
-     *     id: String (Required)
-     *     created: long (Required)
-     *     choices (Required): [
-     *          (Required){
-     *             message (Optional): {
-     *                 role: String(system/assistant/user/function/tool) (Required)
-     *                 content: String (Required)
-     *                 name: String (Optional)
-     *                 function_call (Optional): {
-     *                     name: String (Required)
-     *                     arguments: String (Required)
-     *                 }
-     *                 context (Optional): {
-     *                     messages (Optional): [
-     *                         (recursive schema, see above)
-     *                     ]
-     *                 }
-     *             }
-     *             index: int (Required)
-     *             finish_reason: String(stop/length/content_filter/function_call) (Required)
-     *             delta (Optional): (recursive schema, see delta above)
-     *             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)
-     *                     }
-     *                 }
-     *             }
-     *         }
-     *     ]
-     *     prompt_filter_results (Optional): [
-     *          (Optional){
-     *             prompt_index: int (Required)
-     *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
-     *         }
-     *     ]
-     *     usage (Required): {
-     *         completion_tokens: int (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 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 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 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}. + * @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> getChatCompletionsWithResponseAsync( - String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + public Mono> getAudioTranslationAsPlainTextWithResponseAsync( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> - service.getChatCompletions( + service.getAudioTranslationAsPlainText( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - chatCompletionsOptions, + audioTranslationOptions, requestOptions, context)); } /** - * 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. + * Gets English language transcribed text and associated metadata from provided spoken audio data. * *

Request Body Schema * *

{@code
      * {
-     *     messages (Required): [
-     *          (Required){
-     *             role: String(system/assistant/user/function/tool) (Required)
-     *             content: String (Required)
-     *             name: String (Optional)
-     *             function_call (Optional): {
-     *                 name: String (Required)
-     *                 arguments: String (Required)
-     *             }
-     *             context (Optional): {
-     *                 messages (Optional): [
-     *                     (recursive schema, see above)
-     *                 ]
-     *             }
-     *         }
-     *     ]
-     *     functions (Optional): [
-     *          (Optional){
-     *             name: String (Required)
-     *             description: String (Optional)
-     *             parameters: Object (Optional)
-     *         }
-     *     ]
-     *     function_call: FunctionCallModelBase (Optional)
-     *     max_tokens: Integer (Optional)
+     *     file: byte[] (Required)
+     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+     *     prompt: String (Optional)
      *     temperature: Double (Optional)
-     *     top_p: Double (Optional)
-     *     logit_bias (Optional): {
-     *         String: int (Optional)
-     *     }
-     *     user: String (Optional)
-     *     n: Integer (Optional)
-     *     stop (Optional): [
-     *         String (Optional)
-     *     ]
-     *     presence_penalty: Double (Optional)
-     *     frequency_penalty: Double (Optional)
-     *     stream: Boolean (Optional)
      *     model: String (Optional)
-     *     dataSources (Optional): [
-     *          (Optional){
-     *             type: String(AzureCognitiveSearch) (Required)
-     *             parameters: Object (Required)
-     *         }
-     *     ]
      * }
      * }
* *

Response Body Schema * *

{@code
-     * {
-     *     id: String (Required)
-     *     created: long (Required)
-     *     choices (Required): [
-     *          (Required){
-     *             message (Optional): {
-     *                 role: String(system/assistant/user/function/tool) (Required)
-     *                 content: String (Required)
-     *                 name: String (Optional)
-     *                 function_call (Optional): {
-     *                     name: String (Required)
-     *                     arguments: String (Required)
-     *                 }
-     *                 context (Optional): {
-     *                     messages (Optional): [
-     *                         (recursive schema, see above)
-     *                     ]
-     *                 }
-     *             }
-     *             index: int (Required)
-     *             finish_reason: String(stop/length/content_filter/function_call) (Required)
-     *             delta (Optional): (recursive schema, see delta above)
-     *             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)
-     *                     }
-     *                 }
-     *             }
-     *         }
-     *     ]
-     *     prompt_filter_results (Optional): [
-     *          (Optional){
-     *             prompt_index: int (Required)
-     *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
-     *         }
-     *     ]
-     *     usage (Required): {
-     *         completion_tokens: int (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 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 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 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}. + * @return english language transcribed text and associated metadata from provided spoken audio data along with + * {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getChatCompletionsWithResponse( - String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + public Response getAudioTranslationAsPlainTextWithResponse( + String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getChatCompletionsSync( + return service.getAudioTranslationAsPlainTextSync( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - chatCompletionsOptions, + audioTranslationOptions, requestOptions, Context.NONE); } /** - * 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. + * Gets English language transcribed text and associated metadata from provided spoken audio data. * *

Request Body Schema * *

{@code
      * {
-     *     messages (Required): [
-     *          (Required){
-     *             role: String(system/assistant/user/function/tool) (Required)
-     *             content: String (Required)
-     *             name: String (Optional)
-     *             function_call (Optional): {
-     *                 name: String (Required)
-     *                 arguments: String (Required)
-     *             }
-     *             context (Optional): {
-     *                 messages (Optional): [
-     *                     (recursive schema, see above)
-     *                 ]
-     *             }
-     *         }
-     *     ]
-     *     functions (Optional): [
-     *          (Optional){
-     *             name: String (Required)
-     *             description: String (Optional)
-     *             parameters: Object (Optional)
-     *         }
-     *     ]
-     *     function_call: FunctionCallModelBase (Optional)
-     *     max_tokens: Integer (Optional)
+     *     file: byte[] (Required)
+     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
+     *     prompt: String (Optional)
      *     temperature: Double (Optional)
-     *     top_p: Double (Optional)
-     *     logit_bias (Optional): {
-     *         String: int (Optional)
-     *     }
-     *     user: String (Optional)
-     *     n: Integer (Optional)
-     *     stop (Optional): [
-     *         String (Optional)
-     *     ]
-     *     presence_penalty: Double (Optional)
-     *     frequency_penalty: Double (Optional)
-     *     stream: Boolean (Optional)
      *     model: String (Optional)
-     *     dataSources (Optional): [
-     *          (Optional){
-     *             type: String(AzureCognitiveSearch) (Required)
-     *             parameters: Object (Required)
-     *         }
-     *     ]
      * }
      * }
* @@ -1263,126 +891,138 @@ public Response getChatCompletionsWithResponse( * *
{@code
      * {
-     *     id: String (Required)
-     *     created: long (Required)
-     *     choices (Required): [
-     *          (Required){
-     *             message (Optional): {
-     *                 role: String(system/assistant/user/function/tool) (Required)
-     *                 content: String (Required)
-     *                 name: String (Optional)
-     *                 function_call (Optional): {
-     *                     name: String (Required)
-     *                     arguments: String (Required)
-     *                 }
-     *                 context (Optional): {
-     *                     messages (Optional): [
-     *                         (recursive schema, see above)
-     *                     ]
-     *                 }
-     *             }
-     *             index: int (Required)
-     *             finish_reason: String(stop/length/content_filter/function_call) (Required)
-     *             delta (Optional): (recursive schema, see delta above)
-     *             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)
-     *                     }
-     *                 }
-     *             }
-     *         }
-     *     ]
-     *     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): (recursive schema, see content_filter_results above)
+     *             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)
      *         }
      *     ]
-     *     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 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 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 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 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> getChatCompletionsWithAzureExtensionsWithResponseAsync( - String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + 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.getChatCompletionsWithAzureExtensions( + service.getAudioTranslationAsResponseObject( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, + contentType, accept, - chatCompletionsOptions, + audioTranslationOptions, requestOptions, context)); } /** - * 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. + * Gets English language transcribed text and associated metadata from provided spoken audio data. * *

Request Body Schema * *

{@code
      * {
-     *     messages (Required): [
-     *          (Required){
-     *             role: String(system/assistant/user/function/tool) (Required)
-     *             content: String (Required)
-     *             name: String (Optional)
-     *             function_call (Optional): {
-     *                 name: String (Required)
-     *                 arguments: String (Required)
-     *             }
-     *             context (Optional): {
-     *                 messages (Optional): [
-     *                     (recursive schema, see above)
-     *                 ]
-     *             }
-     *         }
-     *     ]
-     *     functions (Optional): [
+     *     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){
-     *             name: String (Required)
-     *             description: String (Optional)
-     *             parameters: Object (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)
      *         }
      *     ]
-     *     function_call: FunctionCallModelBase (Optional)
+     * }
+     * }
+ * + * @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)
@@ -1391,19 +1031,16 @@ public Mono> getChatCompletionsWithAzureExtensionsWithRespo
      *     }
      *     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)
-     *     dataSources (Optional): [
-     *          (Optional){
-     *             type: String(AzureCognitiveSearch) (Required)
-     *             parameters: Object (Required)
-     *         }
-     *     ]
      * }
      * }
* @@ -1413,25 +1050,9 @@ public Mono> getChatCompletionsWithAzureExtensionsWithRespo * { * id: String (Required) * created: long (Required) - * choices (Required): [ - * (Required){ - * message (Optional): { - * role: String(system/assistant/user/function/tool) (Required) - * content: String (Required) - * name: String (Optional) - * function_call (Optional): { - * name: String (Required) - * arguments: String (Required) - * } - * context (Optional): { - * messages (Optional): [ - * (recursive schema, see above) - * ] - * } - * } - * index: int (Required) - * finish_reason: String(stop/length/content_filter/function_call) (Required) - * delta (Optional): (recursive schema, see delta above) + * prompt_filter_results (Optional): [ + * (Optional){ + * prompt_index: int (Required) * content_filter_results (Optional): { * sexual (Optional): { * severity: String(safe/low/medium/high) (Required) @@ -1455,10 +1076,28 @@ public Mono> getChatCompletionsWithAzureExtensionsWithRespo * } * } * ] - * prompt_filter_results (Optional): [ - * (Optional){ - * prompt_index: int (Required) + * 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): { @@ -1471,109 +1110,62 @@ public Mono> getChatCompletionsWithAzureExtensionsWithRespo * * @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. + * @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 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 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 Response getChatCompletionsWithAzureExtensionsWithResponse( - String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + public Mono> getCompletionsWithResponseAsync( + String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getChatCompletionsWithAzureExtensionsSync( - this.getEndpoint(), - this.getServiceVersion().getVersion(), - deploymentOrModelName, - accept, - chatCompletionsOptions, - requestOptions, - Context.NONE); + return FluxUtil.withContext( + context -> + service.getCompletions( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + completionsOptions, + requestOptions, + context)); } /** - * Starts the generation of a batch of images from a text caption. + * 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: String (Required)
-     *     n: Integer (Optional)
-     *     size: String(256x256/512x512/1024x1024) (Optional)
-     *     response_format: String(url/b64_json) (Optional)
-     *     user: String (Optional)
-     * }
-     * }
- * - *

Response Body Schema - * - *

{@code
-     * {
-     *     id: String (Required)
-     *     created: long (Required)
-     *     expires: Long (Optional)
-     *     result (Optional): {
-     *         created: long (Required)
-     *         data: DataModelBase (Required)
-     *     }
-     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
-     *     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)
-     *         }
+     *     prompt (Required): [
+     *         String (Required)
+     *     ]
+     *     max_tokens: Integer (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     logit_bias (Optional): {
+     *         String: int (Optional)
      *     }
-     * }
-     * }
- * - * @param imageGenerationOptions Represents the request data used to generate images. - * @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 a polling status update or final response payload for an image operation along with {@link Response} on - * successful completion of {@link Mono}. - */ - @ServiceMethod(returns = ReturnType.SINGLE) - private Mono> beginAzureBatchImageGenerationWithResponseAsync( - BinaryData imageGenerationOptions, RequestOptions requestOptions) { - final String accept = "application/json"; - return FluxUtil.withContext( - context -> - service.beginAzureBatchImageGeneration( - this.getEndpoint(), - this.getServiceVersion().getVersion(), - accept, - imageGenerationOptions, - requestOptions, - context)); - } - - /** - * Starts the generation of a batch of images from a text caption. - * - *

Request Body Schema - * - *

{@code
-     * {
-     *     prompt: String (Required)
-     *     n: Integer (Optional)
-     *     size: String(256x256/512x512/1024x1024) (Optional)
-     *     response_format: String(url/b64_json) (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)
      * }
      * }
* @@ -1583,60 +1175,143 @@ private Mono> beginAzureBatchImageGenerationWithResponseAsy * { * id: String (Required) * created: long (Required) - * expires: Long (Optional) - * result (Optional): { - * created: long (Required) - * data: DataModelBase (Required) - * } - * status: String(notRunning/running/succeeded/canceled/failed) (Required) - * 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) + * 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 imageGenerationOptions Represents the request data used to generate images. + * @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 a polling status update or final response payload for an image operation 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) - private Response beginAzureBatchImageGenerationWithResponse( - BinaryData imageGenerationOptions, RequestOptions requestOptions) { + public Response getCompletionsWithResponse( + String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.beginAzureBatchImageGenerationSync( + return service.getCompletionsSync( this.getEndpoint(), this.getServiceVersion().getVersion(), + deploymentOrModelName, accept, - imageGenerationOptions, + completionsOptions, requestOptions, Context.NONE); } /** - * Starts the generation of a batch of images from a text caption. + * 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 * *

{@code
      * {
-     *     prompt: String (Required)
-     *     n: Integer (Optional)
-     *     size: String(256x256/512x512/1024x1024) (Optional)
-     *     response_format: String(url/b64_json) (Optional)
+     *     messages (Required): [
+     *          (Required){
+     *             role: String(system/assistant/user/function/tool) (Required)
+     *             content: String (Required)
+     *             name: String (Optional)
+     *             function_call (Optional): {
+     *                 name: String (Required)
+     *                 arguments: String (Required)
+     *             }
+     *             context (Optional): {
+     *                 messages (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *         }
+     *     ]
+     *     functions (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             parameters: Object (Optional)
+     *         }
+     *     ]
+     *     function_call: FunctionCallModelBase (Optional)
+     *     max_tokens: Integer (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     logit_bias (Optional): {
+     *         String: int (Optional)
+     *     }
      *     user: String (Optional)
+     *     n: Integer (Optional)
+     *     stop (Optional): [
+     *         String (Optional)
+     *     ]
+     *     presence_penalty: Double (Optional)
+     *     frequency_penalty: Double (Optional)
+     *     stream: Boolean (Optional)
+     *     model: String (Optional)
+     *     dataSources (Optional): [
+     *          (Optional){
+     *             type: String(AzureCognitiveSearch) (Required)
+     *             parameters: Object (Required)
+     *         }
+     *     ]
      * }
      * }
* @@ -1646,66 +1321,144 @@ private Response beginAzureBatchImageGenerationWithResponse( * { * id: String (Required) * created: long (Required) - * expires: Long (Optional) - * result (Optional): { - * created: long (Required) - * data: DataModelBase (Required) - * } - * status: String(notRunning/running/succeeded/canceled/failed) (Required) - * 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){ + * message (Optional): { + * role: String(system/assistant/user/function/tool) (Required) + * content: String (Required) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } + * context (Optional): { + * messages (Optional): [ + * (recursive schema, see above) + * ] + * } + * } + * index: int (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) + * delta (Optional): (recursive schema, see delta above) + * 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) + * } + * } + * } * } + * ] + * prompt_filter_results (Optional): [ + * (Optional){ + * prompt_index: int (Required) + * content_filter_results (Optional): (recursive schema, see content_filter_results above) + * } + * ] + * usage (Required): { + * completion_tokens: int (Required) + * prompt_tokens: int (Required) + * total_tokens: int (Required) * } * } * } * - * @param imageGenerationOptions Represents the request data used to generate images. + * @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. * @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 the {@link PollerFlux} for polling of a polling status update or final response payload for an image - * operation. + * @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}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public PollerFlux beginBeginAzureBatchImageGenerationAsync( - BinaryData imageGenerationOptions, RequestOptions requestOptions) { - return PollerFlux.create( - Duration.ofSeconds(1), - () -> this.beginAzureBatchImageGenerationWithResponseAsync(imageGenerationOptions, requestOptions), - new DefaultPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.getEndpoint())) - .setContext( - requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), - TypeReference.createInstance(BinaryData.class)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Mono> getChatCompletionsWithResponseAsync( + String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return FluxUtil.withContext( + context -> + service.getChatCompletions( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + chatCompletionsOptions, + requestOptions, + context)); } /** - * Starts the generation of a batch of images from a text caption. + * 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 * *

{@code
      * {
-     *     prompt: String (Required)
-     *     n: Integer (Optional)
-     *     size: String(256x256/512x512/1024x1024) (Optional)
-     *     response_format: String(url/b64_json) (Optional)
+     *     messages (Required): [
+     *          (Required){
+     *             role: String(system/assistant/user/function/tool) (Required)
+     *             content: String (Required)
+     *             name: String (Optional)
+     *             function_call (Optional): {
+     *                 name: String (Required)
+     *                 arguments: String (Required)
+     *             }
+     *             context (Optional): {
+     *                 messages (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *         }
+     *     ]
+     *     functions (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             parameters: Object (Optional)
+     *         }
+     *     ]
+     *     function_call: FunctionCallModelBase (Optional)
+     *     max_tokens: Integer (Optional)
+     *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     logit_bias (Optional): {
+     *         String: int (Optional)
+     *     }
      *     user: String (Optional)
+     *     n: Integer (Optional)
+     *     stop (Optional): [
+     *         String (Optional)
+     *     ]
+     *     presence_penalty: Double (Optional)
+     *     frequency_penalty: Double (Optional)
+     *     stream: Boolean (Optional)
+     *     model: String (Optional)
+     *     dataSources (Optional): [
+     *          (Optional){
+     *             type: String(AzureCognitiveSearch) (Required)
+     *             parameters: Object (Required)
+     *         }
+     *     ]
      * }
      * }
* @@ -1715,165 +1468,394 @@ public PollerFlux beginBeginAzureBatchImageGenerationAsy * { * id: String (Required) * created: long (Required) - * expires: Long (Optional) - * result (Optional): { - * created: long (Required) - * data: DataModelBase (Required) - * } - * status: String(notRunning/running/succeeded/canceled/failed) (Required) - * 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){ + * message (Optional): { + * role: String(system/assistant/user/function/tool) (Required) + * content: String (Required) + * name: String (Optional) + * function_call (Optional): { + * name: String (Required) + * arguments: String (Required) + * } + * context (Optional): { + * messages (Optional): [ + * (recursive schema, see above) + * ] + * } + * } + * index: int (Required) + * finish_reason: String(stop/length/content_filter/function_call) (Required) + * delta (Optional): (recursive schema, see delta above) + * 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) + * } + * } + * } + * } + * ] + * prompt_filter_results (Optional): [ + * (Optional){ + * prompt_index: int (Required) + * content_filter_results (Optional): (recursive schema, see content_filter_results above) * } + * ] + * usage (Required): { + * completion_tokens: int (Required) + * prompt_tokens: int (Required) + * total_tokens: int (Required) * } * } * } * - * @param imageGenerationOptions Represents the request data used to generate images. + * @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. * @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 the {@link SyncPoller} for polling of a polling status update or final response payload for an image - * operation. + * @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}. */ - @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) - public SyncPoller beginBeginAzureBatchImageGeneration( - BinaryData imageGenerationOptions, RequestOptions requestOptions) { - return SyncPoller.createPoller( - Duration.ofSeconds(1), - () -> this.beginAzureBatchImageGenerationWithResponse(imageGenerationOptions, requestOptions), - new SyncDefaultPollingStrategy<>( - new PollingStrategyOptions(this.getHttpPipeline()) - .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.getEndpoint())) - .setContext( - requestOptions != null && requestOptions.getContext() != null - ? requestOptions.getContext() - : Context.NONE) - .setServiceVersion(this.getServiceVersion().getVersion())), - TypeReference.createInstance(BinaryData.class), - TypeReference.createInstance(BinaryData.class)); + @ServiceMethod(returns = ReturnType.SINGLE) + public Response getChatCompletionsWithResponse( + String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { + final String accept = "application/json"; + return service.getChatCompletionsSync( + this.getEndpoint(), + this.getServiceVersion().getVersion(), + deploymentOrModelName, + accept, + chatCompletionsOptions, + requestOptions, + Context.NONE); } /** - * 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. + * 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
      * {
-     *     file: byte[] (Required)
-     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
-     *     language: String (Optional)
-     *     prompt: String (Optional)
+     *     messages (Required): [
+     *          (Required){
+     *             role: String(system/assistant/user/function/tool) (Required)
+     *             content: String (Required)
+     *             name: String (Optional)
+     *             function_call (Optional): {
+     *                 name: String (Required)
+     *                 arguments: String (Required)
+     *             }
+     *             context (Optional): {
+     *                 messages (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *         }
+     *     ]
+     *     functions (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             parameters: Object (Optional)
+     *         }
+     *     ]
+     *     function_call: FunctionCallModelBase (Optional)
+     *     max_tokens: Integer (Optional)
      *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     logit_bias (Optional): {
+     *         String: int (Optional)
+     *     }
+     *     user: String (Optional)
+     *     n: Integer (Optional)
+     *     stop (Optional): [
+     *         String (Optional)
+     *     ]
+     *     presence_penalty: Double (Optional)
+     *     frequency_penalty: Double (Optional)
+     *     stream: Boolean (Optional)
      *     model: String (Optional)
+     *     dataSources (Optional): [
+     *          (Optional){
+     *             type: String(AzureCognitiveSearch) (Required)
+     *             parameters: Object (Required)
+     *         }
+     *     ]
      * }
      * }
* *

Response Body Schema * *

{@code
-     * String
+     * {
+     *     id: String (Required)
+     *     created: long (Required)
+     *     choices (Required): [
+     *          (Required){
+     *             message (Optional): {
+     *                 role: String(system/assistant/user/function/tool) (Required)
+     *                 content: String (Required)
+     *                 name: String (Optional)
+     *                 function_call (Optional): {
+     *                     name: String (Required)
+     *                     arguments: String (Required)
+     *                 }
+     *                 context (Optional): {
+     *                     messages (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *             }
+     *             index: int (Required)
+     *             finish_reason: String(stop/length/content_filter/function_call) (Required)
+     *             delta (Optional): (recursive schema, see delta above)
+     *             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)
+     *                     }
+     *                 }
+     *             }
+     *         }
+     *     ]
+     *     prompt_filter_results (Optional): [
+     *          (Optional){
+     *             prompt_index: int (Required)
+     *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
+     *         }
+     *     ]
+     *     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 audioTranscriptionOptions The configuration information for an audio transcription 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 transcribed text and associated metadata from provided spoken audio data 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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAudioTranscriptionAsPlainTextWithResponseAsync( - String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + public Mono> getChatCompletionsWithAzureExtensionsWithResponseAsync( + String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> - service.getAudioTranscriptionAsPlainText( + service.getChatCompletionsWithAzureExtensions( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - audioTranscriptionOptions, + chatCompletionsOptions, requestOptions, context)); } /** - * 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. + * 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
      * {
-     *     file: byte[] (Required)
-     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
-     *     language: String (Optional)
-     *     prompt: String (Optional)
+     *     messages (Required): [
+     *          (Required){
+     *             role: String(system/assistant/user/function/tool) (Required)
+     *             content: String (Required)
+     *             name: String (Optional)
+     *             function_call (Optional): {
+     *                 name: String (Required)
+     *                 arguments: String (Required)
+     *             }
+     *             context (Optional): {
+     *                 messages (Optional): [
+     *                     (recursive schema, see above)
+     *                 ]
+     *             }
+     *         }
+     *     ]
+     *     functions (Optional): [
+     *          (Optional){
+     *             name: String (Required)
+     *             description: String (Optional)
+     *             parameters: Object (Optional)
+     *         }
+     *     ]
+     *     function_call: FunctionCallModelBase (Optional)
+     *     max_tokens: Integer (Optional)
      *     temperature: Double (Optional)
+     *     top_p: Double (Optional)
+     *     logit_bias (Optional): {
+     *         String: int (Optional)
+     *     }
+     *     user: String (Optional)
+     *     n: Integer (Optional)
+     *     stop (Optional): [
+     *         String (Optional)
+     *     ]
+     *     presence_penalty: Double (Optional)
+     *     frequency_penalty: Double (Optional)
+     *     stream: Boolean (Optional)
      *     model: String (Optional)
+     *     dataSources (Optional): [
+     *          (Optional){
+     *             type: String(AzureCognitiveSearch) (Required)
+     *             parameters: Object (Required)
+     *         }
+     *     ]
      * }
      * }
* *

Response Body Schema * *

{@code
-     * String
+     * {
+     *     id: String (Required)
+     *     created: long (Required)
+     *     choices (Required): [
+     *          (Required){
+     *             message (Optional): {
+     *                 role: String(system/assistant/user/function/tool) (Required)
+     *                 content: String (Required)
+     *                 name: String (Optional)
+     *                 function_call (Optional): {
+     *                     name: String (Required)
+     *                     arguments: String (Required)
+     *                 }
+     *                 context (Optional): {
+     *                     messages (Optional): [
+     *                         (recursive schema, see above)
+     *                     ]
+     *                 }
+     *             }
+     *             index: int (Required)
+     *             finish_reason: String(stop/length/content_filter/function_call) (Required)
+     *             delta (Optional): (recursive schema, see delta above)
+     *             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)
+     *                     }
+     *                 }
+     *             }
+     *         }
+     *     ]
+     *     prompt_filter_results (Optional): [
+     *          (Optional){
+     *             prompt_index: int (Required)
+     *             content_filter_results (Optional): (recursive schema, see content_filter_results above)
+     *         }
+     *     ]
+     *     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 audioTranscriptionOptions The configuration information for an audio transcription 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 transcribed text and associated metadata from provided spoken audio data 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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAudioTranscriptionAsPlainTextWithResponse( - String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { + public Response getChatCompletionsWithAzureExtensionsWithResponse( + String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getAudioTranscriptionAsPlainTextSync( + return service.getChatCompletionsWithAzureExtensionsSync( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, accept, - audioTranscriptionOptions, + chatCompletionsOptions, requestOptions, Context.NONE); } /** - * 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. + * Starts the generation of a batch of images from a text caption. * *

Request Body Schema * *

{@code
      * {
-     *     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)
+     *     prompt: String (Required)
+     *     n: Integer (Optional)
+     *     size: String(256x256/512x512/1024x1024) (Optional)
+     *     response_format: String(url/b64_json) (Optional)
+     *     user: String (Optional)
      * }
      * }
* @@ -1881,72 +1863,65 @@ public Response getAudioTranscriptionAsPlainTextWithResponse( * *
{@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)
+     *     id: String (Required)
+     *     created: long (Required)
+     *     expires: Long (Optional)
+     *     result (Optional): {
+     *         created: long (Required)
+     *         data: DataModelBase (Required)
+     *     }
+     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
+     *     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)
      *         }
-     *     ]
+     *     }
      * }
      * }
* - * @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 imageGenerationOptions Represents the request data used to generate images. * @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} on + * @return a polling status update or final response payload for an image operation along with {@link Response} on * successful completion of {@link Mono}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAudioTranscriptionAsResponseObjectWithResponseAsync( - String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; + private Mono> beginAzureBatchImageGenerationWithResponseAsync( + BinaryData imageGenerationOptions, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> - service.getAudioTranscriptionAsResponseObject( + service.beginAzureBatchImageGeneration( this.getEndpoint(), this.getServiceVersion().getVersion(), - deploymentOrModelName, - contentType, accept, - audioTranscriptionOptions, + imageGenerationOptions, requestOptions, context)); } /** - * 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. + * Starts the generation of a batch of images from a text caption. * *

Request Body Schema * *

{@code
      * {
-     *     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)
+     *     prompt: String (Required)
+     *     n: Integer (Optional)
+     *     size: String(256x256/512x512/1024x1024) (Optional)
+     *     response_format: String(url/b64_json) (Optional)
+     *     user: String (Optional)
      * }
      * }
* @@ -1954,161 +1929,200 @@ public Mono> getAudioTranscriptionAsResponseObjectWithRespo * *
{@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)
+     *     id: String (Required)
+     *     created: long (Required)
+     *     expires: Long (Optional)
+     *     result (Optional): {
+     *         created: long (Required)
+     *         data: DataModelBase (Required)
+     *     }
+     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
+     *     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)
      *         }
-     *     ]
+     *     }
      * }
      * }
* - * @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 imageGenerationOptions Represents the request data used to generate images. * @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}. + * @return a polling status update or final response payload for an image operation along with {@link Response}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAudioTranscriptionAsResponseObjectWithResponse( - String deploymentOrModelName, BinaryData audioTranscriptionOptions, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; + private Response beginAzureBatchImageGenerationWithResponse( + BinaryData imageGenerationOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getAudioTranscriptionAsResponseObjectSync( + return service.beginAzureBatchImageGenerationSync( this.getEndpoint(), this.getServiceVersion().getVersion(), - deploymentOrModelName, - contentType, accept, - audioTranscriptionOptions, + imageGenerationOptions, requestOptions, Context.NONE); } /** - * Gets English language transcribed text and associated metadata from provided spoken audio data. + * Starts the generation of a batch of images from a text caption. * *

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)
+     *     prompt: String (Required)
+     *     n: Integer (Optional)
+     *     size: String(256x256/512x512/1024x1024) (Optional)
+     *     response_format: String(url/b64_json) (Optional)
+     *     user: String (Optional)
      * }
      * }
* *

Response Body Schema * *

{@code
-     * String
+     * {
+     *     id: String (Required)
+     *     created: long (Required)
+     *     expires: Long (Optional)
+     *     result (Optional): {
+     *         created: long (Required)
+     *         data: DataModelBase (Required)
+     *     }
+     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
+     *     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)
+     *         }
+     *     }
+     * }
      * }
* - * @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 imageGenerationOptions Represents the request data used to generate images. * @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}. + * @return the {@link PollerFlux} for polling of a polling status update or final response payload for an image + * operation. */ - @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)); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public PollerFlux beginBeginAzureBatchImageGenerationAsync( + BinaryData imageGenerationOptions, RequestOptions requestOptions) { + return PollerFlux.create( + Duration.ofSeconds(1), + () -> this.beginAzureBatchImageGenerationWithResponseAsync(imageGenerationOptions, requestOptions), + new DefaultPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.getEndpoint())) + .setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), + TypeReference.createInstance(BinaryData.class)); } /** - * Gets English language transcribed text and associated metadata from provided spoken audio data. + * Starts the generation of a batch of images from a text caption. * *

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)
+     *     prompt: String (Required)
+     *     n: Integer (Optional)
+     *     size: String(256x256/512x512/1024x1024) (Optional)
+     *     response_format: String(url/b64_json) (Optional)
+     *     user: String (Optional)
      * }
      * }
* *

Response Body Schema * *

{@code
-     * String
+     * {
+     *     id: String (Required)
+     *     created: long (Required)
+     *     expires: Long (Optional)
+     *     result (Optional): {
+     *         created: long (Required)
+     *         data: DataModelBase (Required)
+     *     }
+     *     status: String(notRunning/running/succeeded/canceled/failed) (Required)
+     *     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)
+     *         }
+     *     }
+     * }
      * }
* - * @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 imageGenerationOptions Represents the request data used to generate images. * @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}. + * @return the {@link SyncPoller} for polling of a polling status update or final response payload for an image + * operation. */ - @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); + @ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION) + public SyncPoller beginBeginAzureBatchImageGeneration( + BinaryData imageGenerationOptions, RequestOptions requestOptions) { + return SyncPoller.createPoller( + Duration.ofSeconds(1), + () -> this.beginAzureBatchImageGenerationWithResponse(imageGenerationOptions, requestOptions), + new SyncDefaultPollingStrategy<>( + new PollingStrategyOptions(this.getHttpPipeline()) + .setEndpoint("{endpoint}/openai".replace("{endpoint}", this.getEndpoint())) + .setContext( + requestOptions != null && requestOptions.getContext() != null + ? requestOptions.getContext() + : Context.NONE) + .setServiceVersion(this.getServiceVersion().getVersion())), + TypeReference.createInstance(BinaryData.class), + TypeReference.createInstance(BinaryData.class)); } /** - * Gets English language transcribed text and associated metadata from provided spoken audio data. + * Return the embeddings for a given prompt. * *

Request Body Schema * *

{@code
      * {
-     *     file: byte[] (Required)
-     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
-     *     prompt: String (Optional)
-     *     temperature: Double (Optional)
+     *     user: String (Optional)
      *     model: String (Optional)
+     *     input (Required): [
+     *         String (Required)
+     *     ]
      * }
      * }
* @@ -2116,70 +2130,63 @@ public Response getAudioTranslationAsPlainTextWithResponse( * *
{@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)
+     *     data (Required): [
+     *          (Required){
+     *             embedding (Required): [
+     *                 double (Required)
      *             ]
-     *             seek: int (Required)
+     *             index: int (Required)
      *         }
      *     ]
+     *     usage (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 audioTranslationOptions The configuration information for an audio translation 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. * @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}. + * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Mono> getAudioTranslationAsResponseObjectWithResponseAsync( - String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; + public Mono> getEmbeddingsWithResponseAsync( + String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions) { final String accept = "application/json"; return FluxUtil.withContext( context -> - service.getAudioTranslationAsResponseObject( + service.getEmbeddings( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, - contentType, accept, - audioTranslationOptions, + embeddingsOptions, requestOptions, context)); } /** - * Gets English language transcribed text and associated metadata from provided spoken audio data. + * Return the embeddings for a given prompt. * *

Request Body Schema * *

{@code
      * {
-     *     file: byte[] (Required)
-     *     response_format: String(json/verbose_json/text/srt/vtt) (Optional)
-     *     prompt: String (Optional)
-     *     temperature: Double (Optional)
+     *     user: String (Optional)
      *     model: String (Optional)
+     *     input (Required): [
+     *         String (Required)
+     *     ]
      * }
      * }
* @@ -2187,52 +2194,45 @@ public Mono> getAudioTranslationAsResponseObjectWithRespons * *
{@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)
+     *     data (Required): [
+     *          (Required){
+     *             embedding (Required): [
+     *                 double (Required)
      *             ]
-     *             seek: int (Required)
+     *             index: int (Required)
      *         }
      *     ]
+     *     usage (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 audioTranslationOptions The configuration information for an audio translation 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. * @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}. + * @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}. */ @ServiceMethod(returns = ReturnType.SINGLE) - public Response getAudioTranslationAsResponseObjectWithResponse( - String deploymentOrModelName, BinaryData audioTranslationOptions, RequestOptions requestOptions) { - final String contentType = "multipart/form-data"; + public Response getEmbeddingsWithResponse( + String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions) { final String accept = "application/json"; - return service.getAudioTranslationAsResponseObjectSync( + return service.getEmbeddingsSync( this.getEndpoint(), this.getServiceVersion().getVersion(), deploymentOrModelName, - contentType, accept, - audioTranslationOptions, + embeddingsOptions, requestOptions, Context.NONE); } diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTaskLabel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTaskLabel.java new file mode 100644 index 000000000000..9b0448240305 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTaskLabel.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** Defines the possible descriptors for available audio operation responses. */ +public final class AudioTaskLabel extends ExpandableStringEnum { + /** Accompanying response data resulted from an audio transcription task. */ + @Generated public static final AudioTaskLabel TRANSCRIBE = fromString("transcribe"); + + /** Accompanying response data resulted from an audio translation task. */ + @Generated public static final AudioTaskLabel TRANSLATE = fromString("translate"); + + /** + * Creates a new instance of AudioTaskLabel value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AudioTaskLabel() {} + + /** + * Creates or finds a AudioTaskLabel from its string representation. + * + * @param name a name to look for. + * @return the corresponding AudioTaskLabel. + */ + @Generated + @JsonCreator + public static AudioTaskLabel fromString(String name) { + return fromString(name, AudioTaskLabel.class); + } + + /** + * Gets known AudioTaskLabel values. + * + * @return known AudioTaskLabel values. + */ + @Generated + public static Collection values() { + return values(AudioTaskLabel.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscription.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscription.java new file mode 100644 index 000000000000..85be355a0f7a --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscription.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** Result information for an operation that transcribed spoken audio into written text. */ +@Immutable +public final class AudioTranscription { + /* + * The transcribed text for the provided audio data. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The label that describes which operation type generated the accompanying response data. + */ + @Generated + @JsonProperty(value = "task") + private AudioTaskLabel task; + + /* + * The spoken language that was detected in the transcribed audio data. + * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. + */ + @Generated + @JsonProperty(value = "language") + private String language; + + /* + * The total duration of the audio processed to produce accompanying transcription information. + */ + @Generated + @JsonProperty(value = "duration") + private Double duration; + + /* + * A collection of information about the timing, probabilities, and other detail of each processed audio segment. + */ + @Generated + @JsonProperty(value = "segments") + private List segments; + + /** + * Creates an instance of AudioTranscription class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private AudioTranscription(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The transcribed text for the provided audio data. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the task property: The label that describes which operation type generated the accompanying response data. + * + * @return the task value. + */ + @Generated + public AudioTaskLabel getTask() { + return this.task; + } + + /** + * Get the language property: The spoken language that was detected in the transcribed audio data. This is expressed + * as a two-letter ISO-639-1 language code like 'en' or 'fr'. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Get the duration property: The total duration of the audio processed to produce accompanying transcription + * information. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + if (this.duration == null) { + return null; + } + return Duration.ofNanos((long) (this.duration * 1000_000_000L)); + } + + /** + * Get the segments property: A collection of information about the timing, probabilities, and other detail of each + * processed audio segment. + * + * @return the segments value. + */ + @Generated + public List getSegments() { + return this.segments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscriptionSegment.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscriptionSegment.java new file mode 100644 index 000000000000..210ab719ad11 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranscriptionSegment.java @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** + * Extended information about a single segment of transcribed audio data. Segments generally represent roughly 5-10 + * seconds of speech. Segment boundaries typically occur between words but not necessarily sentences. + */ +@Immutable +public final class AudioTranscriptionSegment { + /* + * The 0-based index of this segment within a transcription. + */ + @Generated + @JsonProperty(value = "id") + private int id; + + /* + * The time at which this segment started relative to the beginning of the transcribed audio. + */ + @Generated + @JsonProperty(value = "start") + private double start; + + /* + * The time at which this segment ended relative to the beginning of the transcribed audio. + */ + @Generated + @JsonProperty(value = "end") + private double end; + + /* + * The transcribed text that was part of this audio segment. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The temperature score associated with this audio segment. + */ + @Generated + @JsonProperty(value = "temperature") + private double temperature; + + /* + * The average log probability associated with this audio segment. + */ + @Generated + @JsonProperty(value = "avg_logprob") + private double avgLogprob; + + /* + * The compression ratio of this audio segment. + */ + @Generated + @JsonProperty(value = "compression_ratio") + private double compressionRatio; + + /* + * The probability of no speech detection within this audio segment. + */ + @Generated + @JsonProperty(value = "no_speech_prob") + private double noSpeechProb; + + /* + * The token IDs matching the transcribed text in this audio segment. + */ + @Generated + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The seek position associated with the processing of this audio segment. + * Seek positions are expressed as hundredths of seconds. + * The model may process several segments from a single seek position, so while the seek position will never + * represent + * a later time than the segment's start, the segment's start may represent a significantly later time than the + * segment's associated seek position. + */ + @Generated + @JsonProperty(value = "seek") + private int seek; + + /** + * Creates an instance of AudioTranscriptionSegment class. + * + * @param id the id value to set. + * @param start the start value to set. + * @param end the end value to set. + * @param text the text value to set. + * @param temperature the temperature value to set. + * @param avgLogprob the avgLogprob value to set. + * @param compressionRatio the compressionRatio value to set. + * @param noSpeechProb the noSpeechProb value to set. + * @param tokens the tokens value to set. + * @param seek the seek value to set. + */ + @Generated + private AudioTranscriptionSegment( + int id, + Duration start, + Duration end, + String text, + double temperature, + double avgLogprob, + double compressionRatio, + double noSpeechProb, + List tokens, + int seek) { + this.id = id; + this.start = (double) start.toNanos() / 1000_000_000L; + this.end = (double) end.toNanos() / 1000_000_000L; + this.text = text; + this.temperature = temperature; + this.avgLogprob = avgLogprob; + this.compressionRatio = compressionRatio; + this.noSpeechProb = noSpeechProb; + this.tokens = tokens; + this.seek = seek; + } + + @Generated + @JsonCreator + private AudioTranscriptionSegment( + @JsonProperty(value = "id") int id, + @JsonProperty(value = "start") double start, + @JsonProperty(value = "end") double end, + @JsonProperty(value = "text") String text, + @JsonProperty(value = "temperature") double temperature, + @JsonProperty(value = "avg_logprob") double avgLogprob, + @JsonProperty(value = "compression_ratio") double compressionRatio, + @JsonProperty(value = "no_speech_prob") double noSpeechProb, + @JsonProperty(value = "tokens") List tokens, + @JsonProperty(value = "seek") int seek) { + this( + id, + Duration.ofNanos((long) (start * 1000_000_000L)), + Duration.ofNanos((long) (end * 1000_000_000L)), + text, + temperature, + avgLogprob, + compressionRatio, + noSpeechProb, + tokens, + seek); + } + + /** + * Get the id property: The 0-based index of this segment within a transcription. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the start property: The time at which this segment started relative to the beginning of the transcribed + * audio. + * + * @return the start value. + */ + @Generated + public Duration getStart() { + return Duration.ofNanos((long) (this.start * 1000_000_000L)); + } + + /** + * Get the end property: The time at which this segment ended relative to the beginning of the transcribed audio. + * + * @return the end value. + */ + @Generated + public Duration getEnd() { + return Duration.ofNanos((long) (this.end * 1000_000_000L)); + } + + /** + * Get the text property: The transcribed text that was part of this audio segment. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the temperature property: The temperature score associated with this audio segment. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } + + /** + * Get the avgLogprob property: The average log probability associated with this audio segment. + * + * @return the avgLogprob value. + */ + @Generated + public double getAvgLogprob() { + return this.avgLogprob; + } + + /** + * Get the compressionRatio property: The compression ratio of this audio segment. + * + * @return the compressionRatio value. + */ + @Generated + public double getCompressionRatio() { + return this.compressionRatio; + } + + /** + * Get the noSpeechProb property: The probability of no speech detection within this audio segment. + * + * @return the noSpeechProb value. + */ + @Generated + public double getNoSpeechProb() { + return this.noSpeechProb; + } + + /** + * Get the tokens property: The token IDs matching the transcribed text in this audio segment. + * + * @return the tokens value. + */ + @Generated + public List getTokens() { + return this.tokens; + } + + /** + * Get the seek property: The seek position associated with the processing of this audio segment. Seek positions are + * expressed as hundredths of seconds. The model may process several segments from a single seek position, so while + * the seek position will never represent a later time than the segment's start, the segment's start may represent a + * significantly later time than the segment's associated seek position. + * + * @return the seek value. + */ + @Generated + public int getSeek() { + return this.seek; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslation.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslation.java new file mode 100644 index 000000000000..be872c7b7669 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslation.java @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** Result information for an operation that translated spoken audio into written text. */ +@Immutable +public final class AudioTranslation { + /* + * The translated text for the provided audio data. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The label that describes which operation type generated the accompanying response data. + */ + @Generated + @JsonProperty(value = "task") + private AudioTaskLabel task; + + /* + * The spoken language that was detected in the translated audio data. + * This is expressed as a two-letter ISO-639-1 language code like 'en' or 'fr'. + */ + @Generated + @JsonProperty(value = "language") + private String language; + + /* + * The total duration of the audio processed to produce accompanying translation information. + */ + @Generated + @JsonProperty(value = "duration") + private Double duration; + + /* + * A collection of information about the timing, probabilities, and other detail of each processed audio segment. + */ + @Generated + @JsonProperty(value = "segments") + private List segments; + + /** + * Creates an instance of AudioTranslation class. + * + * @param text the text value to set. + */ + @Generated + @JsonCreator + private AudioTranslation(@JsonProperty(value = "text") String text) { + this.text = text; + } + + /** + * Get the text property: The translated text for the provided audio data. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the task property: The label that describes which operation type generated the accompanying response data. + * + * @return the task value. + */ + @Generated + public AudioTaskLabel getTask() { + return this.task; + } + + /** + * Get the language property: The spoken language that was detected in the translated audio data. This is expressed + * as a two-letter ISO-639-1 language code like 'en' or 'fr'. + * + * @return the language value. + */ + @Generated + public String getLanguage() { + return this.language; + } + + /** + * Get the duration property: The total duration of the audio processed to produce accompanying translation + * information. + * + * @return the duration value. + */ + @Generated + public Duration getDuration() { + if (this.duration == null) { + return null; + } + return Duration.ofNanos((long) (this.duration * 1000_000_000L)); + } + + /** + * Get the segments property: A collection of information about the timing, probabilities, and other detail of each + * processed audio segment. + * + * @return the segments value. + */ + @Generated + public List getSegments() { + return this.segments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslationSegment.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslationSegment.java new file mode 100644 index 000000000000..e4fa2e58ffd0 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AudioTranslationSegment.java @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Duration; +import java.util.List; + +/** + * Extended information about a single segment of translated audio data. Segments generally represent roughly 5-10 + * seconds of speech. Segment boundaries typically occur between words but not necessarily sentences. + */ +@Immutable +public final class AudioTranslationSegment { + /* + * The 0-based index of this segment within a translation. + */ + @Generated + @JsonProperty(value = "id") + private int id; + + /* + * The time at which this segment started relative to the beginning of the translated audio. + */ + @Generated + @JsonProperty(value = "start") + private double start; + + /* + * The time at which this segment ended relative to the beginning of the translated audio. + */ + @Generated + @JsonProperty(value = "end") + private double end; + + /* + * The translated text that was part of this audio segment. + */ + @Generated + @JsonProperty(value = "text") + private String text; + + /* + * The temperature score associated with this audio segment. + */ + @Generated + @JsonProperty(value = "temperature") + private double temperature; + + /* + * The average log probability associated with this audio segment. + */ + @Generated + @JsonProperty(value = "avg_logprob") + private double avgLogprob; + + /* + * The compression ratio of this audio segment. + */ + @Generated + @JsonProperty(value = "compression_ratio") + private double compressionRatio; + + /* + * The probability of no speech detection within this audio segment. + */ + @Generated + @JsonProperty(value = "no_speech_prob") + private double noSpeechProb; + + /* + * The token IDs matching the translated text in this audio segment. + */ + @Generated + @JsonProperty(value = "tokens") + private List tokens; + + /* + * The seek position associated with the processing of this audio segment. + * Seek positions are expressed as hundredths of seconds. + * The model may process several segments from a single seek position, so while the seek position will never + * represent + * a later time than the segment's start, the segment's start may represent a significantly later time than the + * segment's associated seek position. + */ + @Generated + @JsonProperty(value = "seek") + private int seek; + + /** + * Creates an instance of AudioTranslationSegment class. + * + * @param id the id value to set. + * @param start the start value to set. + * @param end the end value to set. + * @param text the text value to set. + * @param temperature the temperature value to set. + * @param avgLogprob the avgLogprob value to set. + * @param compressionRatio the compressionRatio value to set. + * @param noSpeechProb the noSpeechProb value to set. + * @param tokens the tokens value to set. + * @param seek the seek value to set. + */ + @Generated + private AudioTranslationSegment( + int id, + Duration start, + Duration end, + String text, + double temperature, + double avgLogprob, + double compressionRatio, + double noSpeechProb, + List tokens, + int seek) { + this.id = id; + this.start = (double) start.toNanos() / 1000_000_000L; + this.end = (double) end.toNanos() / 1000_000_000L; + this.text = text; + this.temperature = temperature; + this.avgLogprob = avgLogprob; + this.compressionRatio = compressionRatio; + this.noSpeechProb = noSpeechProb; + this.tokens = tokens; + this.seek = seek; + } + + @Generated + @JsonCreator + private AudioTranslationSegment( + @JsonProperty(value = "id") int id, + @JsonProperty(value = "start") double start, + @JsonProperty(value = "end") double end, + @JsonProperty(value = "text") String text, + @JsonProperty(value = "temperature") double temperature, + @JsonProperty(value = "avg_logprob") double avgLogprob, + @JsonProperty(value = "compression_ratio") double compressionRatio, + @JsonProperty(value = "no_speech_prob") double noSpeechProb, + @JsonProperty(value = "tokens") List tokens, + @JsonProperty(value = "seek") int seek) { + this( + id, + Duration.ofNanos((long) (start * 1000_000_000L)), + Duration.ofNanos((long) (end * 1000_000_000L)), + text, + temperature, + avgLogprob, + compressionRatio, + noSpeechProb, + tokens, + seek); + } + + /** + * Get the id property: The 0-based index of this segment within a translation. + * + * @return the id value. + */ + @Generated + public int getId() { + return this.id; + } + + /** + * Get the start property: The time at which this segment started relative to the beginning of the translated audio. + * + * @return the start value. + */ + @Generated + public Duration getStart() { + return Duration.ofNanos((long) (this.start * 1000_000_000L)); + } + + /** + * Get the end property: The time at which this segment ended relative to the beginning of the translated audio. + * + * @return the end value. + */ + @Generated + public Duration getEnd() { + return Duration.ofNanos((long) (this.end * 1000_000_000L)); + } + + /** + * Get the text property: The translated text that was part of this audio segment. + * + * @return the text value. + */ + @Generated + public String getText() { + return this.text; + } + + /** + * Get the temperature property: The temperature score associated with this audio segment. + * + * @return the temperature value. + */ + @Generated + public double getTemperature() { + return this.temperature; + } + + /** + * Get the avgLogprob property: The average log probability associated with this audio segment. + * + * @return the avgLogprob value. + */ + @Generated + public double getAvgLogprob() { + return this.avgLogprob; + } + + /** + * Get the compressionRatio property: The compression ratio of this audio segment. + * + * @return the compressionRatio value. + */ + @Generated + public double getCompressionRatio() { + return this.compressionRatio; + } + + /** + * Get the noSpeechProb property: The probability of no speech detection within this audio segment. + * + * @return the noSpeechProb value. + */ + @Generated + public double getNoSpeechProb() { + return this.noSpeechProb; + } + + /** + * Get the tokens property: The token IDs matching the translated text in this audio segment. + * + * @return the tokens value. + */ + @Generated + public List getTokens() { + return this.tokens; + } + + /** + * Get the seek property: The seek position associated with the processing of this audio segment. Seek positions are + * expressed as hundredths of seconds. The model may process several segments from a single seek position, so while + * the seek position will never represent a later time than the segment's start, the segment's start may represent a + * significantly later time than the segment's associated seek position. + * + * @return the seek value. + */ + @Generated + public int getSeek() { + return this.seek; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionConfiguration.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionConfiguration.java new file mode 100644 index 000000000000..1aa7972d3354 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionConfiguration.java @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat + * completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this + * configuration is compatible only with Azure OpenAI. + */ +@Immutable +public final class AzureChatExtensionConfiguration { + /* + * The label for the type of an Azure chat extension. This typically corresponds to a matching Azure resource. + * Azure chat extensions are only compatible with Azure OpenAI. + */ + @Generated + @JsonProperty(value = "type") + private AzureChatExtensionType type; + + /* + * The configuration payload used for the Azure chat extension. The structure payload details are specific to the + * extension being configured. + * Azure chat extensions are only compatible with Azure OpenAI. + */ + @Generated + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Creates an instance of AzureChatExtensionConfiguration class. + * + * @param type the type value to set. + * @param parameters the parameters value to set. + */ + @Generated + @JsonCreator + public AzureChatExtensionConfiguration( + @JsonProperty(value = "type") AzureChatExtensionType type, + @JsonProperty(value = "parameters") Object parameters) { + this.type = type; + this.parameters = parameters; + } + + /** + * Get the type property: The label for the type of an Azure chat extension. This typically corresponds to a + * matching Azure resource. Azure chat extensions are only compatible with Azure OpenAI. + * + * @return the type value. + */ + @Generated + public AzureChatExtensionType getType() { + return this.type; + } + + /** + * Get the parameters property: The configuration payload used for the Azure chat extension. The structure payload + * details are specific to the extension being configured. Azure chat extensions are only compatible with Azure + * OpenAI. + * + * @return the parameters value. + */ + @Generated + public Object getParameters() { + return this.parameters; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionType.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionType.java new file mode 100644 index 000000000000..45dbcf2a35cd --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionType.java @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** + * A representation of configuration data for a single Azure OpenAI chat extension. This will be used by a chat + * completions request that should use Azure OpenAI chat extensions to augment the response behavior. The use of this + * configuration is compatible only with Azure OpenAI. + */ +public final class AzureChatExtensionType extends ExpandableStringEnum { + /** Represents the use of Azure Cognitive Search as an Azure OpenAI chat extension. */ + @Generated public static final AzureChatExtensionType AZURE_COGNITIVE_SEARCH = fromString("AzureCognitiveSearch"); + + /** + * Creates a new instance of AzureChatExtensionType value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AzureChatExtensionType() {} + + /** + * Creates or finds a AzureChatExtensionType from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureChatExtensionType. + */ + @Generated + @JsonCreator + public static AzureChatExtensionType fromString(String name) { + return fromString(name, AzureChatExtensionType.class); + } + + /** + * Gets known AzureChatExtensionType values. + * + * @return known AzureChatExtensionType values. + */ + @Generated + public static Collection values() { + return values(AzureChatExtensionType.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionsMessageContext.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionsMessageContext.java new file mode 100644 index 000000000000..ea67a38d0d7f --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureChatExtensionsMessageContext.java @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; + +/** + * A representation of the additional context information available when Azure OpenAI chat extensions are involved in + * the generation of a corresponding chat completions response. This context information is only populated when using an + * Azure OpenAI request configured to use a matching extension. + */ +@Fluent +public final class AzureChatExtensionsMessageContext { + /* + * The contextual message payload associated with the Azure chat extensions used for a chat completions request. + * These messages describe the data source retrievals, plugin invocations, and other intermediate steps taken in + * the + * course of generating a chat completions response that was augmented by capabilities from Azure OpenAI chat + * extensions. + */ + @Generated + @JsonProperty(value = "messages") + private List messages; + + /** Creates an instance of AzureChatExtensionsMessageContext class. */ + @Generated + public AzureChatExtensionsMessageContext() {} + + /** + * Get the messages property: The contextual message payload associated with the Azure chat extensions used for a + * chat completions request. These messages describe the data source retrievals, plugin invocations, and other + * intermediate steps taken in the course of generating a chat completions response that was augmented by + * capabilities from Azure OpenAI chat extensions. + * + * @return the messages value. + */ + @Generated + public List getMessages() { + return this.messages; + } + + /** + * Set the messages property: The contextual message payload associated with the Azure chat extensions used for a + * chat completions request. These messages describe the data source retrievals, plugin invocations, and other + * intermediate steps taken in the course of generating a chat completions response that was augmented by + * capabilities from Azure OpenAI chat extensions. + * + * @param messages the messages value to set. + * @return the AzureChatExtensionsMessageContext object itself. + */ + @Generated + public AzureChatExtensionsMessageContext setMessages(List messages) { + this.messages = messages; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureOpenAIOperationState.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureOpenAIOperationState.java new file mode 100644 index 000000000000..f70dca99127a --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/AzureOpenAIOperationState.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The state of a job or item. */ +public final class AzureOpenAIOperationState extends ExpandableStringEnum { + /** The operation was created and is queued to be processed in the future. */ + @Generated public static final AzureOpenAIOperationState NOT_RUNNING = fromString("notRunning"); + + /** The operation has started to be processed. */ + @Generated public static final AzureOpenAIOperationState RUNNING = fromString("running"); + + /** The operation has successfully be processed and is ready for consumption. */ + @Generated public static final AzureOpenAIOperationState SUCCEEDED = fromString("succeeded"); + + /** The operation has been canceled and is incomplete. */ + @Generated public static final AzureOpenAIOperationState CANCELED = fromString("canceled"); + + /** The operation has completed processing with a failure and cannot be further consumed. */ + @Generated public static final AzureOpenAIOperationState FAILED = fromString("failed"); + + /** + * Creates a new instance of AzureOpenAIOperationState value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public AzureOpenAIOperationState() {} + + /** + * Creates or finds a AzureOpenAIOperationState from its string representation. + * + * @param name a name to look for. + * @return the corresponding AzureOpenAIOperationState. + */ + @Generated + @JsonCreator + public static AzureOpenAIOperationState fromString(String name) { + return fromString(name, AzureOpenAIOperationState.class); + } + + /** + * Gets known AzureOpenAIOperationState values. + * + * @return known AzureOpenAIOperationState values. + */ + @Generated + public static Collection values() { + return values(AzureOpenAIOperationState.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/BatchImageGenerationOperationResponse.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/BatchImageGenerationOperationResponse.java new file mode 100644 index 000000000000..8ef906769f70 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/BatchImageGenerationOperationResponse.java @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.azure.core.models.ResponseError; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** A polling status update or final response payload for an image operation. */ +@Immutable +public final class BatchImageGenerationOperationResponse { + /* + * The ID of the operation. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * A timestamp when this job or item was created (in unix epochs). + */ + @Generated + @JsonProperty(value = "created") + private long createdAt; + + /* + * A timestamp when this operation and its associated images expire and will be deleted (in unix epochs). + */ + @Generated + @JsonProperty(value = "expires") + private Long expires; + + /* + * The result of the operation if the operation succeeded. + */ + @Generated + @JsonProperty(value = "result") + private ImageGenerations result; + + /* + * The status of the operation + */ + @Generated + @JsonProperty(value = "status") + private AzureOpenAIOperationState status; + + /* + * The error if the operation failed. + */ + @Generated + @JsonProperty(value = "error") + private ResponseError error; + + /** + * Creates an instance of BatchImageGenerationOperationResponse class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param status the status value to set. + */ + @Generated + private BatchImageGenerationOperationResponse( + String id, OffsetDateTime createdAt, AzureOpenAIOperationState status) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.status = status; + } + + @Generated + @JsonCreator + private BatchImageGenerationOperationResponse( + @JsonProperty(value = "id") String id, + @JsonProperty(value = "created") long createdAt, + @JsonProperty(value = "status") AzureOpenAIOperationState status) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), status); + } + + /** + * Get the id property: The ID of the operation. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the createdAt property: A timestamp when this job or item was created (in unix epochs). + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the expires property: A timestamp when this operation and its associated images expire and will be deleted + * (in unix epochs). + * + * @return the expires value. + */ + @Generated + public Long getExpires() { + return this.expires; + } + + /** + * Get the result property: The result of the operation if the operation succeeded. + * + * @return the result value. + */ + @Generated + public ImageGenerations getResult() { + return this.result; + } + + /** + * Get the status property: The status of the operation. + * + * @return the status value. + */ + @Generated + public AzureOpenAIOperationState getStatus() { + return this.status; + } + + /** + * Get the error property: The error if the operation failed. + * + * @return the error value. + */ + @Generated + public ResponseError getError() { + return this.error; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatChoice.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatChoice.java new file mode 100644 index 000000000000..9658f669b8d2 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatChoice.java @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.ai.openai.models.CompletionsFinishReason; +import com.azure.ai.openai.models.ContentFilterResults; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The representation of a single prompt completion as part of an overall chat completions request. Generally, `n` + * choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the + * number of choices generated. + */ +@Immutable +public final class ChatChoice { + /* + * The chat message for a given chat completions prompt. + */ + @Generated + @JsonProperty(value = "message") + private ChatMessage message; + + /* + * The ordered index associated with this chat completions choice. + */ + @Generated + @JsonProperty(value = "index") + private int index; + + /* + * The reason that this chat completions choice completed its generated. + */ + @Generated + @JsonProperty(value = "finish_reason") + private CompletionsFinishReason finishReason; + + /* + * The delta message content for a streaming response. + */ + @Generated + @JsonProperty(value = "delta") + private ChatMessage delta; + + /* + * Information about the content filtering category (hate, sexual, violence, self_harm), if it + * has been detected, as well as the severity level (very_low, low, medium, high-scale that + * determines the intensity and risk level of harmful content) and if it has been filtered or not. + */ + @Generated + @JsonProperty(value = "content_filter_results") + private ContentFilterResults contentFilterResults; + + /** + * Creates an instance of ChatChoice class. + * + * @param index the index value to set. + * @param finishReason the finishReason value to set. + */ + @Generated + @JsonCreator + private ChatChoice( + @JsonProperty(value = "index") int index, + @JsonProperty(value = "finish_reason") CompletionsFinishReason finishReason) { + this.index = index; + this.finishReason = finishReason; + } + + /** + * Get the message property: The chat message for a given chat completions prompt. + * + * @return the message value. + */ + @Generated + public ChatMessage getMessage() { + return this.message; + } + + /** + * Get the index property: The ordered index associated with this chat completions choice. + * + * @return the index value. + */ + @Generated + public int getIndex() { + return this.index; + } + + /** + * Get the finishReason property: The reason that this chat completions choice completed its generated. + * + * @return the finishReason value. + */ + @Generated + public CompletionsFinishReason getFinishReason() { + return this.finishReason; + } + + /** + * Get the delta property: The delta message content for a streaming response. + * + * @return the delta value. + */ + @Generated + public ChatMessage getDelta() { + return this.delta; + } + + /** + * Get the contentFilterResults property: Information about the content filtering category (hate, sexual, violence, + * self_harm), if it has been detected, as well as the severity level (very_low, low, medium, high-scale that + * determines the intensity and risk level of harmful content) and if it has been filtered or not. + * + * @return the contentFilterResults value. + */ + @Generated + public ContentFilterResults getContentFilterResults() { + return this.contentFilterResults; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletions.java new file mode 100644 index 000000000000..a41951fba86d --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletions.java @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.ai.openai.models.CompletionsUsage; +import com.azure.ai.openai.models.PromptFilterResult; +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; +import java.util.List; + +/** + * Representation of the response data from a chat completions request. Completions support a wide variety of tasks and + * generate text that continues from or "completes" provided prompt data. + */ +@Immutable +public final class ChatCompletions { + /* + * A unique identifier associated with this chat completions response. + */ + @Generated + @JsonProperty(value = "id") + private String id; + + /* + * The first timestamp associated with generation activity for this completions response, + * represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. + */ + @Generated + @JsonProperty(value = "created") + private long createdAt; + + /* + * The collection of completions choices associated with this completions response. + * Generally, `n` choices are generated per provided prompt with a default value of 1. + * Token limits and other settings may limit the number of choices generated. + */ + @Generated + @JsonProperty(value = "choices") + private List choices; + + /* + * Content filtering results for zero or more prompts in the request. In a streaming request, + * results for different prompts may arrive at different times or in different orders. + */ + @Generated + @JsonProperty(value = "prompt_filter_results") + private List promptFilterResults; + + /* + * Usage information for tokens processed and generated as part of this completions operation. + */ + @Generated + @JsonProperty(value = "usage") + private CompletionsUsage usage; + + /** + * Creates an instance of ChatCompletions class. + * + * @param id the id value to set. + * @param createdAt the createdAt value to set. + * @param choices the choices value to set. + * @param usage the usage value to set. + */ + @Generated + private ChatCompletions(String id, OffsetDateTime createdAt, List choices, CompletionsUsage usage) { + this.id = id; + this.createdAt = createdAt.toEpochSecond(); + this.choices = choices; + this.usage = usage; + } + + @Generated + @JsonCreator + private ChatCompletions( + @JsonProperty(value = "id") String id, + @JsonProperty(value = "created") long createdAt, + @JsonProperty(value = "choices") List choices, + @JsonProperty(value = "usage") CompletionsUsage usage) { + this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), choices, usage); + } + + /** + * Get the id property: A unique identifier associated with this chat completions response. + * + * @return the id value. + */ + @Generated + public String getId() { + return this.id; + } + + /** + * Get the createdAt property: The first timestamp associated with generation activity for this completions + * response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the choices property: The collection of completions choices associated with this completions response. + * Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other + * settings may limit the number of choices generated. + * + * @return the choices value. + */ + @Generated + public List getChoices() { + return this.choices; + } + + /** + * Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a + * streaming request, results for different prompts may arrive at different times or in different orders. + * + * @return the promptFilterResults value. + */ + @Generated + public List getPromptFilterResults() { + return this.promptFilterResults; + } + + /** + * Get the usage property: Usage information for tokens processed and generated as part of this completions + * operation. + * + * @return the usage value. + */ + @Generated + public CompletionsUsage getUsage() { + return this.usage; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletionsOptions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletionsOptions.java new file mode 100644 index 000000000000..939cb8adc823 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatCompletionsOptions.java @@ -0,0 +1,531 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +/** + * 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. + */ +@Fluent +public final class ChatCompletionsOptions { + /* + * The collection of context messages associated with this chat completions request. + * Typical usage begins with a chat message for the System role that provides instructions for + * the behavior of the assistant, followed by alternating messages between the User and + * Assistant roles. + */ + @Generated + @JsonProperty(value = "messages") + private List messages; + + /* + * A list of functions the model may generate JSON inputs for. + */ + @Generated + @JsonProperty(value = "functions") + private List functions; + + /* + * Controls how the model responds to function calls. "none" means the model does not call a function, + * and responds to the end-user. "auto" means the model can pick between an end-user or calling a function. + * Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + */ + @Generated + @JsonProperty(value = "function_call") + private FunctionCallModelBase functionCall; + + /* + * The maximum number of tokens to generate. + */ + @Generated + @JsonProperty(value = "max_tokens") + private Integer maxTokens; + + /* + * The sampling temperature to use that controls the apparent creativity of generated completions. + * Higher values will make output more random while lower values will make results more focused + * and deterministic. + * It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + */ + @Generated + @JsonProperty(value = "temperature") + private Double temperature; + + /* + * An alternative to sampling with temperature called nucleus sampling. This value causes the + * model to consider the results of tokens with the provided probability mass. As an example, a + * value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be + * considered. + * It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + */ + @Generated + @JsonProperty(value = "top_p") + private Double topP; + + /* + * A map between GPT token IDs and bias scores that influences the probability of specific tokens + * appearing in a completions response. Token IDs are computed via external tokenizer tools, while + * bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to + * a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias + * score varies by model. + */ + @Generated + @JsonProperty(value = "logit_bias") + private Map logitBias; + + /* + * An identifier for the caller or end user of the operation. This may be used for tracking + * or rate-limiting purposes. + */ + @Generated + @JsonProperty(value = "user") + private String user; + + /* + * The number of chat completions choices that should be generated for a chat completions + * response. + * Because this setting can generate many completions, it may quickly consume your token quota. + * Use carefully and ensure reasonable settings for max_tokens and stop. + */ + @Generated + @JsonProperty(value = "n") + private Integer n; + + /* + * A collection of textual sequences that will end completions generation. + */ + @Generated + @JsonProperty(value = "stop") + private List stop; + + /* + * A value that influences the probability of generated tokens appearing based on their existing + * presence in generated text. + * Positive values will make tokens less likely to appear when they already exist and increase the + * model's likelihood to output new topics. + */ + @Generated + @JsonProperty(value = "presence_penalty") + private Double presencePenalty; + + /* + * A value that influences the probability of generated tokens appearing based on their cumulative + * frequency in generated text. + * Positive values will make tokens less likely to appear as their frequency increases and + * decrease the likelihood of the model repeating the same statements verbatim. + */ + @Generated + @JsonProperty(value = "frequency_penalty") + private Double frequencyPenalty; + + /* + * A value indicating whether chat completions should be streamed for this request. + */ + @Generated + @JsonProperty(value = "stream") + private Boolean stream; + + /* + * The model name to provide as part of this completions request. + * Not applicable to Azure OpenAI, where deployment information should be included in the Azure + * resource URI that's connected to. + */ + @Generated + @JsonProperty(value = "model") + private String model; + + /* + * The configuration entries for Azure OpenAI chat extensions that use them. + * This additional specification is only compatible with Azure OpenAI. + */ + @Generated + @JsonProperty(value = "dataSources") + private List dataSources; + + /** + * Creates an instance of ChatCompletionsOptions class. + * + * @param messages the messages value to set. + */ + @Generated + @JsonCreator + public ChatCompletionsOptions(@JsonProperty(value = "messages") List messages) { + this.messages = messages; + } + + /** + * Get the messages property: The collection of context messages associated with this chat completions request. + * Typical usage begins with a chat message for the System role that provides instructions for the behavior of the + * assistant, followed by alternating messages between the User and Assistant roles. + * + * @return the messages value. + */ + @Generated + public List getMessages() { + return this.messages; + } + + /** + * Get the functions property: A list of functions the model may generate JSON inputs for. + * + * @return the functions value. + */ + @Generated + public List getFunctions() { + return this.functions; + } + + /** + * Set the functions property: A list of functions the model may generate JSON inputs for. + * + * @param functions the functions value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setFunctions(List functions) { + this.functions = functions; + return this; + } + + /** + * Get the functionCall property: Controls how the model responds to function calls. "none" means the model does not + * call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a + * function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + * + * @return the functionCall value. + */ + @Generated + public FunctionCallModelBase getFunctionCall() { + return this.functionCall; + } + + /** + * Set the functionCall property: Controls how the model responds to function calls. "none" means the model does not + * call a function, and responds to the end-user. "auto" means the model can pick between an end-user or calling a + * function. Specifying a particular function via `{"name": "my_function"}` forces the model to call that function. + * "none" is the default when no functions are present. "auto" is the default if functions are present. + * + * @param functionCall the functionCall value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setFunctionCall(FunctionCallModelBase functionCall) { + this.functionCall = functionCall; + return this; + } + + /** + * Get the maxTokens property: The maximum number of tokens to generate. + * + * @return the maxTokens value. + */ + @Generated + public Integer getMaxTokens() { + return this.maxTokens; + } + + /** + * Set the maxTokens property: The maximum number of tokens to generate. + * + * @param maxTokens the maxTokens value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setMaxTokens(Integer maxTokens) { + this.maxTokens = maxTokens; + return this; + } + + /** + * Get the temperature property: The sampling temperature to use that controls the apparent creativity of generated + * completions. Higher values will make output more random while lower values will make results more focused and + * deterministic. It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + * + * @return the temperature value. + */ + @Generated + public Double getTemperature() { + return this.temperature; + } + + /** + * Set the temperature property: The sampling temperature to use that controls the apparent creativity of generated + * completions. Higher values will make output more random while lower values will make results more focused and + * deterministic. It is not recommended to modify temperature and top_p for the same completions request as the + * interaction of these two settings is difficult to predict. + * + * @param temperature the temperature value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setTemperature(Double temperature) { + this.temperature = temperature; + return this; + } + + /** + * Get the topP property: An alternative to sampling with temperature called nucleus sampling. This value causes the + * model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will + * cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to + * modify temperature and top_p for the same completions request as the interaction of these two settings is + * difficult to predict. + * + * @return the topP value. + */ + @Generated + public Double getTopP() { + return this.topP; + } + + /** + * Set the topP property: An alternative to sampling with temperature called nucleus sampling. This value causes the + * model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will + * cause only the tokens comprising the top 15% of probability mass to be considered. It is not recommended to + * modify temperature and top_p for the same completions request as the interaction of these two settings is + * difficult to predict. + * + * @param topP the topP value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setTopP(Double topP) { + this.topP = topP; + return this; + } + + /** + * Get the logitBias property: A map between GPT token IDs and bias scores that influences the probability of + * specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while + * bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or + * exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. + * + * @return the logitBias value. + */ + @Generated + public Map getLogitBias() { + return this.logitBias; + } + + /** + * Set the logitBias property: A map between GPT token IDs and bias scores that influences the probability of + * specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while + * bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or + * exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. + * + * @param logitBias the logitBias value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setLogitBias(Map logitBias) { + this.logitBias = logitBias; + return this; + } + + /** + * Get the user property: An identifier for the caller or end user of the operation. This may be used for tracking + * or rate-limiting purposes. + * + * @return the user value. + */ + @Generated + public String getUser() { + return this.user; + } + + /** + * Set the user property: An identifier for the caller or end user of the operation. This may be used for tracking + * or rate-limiting purposes. + * + * @param user the user value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setUser(String user) { + this.user = user; + return this; + } + + /** + * Get the n property: The number of chat completions choices that should be generated for a chat completions + * response. Because this setting can generate many completions, it may quickly consume your token quota. Use + * carefully and ensure reasonable settings for max_tokens and stop. + * + * @return the n value. + */ + @Generated + public Integer getN() { + return this.n; + } + + /** + * Set the n property: The number of chat completions choices that should be generated for a chat completions + * response. Because this setting can generate many completions, it may quickly consume your token quota. Use + * carefully and ensure reasonable settings for max_tokens and stop. + * + * @param n the n value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setN(Integer n) { + this.n = n; + return this; + } + + /** + * Get the stop property: A collection of textual sequences that will end completions generation. + * + * @return the stop value. + */ + @Generated + public List getStop() { + return this.stop; + } + + /** + * Set the stop property: A collection of textual sequences that will end completions generation. + * + * @param stop the stop value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setStop(List stop) { + this.stop = stop; + return this; + } + + /** + * Get the presencePenalty property: A value that influences the probability of generated tokens appearing based on + * their existing presence in generated text. Positive values will make tokens less likely to appear when they + * already exist and increase the model's likelihood to output new topics. + * + * @return the presencePenalty value. + */ + @Generated + public Double getPresencePenalty() { + return this.presencePenalty; + } + + /** + * Set the presencePenalty property: A value that influences the probability of generated tokens appearing based on + * their existing presence in generated text. Positive values will make tokens less likely to appear when they + * already exist and increase the model's likelihood to output new topics. + * + * @param presencePenalty the presencePenalty value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setPresencePenalty(Double presencePenalty) { + this.presencePenalty = presencePenalty; + return this; + } + + /** + * Get the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on + * their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their + * frequency increases and decrease the likelihood of the model repeating the same statements verbatim. + * + * @return the frequencyPenalty value. + */ + @Generated + public Double getFrequencyPenalty() { + return this.frequencyPenalty; + } + + /** + * Set the frequencyPenalty property: A value that influences the probability of generated tokens appearing based on + * their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their + * frequency increases and decrease the likelihood of the model repeating the same statements verbatim. + * + * @param frequencyPenalty the frequencyPenalty value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setFrequencyPenalty(Double frequencyPenalty) { + this.frequencyPenalty = frequencyPenalty; + return this; + } + + /** + * Get the stream property: A value indicating whether chat completions should be streamed for this request. + * + * @return the stream value. + */ + @Generated + public Boolean isStream() { + return this.stream; + } + + /** + * Set the stream property: A value indicating whether chat completions should be streamed for this request. + * + * @param stream the stream value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setStream(Boolean stream) { + this.stream = stream; + return this; + } + + /** + * Get the model property: The model name to provide as part of this completions request. Not applicable to Azure + * OpenAI, where deployment information should be included in the Azure resource URI that's connected to. + * + * @return the model value. + */ + @Generated + public String getModel() { + return this.model; + } + + /** + * Set the model property: The model name to provide as part of this completions request. Not applicable to Azure + * OpenAI, where deployment information should be included in the Azure resource URI that's connected to. + * + * @param model the model value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setModel(String model) { + this.model = model; + return this; + } + + /** + * Get the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them. This + * additional specification is only compatible with Azure OpenAI. + * + * @return the dataSources value. + */ + @Generated + public List getDataSources() { + return this.dataSources; + } + + /** + * Set the dataSources property: The configuration entries for Azure OpenAI chat extensions that use them. This + * additional specification is only compatible with Azure OpenAI. + * + * @param dataSources the dataSources value to set. + * @return the ChatCompletionsOptions object itself. + */ + @Generated + public ChatCompletionsOptions setDataSources(List dataSources) { + this.dataSources = dataSources; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatMessage.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatMessage.java new file mode 100644 index 000000000000..b358ba565009 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatMessage.java @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** A single, role-attributed message within a chat completion interaction. */ +@Fluent +public final class ChatMessage { + /* + * The role associated with this message payload. + */ + @Generated + @JsonProperty(value = "role") + private ChatRole role; + + /* + * The text associated with this message payload. + */ + @Generated + @JsonProperty(value = "content") + private String content; + + /* + * The name of the author of this message. `name` is required if role is `function`, and it should be the name of + * the + * function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length + * of + * 64 characters. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The name and arguments of a function that should be called, as generated by the model. + */ + @Generated + @JsonProperty(value = "function_call") + private FunctionCall functionCall; + + /* + * Additional context data associated with a chat message when requesting chat completions using compatible Azure + * OpenAI chat extensions. This includes information like the intermediate data source retrievals used to service a + * request. + * This context information is only populated when using Azure OpenAI with chat extensions capabilities configured. + */ + @Generated + @JsonProperty(value = "context") + private AzureChatExtensionsMessageContext context; + + /** + * Creates an instance of ChatMessage class. + * + * @param role the role value to set. + * @param content the content value to set. + */ + @Generated + @JsonCreator + public ChatMessage(@JsonProperty(value = "role") ChatRole role, @JsonProperty(value = "content") String content) { + this.role = role; + this.content = content; + } + + /** + * Get the role property: The role associated with this message payload. + * + * @return the role value. + */ + @Generated + public ChatRole getRole() { + return this.role; + } + + /** + * Get the content property: The text associated with this message payload. + * + * @return the content value. + */ + @Generated + public String getContent() { + return this.content; + } + + /** + * Get the name property: The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and + * underscores, with a maximum length of 64 characters. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Set the name property: The name of the author of this message. `name` is required if role is `function`, and it + * should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and + * underscores, with a maximum length of 64 characters. + * + * @param name the name value to set. + * @return the ChatMessage object itself. + */ + @Generated + public ChatMessage setName(String name) { + this.name = name; + return this; + } + + /** + * Get the functionCall property: The name and arguments of a function that should be called, as generated by the + * model. + * + * @return the functionCall value. + */ + @Generated + public FunctionCall getFunctionCall() { + return this.functionCall; + } + + /** + * Set the functionCall property: The name and arguments of a function that should be called, as generated by the + * model. + * + * @param functionCall the functionCall value to set. + * @return the ChatMessage object itself. + */ + @Generated + public ChatMessage setFunctionCall(FunctionCall functionCall) { + this.functionCall = functionCall; + return this; + } + + /** + * Get the context property: Additional context data associated with a chat message when requesting chat completions + * using compatible Azure OpenAI chat extensions. This includes information like the intermediate data source + * retrievals used to service a request. This context information is only populated when using Azure OpenAI with + * chat extensions capabilities configured. + * + * @return the context value. + */ + @Generated + public AzureChatExtensionsMessageContext getContext() { + return this.context; + } + + /** + * Set the context property: Additional context data associated with a chat message when requesting chat completions + * using compatible Azure OpenAI chat extensions. This includes information like the intermediate data source + * retrievals used to service a request. This context information is only populated when using Azure OpenAI with + * chat extensions capabilities configured. + * + * @param context the context value to set. + * @return the ChatMessage object itself. + */ + @Generated + public ChatMessage setContext(AzureChatExtensionsMessageContext context) { + this.context = context; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatRole.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatRole.java new file mode 100644 index 000000000000..3dd2483fcc02 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ChatRole.java @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** A description of the intended purpose of a message within a chat completions interaction. */ +public final class ChatRole extends ExpandableStringEnum { + /** The role that instructs or sets the behavior of the assistant. */ + @Generated public static final ChatRole SYSTEM = fromString("system"); + + /** The role that provides responses to system-instructed, user-prompted input. */ + @Generated public static final ChatRole ASSISTANT = fromString("assistant"); + + /** The role that provides input for chat completions. */ + @Generated public static final ChatRole USER = fromString("user"); + + /** The role that provides function results for chat completions. */ + @Generated public static final ChatRole FUNCTION = fromString("function"); + + /** The role that represents extension tool activity within a chat completions operation. */ + @Generated public static final ChatRole TOOL = fromString("tool"); + + /** + * Creates a new instance of ChatRole value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ChatRole() {} + + /** + * Creates or finds a ChatRole from its string representation. + * + * @param name a name to look for. + * @return the corresponding ChatRole. + */ + @Generated + @JsonCreator + public static ChatRole fromString(String name) { + return fromString(name, ChatRole.class); + } + + /** + * Gets known ChatRole values. + * + * @return known ChatRole values. + */ + @Generated + public static Collection values() { + return values(ChatRole.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/DataModelBase.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/DataModelBase.java new file mode 100644 index 000000000000..fc47b818a061 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/DataModelBase.java @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +/** The DataModelBase model. */ +public abstract class DataModelBase { + /** Creates an instance of DataModelBase class. */ + protected DataModelBase() {} +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCall.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCall.java new file mode 100644 index 000000000000..557b906e4b4d --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionCall.java @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** The name and arguments of a function that should be called, as generated by the model. */ +@Immutable +public final class FunctionCall { + /* + * The name of the function to call. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * The arguments to call the function with, as generated by the model in JSON format. + * Note that the model does not always generate valid JSON, and may hallucinate parameters + * not defined by your function schema. Validate the arguments in your code before calling + * your function. + */ + @Generated + @JsonProperty(value = "arguments") + private String arguments; + + /** + * Creates an instance of FunctionCall class. + * + * @param name the name value to set. + * @param arguments the arguments value to set. + */ + @Generated + @JsonCreator + public FunctionCall( + @JsonProperty(value = "name") String name, @JsonProperty(value = "arguments") String arguments) { + this.name = name; + this.arguments = arguments; + } + + /** + * Get the name property: The name of the function to call. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the arguments property: The arguments to call the function with, as generated by the model in JSON format. + * Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your + * function schema. Validate the arguments in your code before calling your function. + * + * @return the arguments value. + */ + @Generated + public String getArguments() { + return this.arguments; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionDefinition.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionDefinition.java new file mode 100644 index 000000000000..c9dcc2c18fa1 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionDefinition.java @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * The definition of a caller-specified function that chat completions may invoke in response to matching user input. + */ +@Fluent +public final class FunctionDefinition { + /* + * The name of the function to be called. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /* + * A description of what the function does. The model will use this description when selecting the function and + * interpreting its parameters. + */ + @Generated + @JsonProperty(value = "description") + private String description; + + /* + * The parameters the functions accepts, described as a JSON Schema object. + */ + @Generated + @JsonProperty(value = "parameters") + private Object parameters; + + /** + * Creates an instance of FunctionDefinition class. + * + * @param name the name value to set. + */ + @Generated + @JsonCreator + public FunctionDefinition(@JsonProperty(value = "name") String name) { + this.name = name; + } + + /** + * Get the name property: The name of the function to be called. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } + + /** + * Get the description property: A description of what the function does. The model will use this description when + * selecting the function and interpreting its parameters. + * + * @return the description value. + */ + @Generated + public String getDescription() { + return this.description; + } + + /** + * Set the description property: A description of what the function does. The model will use this description when + * selecting the function and interpreting its parameters. + * + * @param description the description value to set. + * @return the FunctionDefinition object itself. + */ + @Generated + public FunctionDefinition setDescription(String description) { + this.description = description; + return this; + } + + /** + * Get the parameters property: The parameters the functions accepts, described as a JSON Schema object. + * + * @return the parameters value. + */ + @Generated + public Object getParameters() { + return this.parameters; + } + + /** + * Set the parameters property: The parameters the functions accepts, described as a JSON Schema object. + * + * @param parameters the parameters value to set. + * @return the FunctionDefinition object itself. + */ + @Generated + public FunctionDefinition setParameters(Object parameters) { + this.parameters = parameters; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionName.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionName.java new file mode 100644 index 000000000000..3ff2f6c64105 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionName.java @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * A structure that specifies the exact name of a specific, request-provided function to use when processing a chat + * completions operation. + */ +@Immutable +public final class FunctionName { + /* + * The name of the function to call. + */ + @Generated + @JsonProperty(value = "name") + private String name; + + /** + * Creates an instance of FunctionName class. + * + * @param name the name value to set. + */ + @Generated + @JsonCreator + public FunctionName(@JsonProperty(value = "name") String name) { + this.name = name; + } + + /** + * Get the name property: The name of the function to call. + * + * @return the name value. + */ + @Generated + public String getName() { + return this.name; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionNameFunctionCallModel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionNameFunctionCallModel.java index a33076df2d89..0310448018a5 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionNameFunctionCallModel.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/FunctionNameFunctionCallModel.java @@ -4,7 +4,6 @@ package com.azure.ai.openai.implementation.models; -import com.azure.ai.openai.models.FunctionName; import com.azure.core.annotation.Immutable; import com.fasterxml.jackson.annotation.JsonValue; diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationOptions.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationOptions.java new file mode 100644 index 000000000000..3aedadeec0cb --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationOptions.java @@ -0,0 +1,165 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Fluent; +import com.azure.core.annotation.Generated; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** Represents the request data used to generate images. */ +@Fluent +public final class ImageGenerationOptions { + /* + * A description of the desired images. + */ + @Generated + @JsonProperty(value = "prompt") + private String prompt; + + /* + * The number of images to generate (defaults to 1). + */ + @Generated + @JsonProperty(value = "n") + private Integer n; + + /* + * The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024). + */ + @Generated + @JsonProperty(value = "size") + private ImageSize size; + + /* + * The format in which image generation response items should be presented. + * Azure OpenAI only supports URL response items. + */ + @Generated + @JsonProperty(value = "response_format") + private ImageGenerationResponseFormat responseFormat; + + /* + * A unique identifier representing your end-user, which can help to monitor and detect abuse. + */ + @Generated + @JsonProperty(value = "user") + private String user; + + /** + * Creates an instance of ImageGenerationOptions class. + * + * @param prompt the prompt value to set. + */ + @Generated + @JsonCreator + public ImageGenerationOptions(@JsonProperty(value = "prompt") String prompt) { + this.prompt = prompt; + } + + /** + * Get the prompt property: A description of the desired images. + * + * @return the prompt value. + */ + @Generated + public String getPrompt() { + return this.prompt; + } + + /** + * Get the n property: The number of images to generate (defaults to 1). + * + * @return the n value. + */ + @Generated + public Integer getN() { + return this.n; + } + + /** + * Set the n property: The number of images to generate (defaults to 1). + * + * @param n the n value to set. + * @return the ImageGenerationOptions object itself. + */ + @Generated + public ImageGenerationOptions setN(Integer n) { + this.n = n; + return this; + } + + /** + * Get the size property: The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 + * (defaults to 1024x1024). + * + * @return the size value. + */ + @Generated + public ImageSize getSize() { + return this.size; + } + + /** + * Set the size property: The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 + * (defaults to 1024x1024). + * + * @param size the size value to set. + * @return the ImageGenerationOptions object itself. + */ + @Generated + public ImageGenerationOptions setSize(ImageSize size) { + this.size = size; + return this; + } + + /** + * Get the responseFormat property: The format in which image generation response items should be presented. Azure + * OpenAI only supports URL response items. + * + * @return the responseFormat value. + */ + @Generated + public ImageGenerationResponseFormat getResponseFormat() { + return this.responseFormat; + } + + /** + * Set the responseFormat property: The format in which image generation response items should be presented. Azure + * OpenAI only supports URL response items. + * + * @param responseFormat the responseFormat value to set. + * @return the ImageGenerationOptions object itself. + */ + @Generated + public ImageGenerationOptions setResponseFormat(ImageGenerationResponseFormat responseFormat) { + this.responseFormat = responseFormat; + return this; + } + + /** + * Get the user property: A unique identifier representing your end-user, which can help to monitor and detect + * abuse. + * + * @return the user value. + */ + @Generated + public String getUser() { + return this.user; + } + + /** + * Set the user property: A unique identifier representing your end-user, which can help to monitor and detect + * abuse. + * + * @param user the user value to set. + * @return the ImageGenerationOptions object itself. + */ + @Generated + public ImageGenerationOptions setUser(String user) { + this.user = user; + return this; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationResponseFormat.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationResponseFormat.java new file mode 100644 index 000000000000..234bf907fc5b --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerationResponseFormat.java @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The format in which the generated images are returned. */ +public final class ImageGenerationResponseFormat extends ExpandableStringEnum { + /** Image generation response items should provide a URL from which the image may be retrieved. */ + @Generated public static final ImageGenerationResponseFormat URL = fromString("url"); + + /** Image generation response items should provide image data as a base64-encoded string. */ + @Generated public static final ImageGenerationResponseFormat BASE64 = fromString("b64_json"); + + /** + * Creates a new instance of ImageGenerationResponseFormat value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageGenerationResponseFormat() {} + + /** + * Creates or finds a ImageGenerationResponseFormat from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageGenerationResponseFormat. + */ + @Generated + @JsonCreator + public static ImageGenerationResponseFormat fromString(String name) { + return fromString(name, ImageGenerationResponseFormat.class); + } + + /** + * Gets known ImageGenerationResponseFormat values. + * + * @return known ImageGenerationResponseFormat values. + */ + @Generated + public static Collection values() { + return values(ImageGenerationResponseFormat.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerations.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerations.java new file mode 100644 index 000000000000..90f5438cd1d5 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageGenerations.java @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.time.Instant; +import java.time.OffsetDateTime; +import java.time.ZoneOffset; + +/** The result of the operation if the operation succeeded. */ +@Immutable +public final class ImageGenerations { + /* + * A timestamp when this job or item was created (in unix epochs). + */ + @Generated + @JsonProperty(value = "created") + private long createdAt; + + /* + * The images generated by the operator. + */ + @Generated + @JsonProperty(value = "data") + private DataModelBase data; + + /** + * Creates an instance of ImageGenerations class. + * + * @param createdAt the createdAt value to set. + * @param data the data value to set. + */ + @Generated + public ImageGenerations(OffsetDateTime createdAt, DataModelBase data) { + this.createdAt = createdAt.toEpochSecond(); + this.data = data; + } + + @Generated + @JsonCreator + private ImageGenerations( + @JsonProperty(value = "created") long createdAt, @JsonProperty(value = "data") DataModelBase data) { + this(OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), data); + } + + /** + * Get the createdAt property: A timestamp when this job or item was created (in unix epochs). + * + * @return the createdAt value. + */ + @Generated + public OffsetDateTime getCreatedAt() { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC); + } + + /** + * Get the data property: The images generated by the operator. + * + * @return the data value. + */ + @Generated + public DataModelBase getData() { + return this.data; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocation.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocation.java new file mode 100644 index 000000000000..186a9bddcadb --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocation.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An image response item that provides a URL from which an image may be accessed. */ +@Immutable +public final class ImageLocation { + /* + * The URL that provides temporary access to download the generated image. + */ + @Generated + @JsonProperty(value = "url") + private String url; + + /** + * Creates an instance of ImageLocation class. + * + * @param url the url value to set. + */ + @Generated + @JsonCreator + public ImageLocation(@JsonProperty(value = "url") String url) { + this.url = url; + } + + /** + * Get the url property: The URL that provides temporary access to download the generated image. + * + * @return the url value. + */ + @Generated + public String getUrl() { + return this.url; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocationListDataModel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocationListDataModel.java new file mode 100644 index 000000000000..d27d0d479ce2 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageLocationListDataModel.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.List; + +/** The ImageLocationListDataModel model. */ +@Immutable +public final class ImageLocationListDataModel extends DataModelBase { + private final List value; + + /** + * Creates an instance of ImageLocationListDataModel class. + * + * @param value the value. + */ + public ImageLocationListDataModel(List value) { + this.value = value; + } + + /** + * Gets the value. + * + * @return the value. + */ + @JsonValue + public List getValue() { + return this.value; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayload.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayload.java new file mode 100644 index 000000000000..adf846279ed3 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayload.java @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** An image response item that directly represents the image data as a base64-encoded string. */ +@Immutable +public final class ImagePayload { + /* + * The complete data for an image represented as a base64-encoded string. + */ + @Generated + @JsonProperty(value = "b64_json") + private String base64Data; + + /** + * Creates an instance of ImagePayload class. + * + * @param base64Data the base64Data value to set. + */ + @Generated + @JsonCreator + public ImagePayload(@JsonProperty(value = "b64_json") String base64Data) { + this.base64Data = base64Data; + } + + /** + * Get the base64Data property: The complete data for an image represented as a base64-encoded string. + * + * @return the base64Data value. + */ + @Generated + public String getBase64Data() { + return this.base64Data; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayloadListDataModel.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayloadListDataModel.java new file mode 100644 index 000000000000..b6c5c36562c7 --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImagePayloadListDataModel.java @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Immutable; +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.List; + +/** The ImagePayloadListDataModel model. */ +@Immutable +public final class ImagePayloadListDataModel extends DataModelBase { + private final List value; + + /** + * Creates an instance of ImagePayloadListDataModel class. + * + * @param value the value. + */ + public ImagePayloadListDataModel(List value) { + this.value = value; + } + + /** + * Gets the value. + * + * @return the value. + */ + @JsonValue + public List getValue() { + return this.value; + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageSize.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageSize.java new file mode 100644 index 000000000000..f3151156079d --- /dev/null +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/ImageSize.java @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. +// Code generated by Microsoft (R) TypeSpec Code Generator. + +package com.azure.ai.openai.implementation.models; + +import com.azure.core.annotation.Generated; +import com.azure.core.util.ExpandableStringEnum; +import com.fasterxml.jackson.annotation.JsonCreator; +import java.util.Collection; + +/** The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. */ +public final class ImageSize extends ExpandableStringEnum { + /** Image size of 256x256. */ + @Generated public static final ImageSize SIZE256X256 = fromString("256x256"); + + /** Image size of 512x512. */ + @Generated public static final ImageSize SIZE512X512 = fromString("512x512"); + + /** Image size of 1024x1024. */ + @Generated public static final ImageSize SIZE1024X1024 = fromString("1024x1024"); + + /** + * Creates a new instance of ImageSize value. + * + * @deprecated Use the {@link #fromString(String)} factory method. + */ + @Generated + @Deprecated + public ImageSize() {} + + /** + * Creates or finds a ImageSize from its string representation. + * + * @param name a name to look for. + * @return the corresponding ImageSize. + */ + @Generated + @JsonCreator + public static ImageSize fromString(String name) { + return fromString(name, ImageSize.class); + } + + /** + * Gets known ImageSize values. + * + * @return known ImageSize values. + */ + @Generated + public static Collection values() { + return values(ImageSize.class); + } +} diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/package-info.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/package-info.java index b13d7b0f681e..6a7aeeb59c06 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/package-info.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/models/package-info.java @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - /** Package containing the data models for OpenAI. Azure OpenAI APIs for completions and search. */ package com.azure.ai.openai.implementation.models; diff --git a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/package-info.java b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/package-info.java index 722ea38f511c..ae676025a6b6 100644 --- a/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/package-info.java +++ b/sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/package-info.java @@ -1,6 +1,5 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. // Code generated by Microsoft (R) TypeSpec Code Generator. - /** Package containing the implementations for OpenAI. Azure OpenAI APIs for completions and search. */ package com.azure.ai.openai.implementation; diff --git a/sdk/openai/azure-ai-openai/tsp-location.yaml b/sdk/openai/azure-ai-openai/tsp-location.yaml index 9dbc49d97eac..99441732fa00 100644 --- a/sdk/openai/azure-ai-openai/tsp-location.yaml +++ b/sdk/openai/azure-ai-openai/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/cognitiveservices/OpenAI.Inference -additionalDirectories: - - specification/cognitiveservices/OpenAI.Authoring -commit: 90247ef2960fbe11e8639c796f9bf1d2c90bb79f +commit: 6365dbb61c4be5f2b5afa1b499dc27d101c0233c +additionalDirectories: [] repo: Azure/azure-rest-api-specs +