OpenAIAsyncClient Class
- java.
lang. Object - com.
azure. ai. openai. OpenAIAsyncClient
- com.
public final class OpenAIAsyncClient
Initializes a new instance of the asynchronous OpenAIClient type.
Method Summary
Methods inherited from java.lang.Object
Method Details
addUploadPart
public Mono<UploadPart> addUploadPart(String uploadId, AddUploadPartRequest requestBody)
Adds a Part to an Upload object. A Part represents a chunk of bytes from the file you are trying to upload. Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB. It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you complete the Upload.
Parameters:
Returns:
cancelBatch
public Mono<Batch> cancelBatch(String batchId)
Gets details for a single batch specified by the given batchID.
Parameters:
Returns:
cancelBatchWithResponse
public Mono<Response<Batch>> cancelBatchWithResponse(String batchId, RequestOptions requestOptions)
Gets details for a single batch specified by the given batchID.
Response Body Schema
{
id: String (Required)
object: String (Required)
endpoint: String (Optional)
errors (Optional): {
object: String (Required)
data (Optional): [
(Optional){
code: String (Optional)
message: String (Optional)
param: String (Optional)
line: Integer (Optional)
}
]
}
input_file_id: String (Required)
completion_window: String (Optional)
status: String(validating/failed/in_progress/finalizing/completed/expired/cancelling/cancelled) (Optional)
output_file_id: String (Optional)
error_file_id: String (Optional)
created_at: Long (Optional)
in_progress_at: Long (Optional)
expires_at: Long (Optional)
finalizing_at: Long (Optional)
completed_at: Long (Optional)
failed_at: Long (Optional)
expired_at: Long (Optional)
cancelling_at: Long (Optional)
cancelled_at: Long (Optional)
request_counts (Optional): {
total: Integer (Optional)
completed: Integer (Optional)
failed: Integer (Optional)
}
metadata (Optional): {
String: String (Required)
}
}
Parameters:
Returns:
cancelUpload
public Mono<Upload> cancelUpload(String uploadId)
Cancels the Upload. No Parts may be added after an Upload is cancelled.
Parameters:
Returns:
cancelUploadWithResponse
public Mono<Response<Upload>> cancelUploadWithResponse(String uploadId, RequestOptions requestOptions)
Cancels the Upload. No Parts may be added after an Upload is cancelled.
Response Body Schema
{
id: String (Required)
created_at: long (Required)
filename: String (Required)
bytes: long (Required)
purpose: String (Required)
status: String(pending/completed/cancelled/expired) (Required)
expires_at: long (Required)
object: String(upload) (Optional)
file (Optional): {
object: String (Required)
id: String (Required)
bytes: int (Required)
filename: String (Required)
created_at: long (Required)
purpose: String(fine-tune/fine-tune-results/assistants/assistants_output/batch/batch_output/vision) (Required)
status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
status_details: String (Optional)
}
}
Parameters:
Returns:
completeUpload
public Mono<Upload> completeUpload(String uploadId, CompleteUploadRequest requestBody)
Completes the Upload. Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform. You can specify the order of the Parts by passing in an ordered list of the Part IDs. The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
Parameters:
Returns:
completeUploadWithResponse
public Mono<Response<Upload>> completeUploadWithResponse(String uploadId, BinaryData requestBody, RequestOptions requestOptions)
Completes the Upload. Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform. You can specify the order of the Parts by passing in an ordered list of the Part IDs. The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
Request Body Schema
{
part_ids (Required): [
String (Required)
]
md5: String (Optional)
}
Response Body Schema
{
id: String (Required)
created_at: long (Required)
filename: String (Required)
bytes: long (Required)
purpose: String (Required)
status: String(pending/completed/cancelled/expired) (Required)
expires_at: long (Required)
object: String(upload) (Optional)
file (Optional): {
object: String (Required)
id: String (Required)
bytes: int (Required)
filename: String (Required)
created_at: long (Required)
purpose: String(fine-tune/fine-tune-results/assistants/assistants_output/batch/batch_output/vision) (Required)
status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
status_details: String (Optional)
}
}
Parameters:
Returns:
createBatch
public Mono<Batch> createBatch(BatchCreateRequest createBatchRequest)
Creates and executes a batch from an uploaded file of requests. Response includes details of the enqueued job including job status. The ID of the result file is added to the response once complete.
Parameters:
Returns:
createBatchWithResponse
public Mono<Response<Batch>> createBatchWithResponse(BinaryData createBatchRequest, RequestOptions requestOptions)
Creates and executes a batch from an uploaded file of requests. Response includes details of the enqueued job including job status. The ID of the result file is added to the response once complete.
Request Body Schema
{
endpoint: String (Required)
input_file_id: String (Required)
completion_window: String (Required)
metadata (Optional): {
String: String (Required)
}
}
Response Body Schema
{
id: String (Required)
object: String (Required)
endpoint: String (Optional)
errors (Optional): {
object: String (Required)
data (Optional): [
(Optional){
code: String (Optional)
message: String (Optional)
param: String (Optional)
line: Integer (Optional)
}
]
}
input_file_id: String (Required)
completion_window: String (Optional)
status: String(validating/failed/in_progress/finalizing/completed/expired/cancelling/cancelled) (Optional)
output_file_id: String (Optional)
error_file_id: String (Optional)
created_at: Long (Optional)
in_progress_at: Long (Optional)
expires_at: Long (Optional)
finalizing_at: Long (Optional)
completed_at: Long (Optional)
failed_at: Long (Optional)
expired_at: Long (Optional)
cancelling_at: Long (Optional)
cancelled_at: Long (Optional)
request_counts (Optional): {
total: Integer (Optional)
completed: Integer (Optional)
failed: Integer (Optional)
}
metadata (Optional): {
String: String (Required)
}
}
Parameters:
Returns:
createUpload
public Mono<Upload> createUpload(CreateUploadRequest requestBody)
Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it. Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object. For certain purposes, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case. For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File.
Parameters:
Returns:
createUploadWithResponse
public Mono<Response<Upload>> createUploadWithResponse(BinaryData requestBody, RequestOptions requestOptions)
Creates an intermediate Upload object that you can add Parts to. Currently, an Upload can accept at most 8 GB in total and expires after an hour after you create it. Once you complete the Upload, we will create a File object that contains all the parts you uploaded. This File is usable in the rest of our platform as a regular File object. For certain purposes, the correct mime_type must be specified. Please refer to documentation for the supported MIME types for your use case. For guidance on the proper filename extensions for each purpose, please follow the documentation on creating a File.
Request Body Schema
{
filename: String (Required)
purpose: String(assistants/batch/fine-tune/vision) (Required)
bytes: int (Required)
mime_type: String (Required)
}
Response Body Schema
{
id: String (Required)
created_at: long (Required)
filename: String (Required)
bytes: long (Required)
purpose: String (Required)
status: String(pending/completed/cancelled/expired) (Required)
expires_at: long (Required)
object: String(upload) (Optional)
file (Optional): {
object: String (Required)
id: String (Required)
bytes: int (Required)
filename: String (Required)
created_at: long (Required)
purpose: String(fine-tune/fine-tune-results/assistants/assistants_output/batch/batch_output/vision) (Required)
status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
status_details: String (Optional)
}
}
Parameters:
Returns:
deleteFile
public Mono<FileDeletionStatus> deleteFile(String fileId)
Delete a previously uploaded file.
Parameters:
Returns:
deleteFileWithResponse
public Mono<Response<FileDeletionStatus>> deleteFileWithResponse(String fileId, RequestOptions requestOptions)
Delete a previously uploaded file.
Response Body Schema
{
id: String (Required)
deleted: boolean (Required)
object: String (Required)
}
Parameters:
Returns:
generateSpeechFromText
public Mono<BinaryData> generateSpeechFromText(String deploymentOrModelName, SpeechGenerationOptions speechGenerationOptions)
Generates text-to-speech audio from the input text.
Parameters:
Returns:
generateSpeechFromTextWithResponse
public Mono<Response<BinaryData>> 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:
Returns:
getAudioTranscription
public Mono<AudioTranscription> 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:
Returns:
getAudioTranscriptionAsPlainText
public Mono<String> 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:
Returns:
getAudioTranscriptionText
public Mono<String> 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:
Returns:
getAudioTranscriptionTextWithResponse
public Mono<Response<String>> 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:
Returns:
getAudioTranscriptionWithResponse
public Mono<Response<AudioTranscription>> 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:
Returns:
getAudioTranslation
public Mono<AudioTranslation> getAudioTranslation(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)
Gets English language transcribed text and associated metadata from provided spoken audio file data.
Parameters:
Returns:
getAudioTranslationAsPlainText
public Mono<String> getAudioTranslationAsPlainText(String deploymentOrModelName, AudioTranslationOptions audioTranslationOptions)
Gets English language transcribed text and associated metadata from provided spoken audio data.
Parameters:
Returns:
getAudioTranslationText
public Mono<String> getAudioTranslationText(String deploymentOrModelName, String fileName, AudioTranslationOptions audioTranslationOptions)
Gets English language transcribed text and associated metadata from provided spoken audio file data.
Parameters:
Returns:
getAudioTranslationTextWithResponse
public 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.
Parameters:
Returns:
getAudioTranslationWithResponse
public 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.
Parameters:
Returns:
getBatch
public Mono<Batch> getBatch(String batchId)
Gets details for a single batch specified by the given batchID.
Parameters:
Returns:
getBatchWithResponse
public Mono<Response<Batch>> getBatchWithResponse(String batchId, RequestOptions requestOptions)
Gets details for a single batch specified by the given batchID.
Response Body Schema
{
id: String (Required)
object: String (Required)
endpoint: String (Optional)
errors (Optional): {
object: String (Required)
data (Optional): [
(Optional){
code: String (Optional)
message: String (Optional)
param: String (Optional)
line: Integer (Optional)
}
]
}
input_file_id: String (Required)
completion_window: String (Optional)
status: String(validating/failed/in_progress/finalizing/completed/expired/cancelling/cancelled) (Optional)
output_file_id: String (Optional)
error_file_id: String (Optional)
created_at: Long (Optional)
in_progress_at: Long (Optional)
expires_at: Long (Optional)
finalizing_at: Long (Optional)
completed_at: Long (Optional)
failed_at: Long (Optional)
expired_at: Long (Optional)
cancelling_at: Long (Optional)
cancelled_at: Long (Optional)
request_counts (Optional): {
total: Integer (Optional)
completed: Integer (Optional)
failed: Integer (Optional)
}
metadata (Optional): {
String: String (Required)
}
}
Parameters:
Returns:
getChatCompletions
public Mono<ChatCompletions> 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:
Returns:
getChatCompletionsStream
public Flux<ChatCompletions> 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:
Returns:
getChatCompletionsStream
public Flux<ChatCompletions> getChatCompletionsStream(String deploymentOrModelName, ChatCompletionsOptions chatCompletionsOptions, ChatCompletionStreamOptions streamOptions)
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:
Returns:
getChatCompletionsStreamWithResponse
public Flux<Response<ChatCompletions>> 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:
Returns:
getChatCompletionsWithResponse
public Mono<Response<BinaryData>> 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:
Returns:
getChatCompletionsWithResponse
public Mono<Response<ChatCompletions>> 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:
Returns:
getCompletions
public Mono<Completions> 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:
Returns:
getCompletions
public Mono<Completions> 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:
Returns:
getCompletionsStream
public Flux<Completions> 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:
Returns:
getCompletionsStream
public Flux<Completions> getCompletionsStream(String deploymentOrModelName, CompletionsOptions completionsOptions, ChatCompletionStreamOptions streamOptions)
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.
Parameters:
Returns:
getCompletionsWithResponse
public Mono<Response<BinaryData>> 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:
Returns:
getCompletionsWithResponse
public Mono<Response<Completions>> 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:
Returns:
getEmbeddings
public Mono<Embeddings> getEmbeddings(String deploymentOrModelName, EmbeddingsOptions embeddingsOptions)
Return the embeddings for a given prompt.
Parameters:
Returns:
getEmbeddingsWithResponse
public Mono<Response<BinaryData>> 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:
Returns:
getEmbeddingsWithResponse
public Mono<Response<Embeddings>> 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:
Returns:
getFile
public Mono<OpenAIFile> getFile(String fileId)
Returns information about a specific file. Does not retrieve file content.
Parameters:
Returns:
getFileContent
public Mono<byte[]> getFileContent(String fileId)
Returns information about a specific file. Does not retrieve file content.
Parameters:
Returns:
getFileContentWithResponse
public Mono<Response<byte[]>> getFileContentWithResponse(String fileId, RequestOptions requestOptions)
Returns information about a specific file. Does not retrieve file content.
Response Body Schema
byte[]
Parameters:
Returns:
getFileWithResponse
public Mono<Response<OpenAIFile>> getFileWithResponse(String fileId, RequestOptions requestOptions)
Returns information about a specific file. Does not retrieve file content.
Response Body Schema
{
object: String (Required)
id: String (Required)
bytes: int (Required)
filename: String (Required)
created_at: long (Required)
purpose: String(fine-tune/fine-tune-results/assistants/assistants_output/batch/batch_output/vision) (Required)
status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
status_details: String (Optional)
}
Parameters:
Returns:
getImageGenerations
public Mono<ImageGenerations> getImageGenerations(String deploymentOrModelName, ImageGenerationOptions imageGenerationOptions)
Creates an image given a prompt.
Parameters:
Returns:
getImageGenerationsWithResponse
public Mono<Response<ImageGenerations>> getImageGenerationsWithResponse(String deploymentOrModelName, ImageGenerationOptions imageGenerationOptions, RequestOptions requestOptions)
Creates an image given a prompt.
Request Body Schema
{
model: String (Optional)
prompt: String (Required)
n: Integer (Optional)
size: String(256x256/512x512/1024x1024/1792x1024/1024x1792) (Optional)
response_format: String(url/b64_json) (Optional)
quality: String(standard/hd) (Optional)
style: String(natural/vivid) (Optional)
user: String (Optional)
}
Response Body Schema
{
created: long (Required)
data (Required): [
(Required){
url: String (Optional)
b64_json: String (Optional)
revised_prompt: String (Optional)
}
]
}
Parameters:
Returns:
listBatches
public Mono<PageableList<Batch>> listBatches()
Gets a list of all batches owned by the Azure OpenAI resource.
Returns:
listBatches
public Mono<PageableList<Batch>> listBatches(String after, Integer limit)
Gets a list of all batches owned by the Azure OpenAI resource.
Parameters:
Returns:
listBatchesWithResponse
public Mono<Response<PageableList<Batch>>> listBatchesWithResponse(RequestOptions requestOptions)
Gets a list of all batches owned by the Azure OpenAI resource.
Query Parameters
| ----- | ------- | -------- | ------------------------------------------------------------------- |
| Name | Type | Required | Description |
| after | String | No | Identifier for the last event from the previous pagination request. |
| limit | Integer | No | Number of batches to retrieve. Defaults to 20. |
You can add these to a request with RequestOptions#addQueryParam
Response Body Schema
{
object: String (Required)
data (Optional): [
(Optional){
id: String (Required)
object: String (Required)
endpoint: String (Optional)
errors (Optional): {
object: String (Required)
data (Optional): [
(Optional){
code: String (Optional)
message: String (Optional)
param: String (Optional)
line: Integer (Optional)
}
]
}
input_file_id: String (Required)
completion_window: String (Optional)
status: String(validating/failed/in_progress/finalizing/completed/expired/cancelling/cancelled) (Optional)
output_file_id: String (Optional)
error_file_id: String (Optional)
created_at: Long (Optional)
in_progress_at: Long (Optional)
expires_at: Long (Optional)
finalizing_at: Long (Optional)
completed_at: Long (Optional)
failed_at: Long (Optional)
expired_at: Long (Optional)
cancelling_at: Long (Optional)
cancelled_at: Long (Optional)
request_counts (Optional): {
total: Integer (Optional)
completed: Integer (Optional)
failed: Integer (Optional)
}
metadata (Optional): {
String: String (Required)
}
}
]
first_id: String (Optional)
last_id: String (Optional)
has_more: Boolean (Optional)
}
Parameters:
Returns:
listFiles
public Mono<List<OpenAIFile>> listFiles()
Gets a list of previously uploaded files.
Returns:
listFiles
public Mono<List<OpenAIFile>> listFiles(FilePurpose purpose)
Gets a list of previously uploaded files.
Parameters:
Returns:
listFilesWithResponse
public Mono<Response<List<OpenAIFile>>> listFilesWithResponse(RequestOptions requestOptions)
Gets a list of previously uploaded files.
Query Parameters
| ------- | ------ | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Name | Type | Required | Description |
| purpose | String | No | A value that, when provided, limits list results to files matching the corresponding purpose. Allowed values: "fine-tune", "fine-tune-results", "assistants", "assistants\_output", "batch", "batch\_output", "vision". |
You can add these to a request with RequestOptions#addQueryParam
Response Body Schema
{
object: String (Required)
data (Required): [
(Required){
object: String (Required)
id: String (Required)
bytes: int (Required)
filename: String (Required)
created_at: long (Required)
purpose: String(fine-tune/fine-tune-results/assistants/assistants_output/batch/batch_output/vision) (Required)
status: String(uploaded/pending/running/processed/error/deleting/deleted) (Optional)
status_details: String (Optional)
}
]
}
Parameters:
Returns:
uploadFile
public Mono<OpenAIFile> uploadFile(FileDetails file, FilePurpose purpose)
Uploads a file for use by other operations.
Parameters:
Returns: