OpenAIAsyncClient Class

  • java.lang.Object
    • com.azure.ai.openai.OpenAIAsyncClient

public final class OpenAIAsyncClient

Initializes a new instance of the asynchronous OpenAIClient type.

Method Summary

Modifier and Type Method and Description
Mono<BinaryData> generateSpeechFromText(String deploymentOrModelName, SpeechGenerationOptions speechGenerationOptions)

Generates text-to-speech audio from the input text.

Mono<Response<BinaryData>> generateSpeechFromTextWithResponse(String deploymentOrModelName, BinaryData speechGenerationOptions, RequestOptions requestOptions)

Generates text-to-speech audio from the input text.

Mono<AudioTranscription> getAudioTranscription(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions)

Gets transcribed text and associated metadata from provided spoken audio file data.

Mono<String> getAudioTranscriptionAsPlainText(String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions)

Gets transcribed text and associated metadata from provided spoken audio data.

Mono<String> getAudioTranscriptionText(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions)

Gets transcribed text and associated metadata from provided spoken audio file data.

Mono<Response<String>> getAudioTranscriptionTextWithResponse(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions)

Gets transcribed text and associated metadata from provided spoken audio file data.

Mono<Response<AudioTranscription>> getAudioTranscriptionWithResponse(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions)

Gets transcribed text and associated metadata from provided spoken audio file data.

Mono<AudioTranslation> getAudioTranslation(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Mono<String> getAudioTranslationAsPlainText(String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio data.

Mono<String> getAudioTranslationText(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Mono<Response<String>> getAudioTranslationTextWithResponse(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Mono<Response<AudioTranslation>> getAudioTranslationWithResponse(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Mono<ChatCompletions> getChatCompletions(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions)

Gets chat completions for the provided chat messages.

Flux<ChatCompletions> getChatCompletionsStream(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions)

Gets chat completions for the provided chat messages.

Flux<Response<ChatCompletions>> getChatCompletionsStreamWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages.

Mono<Response<ChatCompletions>> getChatCompletionsWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages.

Mono<Response<BinaryData>> getChatCompletionsWithResponse(String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages.

Mono<Completions> getCompletions(String deploymentOrModelName, CompletionsOptions completionsOptions)

Gets completions for the provided input prompts.

Mono<Completions> getCompletions(String deploymentOrModelName, String prompt)

Gets completions for the provided input prompt.

Flux<Completions> getCompletionsStream(String deploymentOrModelName, CompletionsOptions completionsOptions)

Gets completions as a stream for the provided input prompts.

Mono<Response<Completions>> getCompletionsWithResponse(String deploymentOrModelName, CompletionsOptions completionsOptions, RequestOptions requestOptions)

Gets completions for the provided input prompts.

Mono<Response<BinaryData>> getCompletionsWithResponse(String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions)

Gets completions for the provided input prompts.

Mono<Embeddings> getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions)

Return the embeddings for a given prompt.

Mono<Response<Embeddings>> getEmbeddingsWithResponse(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions)

Return the embeddings for a given prompt.

Mono<Response<BinaryData>> getEmbeddingsWithResponse(String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions)

Return the embeddings for a given prompt.

Mono<ImageGenerations> getImageGenerations(String deploymentOrModelName, ImageGenerationOptions imageGenerationOptions)

Creates an image given a prompt.

Methods inherited from java.lang.Object

Method Details

generateSpeechFromText

public Mono generateSpeechFromText(String deploymentOrModelName, SpeechGenerationOptions speechGenerationOptions)

Generates text-to-speech audio from the input text.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
speechGenerationOptions - A representation of the request options that control the behavior of a text-to-speech operation.

Returns:

the response body on successful completion of Mono.

generateSpeechFromTextWithResponse

public Mono<>> generateSpeechFromTextWithResponse(String deploymentOrModelName, BinaryData speechGenerationOptions, RequestOptions requestOptions)

Generates text-to-speech audio from the input text.

Request Body Schema

{
     input: String (Required)
     voice: String(alloy/echo/fable/onyx/nova/shimmer) (Required)
     response_format: String(mp3/opus/aac/flac) (Optional)
     speed: Double (Optional)
 }

Response Body Schema

BinaryData

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
speechGenerationOptions - A representation of the request options that control the behavior of a text-to-speech operation.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

the response body along with Response<T> on successful completion of Mono.

getAudioTranscription

public Mono getAudioTranscription(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions)

Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in the written language corresponding to the language it was spoken in.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranscriptionOptions
audioTranscriptionOptions - The configuration information for an audio transcription request.

Returns:

AudioTranscription transcribed text and associated metadata from provided spoken audio data on successful completion of Mono.

getAudioTranscriptionAsPlainText

public Mono getAudioTranscriptionAsPlainText(String deploymentOrModelName, AudioTranscriptionOptions audioTranscriptionOptions)

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.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
audioTranscriptionOptions - The configuration information for an audio transcription request.

Returns:

transcribed text and associated metadata from provided spoken audio data on successful completion of Mono.

getAudioTranscriptionText

public Mono getAudioTranscriptionText(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions)

Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in the written language corresponding to the language it was spoken in.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranscriptionOptions
audioTranscriptionOptions - The configuration information for an audio transcription request.

Returns:

transcribed text and associated metadata from provided spoken audio data on successful completion of Mono.

getAudioTranscriptionTextWithResponse

public Mono<>> getAudioTranscriptionTextWithResponse(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions)

Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in the written language corresponding to the language it was spoken in.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranscriptionOptions
audioTranscriptionOptions - The configuration information for an audio transcription request.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

transcribed text and associated metadata from provided spoken audio file data along with Response<T> on successful completion of Mono.

getAudioTranscriptionWithResponse

public Mono<>> getAudioTranscriptionWithResponse(String deploymentOrModelName, String fileName, AudioTranscriptionOptions audioTranscriptionOptions, RequestOptions requestOptions)

Gets transcribed text and associated metadata from provided spoken audio file data. Audio will be transcribed in the written language corresponding to the language it was spoken in.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranscriptionOptions
audioTranscriptionOptions - The configuration information for an audio transcription request.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

AudioTranscription transcribed text and associated metadata from provided spoken audio data on successful completion of Mono.

getAudioTranslation

public Mono getAudioTranslation(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranslationOptions
audioTranslationOptions - The configuration information for an audio translation request.

Returns:

AudioTranslation english language transcribed text and associated metadata from provided spoken audio file data on successful completion of Mono.

getAudioTranslationAsPlainText

public Mono getAudioTranslationAsPlainText(String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
audioTranslationOptions - The configuration information for an audio translation request.

Returns:

english language transcribed text and associated metadata from provided spoken audio data on successful completion of Mono.

getAudioTranslationText

public Mono getAudioTranslationText(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranslationOptions.
audioTranslationOptions - The configuration information for an audio translation request.

Returns:

english language transcribed text and associated metadata from provided spoken audio file data on successful completion of Mono.

getAudioTranslationTextWithResponse

public Mono<>> getAudioTranslationTextWithResponse(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranslationOptions.
audioTranslationOptions - The configuration information for an audio translation request.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

english language transcribed text and associated metadata from provided spoken audio file data on successful completion of Mono.

getAudioTranslationWithResponse

public Mono<>> getAudioTranslationWithResponse(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions, RequestOptions requestOptions)

Gets English language transcribed text and associated metadata from provided spoken audio file data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
fileName - The file name that is represented in the file field of AudioTranslationOptions
audioTranslationOptions - The configuration information for an audio translation request.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

AudioTranslation english language transcribed text and associated metadata from provided spoken audio file data along with Response<T> on successful completion of Mono.

getChatCompletions

public Mono getChatCompletions(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions)

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.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.

Returns:

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 on successful completion of Mono.

getChatCompletionsStream

public Flux getChatCompletionsStream(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions)

Gets chat completions for the provided chat messages. Chat completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.

Returns:

chat completions stream for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

getChatCompletionsStreamWithResponse

public Flux<>> getChatCompletionsStreamWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages. Chat completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Code Samples

openAIAsyncClient.getChatCompletionsStreamWithResponse(deploymentOrModelId, new ChatCompletionsOptions(chatMessages),
                 new RequestOptions().setHeader("my-header", "my-header-value"))
         .subscribe(
                 response -> System.out.print(response.getValue().getId()),
                 error -> System.err.println("There was an error getting chat completions." + error),
                 () -> System.out.println("Completed called getChatCompletionsStreamWithResponse."));

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

chat completions stream for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

getChatCompletionsWithResponse

public Mono<>> getChatCompletionsWithResponse(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Request Body Schema

{
     messages (Required): [
          (Required){
             role: String(system/assistant/user) (Required)
             content: String (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)
 }

Response Body Schema

{
     id: String (Required)
     created: int (Required)
     choices (Required): [
          (Required){
             message (Optional): {
                 role: String(system/assistant/user) (Required)
                 content: String (Optional)
             }
             index: int (Required)
             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
             delta (Optional): {
                 role: String(system/assistant/user) (Optional)
                 content: String (Optional)
             }
         }
     ]
     usage (Required): {
         completion_tokens: int (Required)
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getChatCompletionsWithResponse

public Mono<>> getChatCompletionsWithResponse(String deploymentOrModelName, BinaryData chatCompletionsOptions, RequestOptions requestOptions)

Gets chat completions for the provided chat messages. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Request Body Schema

{
     messages (Required): [
          (Required){
             role: String(system/assistant/user) (Required)
             content: String (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)
 }

Response Body Schema

{
     id: String (Required)
     created: int (Required)
     choices (Required): [
          (Required){
             message (Optional): {
                 role: String(system/assistant/user) (Required)
                 content: String (Optional)
             }
             index: int (Required)
             finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
             delta (Optional): {
                 role: String(system/assistant/user) (Optional)
                 content: String (Optional)
             }
         }
     ]
     usage (Required): {
         completion_tokens: int (Required)
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getCompletions

public Mono getCompletions(String deploymentOrModelName, CompletionsOptions completionsOptions)

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.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.

Returns:

completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data on successful completion of Mono.

getCompletions

public Mono getCompletions(String deploymentOrModelName, String prompt)

Gets completions for the provided input prompt. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
prompt - The prompt to generate completion text from.

Returns:

completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data on successful completion of Mono.

getCompletionsStream

public Flux getCompletionsStream(String deploymentOrModelName, CompletionsOptions completionsOptions)

Gets completions as a stream for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Code Samples

openAIAsyncClient
         .getChatCompletionsStream(deploymentOrModelId, new ChatCompletionsOptions(chatMessages))
         .subscribe(
                 chatCompletions -> System.out.print(chatCompletions.getId()),
                 error -> System.err.println("There was an error getting chat completions." + error),
                 () -> System.out.println("Completed called getChatCompletionsStream."));

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.

Returns:

a Flux of completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

getCompletionsWithResponse

public Mono<>> getCompletionsWithResponse(String deploymentOrModelName, CompletionsOptions completionsOptions, RequestOptions requestOptions)

Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Request Body Schema

{
     prompt (Required): [
         String (Required)
     ]
     max_tokens: Integer (Optional)
     temperature: Double (Optional)
     top_p: Double (Optional)
     logit_bias (Optional): {
         String: int (Optional)
     }
     user: String (Optional)
     n: Integer (Optional)
     logprobs: Integer (Optional)
     echo: Boolean (Optional)
     stop (Optional): [
         String (Optional)
     ]
     presence_penalty: Double (Optional)
     frequency_penalty: Double (Optional)
     best_of: Integer (Optional)
     stream: Boolean (Optional)
     model: String (Optional)
 }

Response Body Schema

{
     id: String (Required)
     created: int (Required)
     choices (Required): [
          (Required){
             text: String (Required)
             index: int (Required)
             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(stopped/tokenLimitReached/contentFiltered) (Required)
         }
     ]
     usage (Required): {
         completion_tokens: int (Required)
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getCompletionsWithResponse

public Mono<>> getCompletionsWithResponse(String deploymentOrModelName, BinaryData completionsOptions, RequestOptions requestOptions)

Gets completions for the provided input prompts. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.

Request Body Schema

{
     prompt (Required): [
         String (Required)
     ]
     max_tokens: Integer (Optional)
     temperature: Double (Optional)
     top_p: Double (Optional)
     logit_bias (Optional): {
         String: int (Optional)
     }
     user: String (Optional)
     n: Integer (Optional)
     logprobs: Integer (Optional)
     echo: Boolean (Optional)
     stop (Optional): [
         String (Optional)
     ]
     presence_penalty: Double (Optional)
     frequency_penalty: Double (Optional)
     best_of: Integer (Optional)
     stream: Boolean (Optional)
     model: String (Optional)
 }

Response Body Schema

{
     id: String (Required)
     created: int (Required)
     choices (Required): [
          (Required){
             text: String (Required)
             index: int (Required)
             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(stopped/tokenLimitReached/contentFiltered) (Required)
         }
     ]
     usage (Required): {
         completion_tokens: int (Required)
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getEmbeddings

public Mono getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions)

Return the embeddings for a given prompt.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.

Returns:

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 on successful completion of Mono.

getEmbeddingsWithResponse

public Mono<>> getEmbeddingsWithResponse(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions, RequestOptions requestOptions)

Return the embeddings for a given prompt.

Request Body Schema

{
     user: String (Optional)
     model: String (Optional)
     input (Required): [
         String (Required)
     ]
 }

Response Body Schema

{
     data (Required): [
          (Required){
             embedding (Required): [
                 double (Required)
             ]
             index: int (Required)
         }
     ]
     usage (Required): {
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getEmbeddingsWithResponse

public Mono<>> getEmbeddingsWithResponse(String deploymentOrModelName, BinaryData embeddingsOptions, RequestOptions requestOptions)

Return the embeddings for a given prompt.

Request Body Schema

{
     user: String (Optional)
     model: String (Optional)
     input (Required): [
         String (Required)
     ]
 }

Response Body Schema

{
     data (Required): [
          (Required){
             embedding (Required): [
                 double (Required)
             ]
             index: int (Required)
         }
     ]
     usage (Required): {
         prompt_tokens: int (Required)
         total_tokens: int (Required)
     }
 }

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
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.
requestOptions - The options to configure the HTTP request before HTTP client sends it.

Returns:

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 Response<T> on successful completion of Mono.

getImageGenerations

public Mono getImageGenerations(String deploymentOrModelName, ImageGenerationOptions imageGenerationOptions)

Creates an image given a prompt.

Parameters:

deploymentOrModelName - Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.
imageGenerationOptions - Represents the request data used to generate images.

Returns:

the result of a successful image generation operation on successful completion of Mono.

Applies to