Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import com.azure.ai.openai.models.CompletionsOptions;
import com.azure.ai.openai.models.Embeddings;
import com.azure.ai.openai.models.EmbeddingsOptions;
import com.azure.ai.openai.models.ImageGenerationOptions;
import com.azure.ai.openai.models.ImageOperationResponse;
import com.azure.ai.openai.models.ImageOperationStatus;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand All @@ -24,7 +22,6 @@
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.experimental.models.PollResult;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
Expand Down Expand Up @@ -482,7 +479,7 @@ public Flux<ChatCompletions> getChatCompletionsStream(
* }
* ]
* }
* status: String(notRunning/running/succeeded/canceled/failed/deleted) (Required)
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): (recursive schema, see error above)
* }
* }</pre>
Expand Down Expand Up @@ -548,7 +545,7 @@ public Mono<Response<BinaryData>> getImageOperationStatusWithResponse(
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<BinaryData, BinaryData> beginStartGenerateImage(
PollerFlux<BinaryData, BinaryData> beginStartGenerateImage(
BinaryData imageGenerationOptions, RequestOptions requestOptions) {
return this.serviceClient.beginStartGenerateImageAsync(imageGenerationOptions, requestOptions);
}
Expand All @@ -574,26 +571,4 @@ public Mono<ImageOperationResponse> getImageOperationStatus(String operationId)
.flatMap(FluxUtil::toMono)
.map(protocolMethodData -> protocolMethodData.toObject(ImageOperationResponse.class));
}

/**
* Starts the generation of a batch of images from a text caption.
*
* @param imageGenerationOptions Represents the request data used to generate images.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link PollerFlux} for polling of status details for long running operations.
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<PollResult, ImageOperationStatus> beginStartGenerateImage(
ImageGenerationOptions imageGenerationOptions) {
// Generated convenience method for beginStartGenerateImageWithModel
RequestOptions requestOptions = new RequestOptions();
return serviceClient.beginStartGenerateImageWithModelAsync(
BinaryData.fromObject(imageGenerationOptions), requestOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@
import com.azure.ai.openai.models.CompletionsOptions;
import com.azure.ai.openai.models.Embeddings;
import com.azure.ai.openai.models.EmbeddingsOptions;
import com.azure.ai.openai.models.ImageGenerationOptions;
import com.azure.ai.openai.models.ImageOperationResponse;
import com.azure.ai.openai.models.ImageOperationStatus;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
Expand All @@ -24,7 +22,6 @@
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.experimental.models.PollResult;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;
Expand Down Expand Up @@ -474,7 +471,7 @@ public IterableStream<ChatCompletions> getChatCompletionsStream(
* }
* ]
* }
* status: String(notRunning/running/succeeded/canceled/failed/deleted) (Required)
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): (recursive schema, see error above)
* }
* }</pre>
Expand Down Expand Up @@ -538,7 +535,7 @@ public Response<BinaryData> getImageOperationStatusWithResponse(String operation
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<BinaryData, BinaryData> beginStartGenerateImage(
SyncPoller<BinaryData, BinaryData> beginStartGenerateImage(
BinaryData imageGenerationOptions, RequestOptions requestOptions) {
return this.serviceClient.beginStartGenerateImage(imageGenerationOptions, requestOptions);
}
Expand All @@ -564,26 +561,4 @@ public ImageOperationResponse getImageOperationStatus(String operationId) {
.getValue()
.toObject(ImageOperationResponse.class);
}

/**
* Starts the generation of a batch of images from a text caption.
*
* @param imageGenerationOptions Represents the request data used to generate images.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws HttpResponseException thrown if the request is rejected by server.
* @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
* @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
* @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the {@link SyncPoller} for polling of status details for long running operations.
*/
@Generated
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<PollResult, ImageOperationStatus> beginStartGenerateImage(
ImageGenerationOptions imageGenerationOptions) {
// Generated convenience method for beginStartGenerateImageWithModel
RequestOptions requestOptions = new RequestOptions();
return serviceClient.beginStartGenerateImageWithModel(
BinaryData.fromObject(imageGenerationOptions), requestOptions);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
package com.azure.ai.openai.implementation;

import com.azure.ai.openai.OpenAIServiceVersion;
import com.azure.ai.openai.models.ImageOperationStatus;
import com.azure.core.annotation.BodyParam;
import com.azure.core.annotation.ExpectedResponses;
import com.azure.core.annotation.Get;
Expand All @@ -23,7 +22,6 @@
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.experimental.models.PollResult;
import com.azure.core.http.HttpPipeline;
import com.azure.core.http.HttpPipelineBuilder;
import com.azure.core.http.policy.CookiePolicy;
Expand Down Expand Up @@ -548,7 +546,7 @@ public Response<BinaryData> getEmbeddingsWithResponse(
* int (Required)
* ]
* }
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* finish_reason: String(stop/length/content_filter) (Required)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -645,7 +643,7 @@ public Mono<Response<BinaryData>> getCompletionsWithResponseAsync(
* int (Required)
* ]
* }
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* finish_reason: String(stop/length/content_filter) (Required)
* }
* ]
* usage (Required): {
Expand Down Expand Up @@ -726,7 +724,7 @@ public Response<BinaryData> getCompletionsWithResponse(
* content: String (Optional)
* }
* index: int (Required)
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* finish_reason: String(stop/length/content_filter) (Required)
* delta (Optional): (recursive schema, see delta above)
* }
* ]
Expand Down Expand Up @@ -811,7 +809,7 @@ public Mono<Response<BinaryData>> getChatCompletionsWithResponseAsync(
* content: String (Optional)
* }
* index: int (Required)
* finish_reason: String(stopped/tokenLimitReached/contentFiltered) (Required)
* finish_reason: String(stop/length/content_filter) (Required)
* delta (Optional): (recursive schema, see delta above)
* }
* ]
Expand Down Expand Up @@ -878,7 +876,7 @@ public Response<BinaryData> getChatCompletionsWithResponse(
* }
* ]
* }
* status: String(notRunning/running/succeeded/canceled/failed/deleted) (Required)
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): (recursive schema, see error above)
* }
* }</pre>
Expand Down Expand Up @@ -937,7 +935,7 @@ public Mono<Response<BinaryData>> getImageOperationStatusWithResponseAsync(
* }
* ]
* }
* status: String(notRunning/running/succeeded/canceled/failed/deleted) (Required)
* status: String(notRunning/running/succeeded/canceled/failed) (Required)
* error (Optional): (recursive schema, see error above)
* }
* }</pre>
Expand Down Expand Up @@ -1196,124 +1194,4 @@ public SyncPoller<BinaryData, BinaryData> beginStartGenerateImage(
TypeReference.createInstance(BinaryData.class),
TypeReference.createInstance(BinaryData.class));
}

/**
* Starts the generation of a batch of images from a text caption.
*
* <p><strong>Request Body Schema</strong>
*
* <pre>{@code
* {
* prompt: String (Required)
* n: Integer (Optional)
* size: String(256x256/512x512/1024x1024) (Optional)
* user: String (Optional)
* }
* }</pre>
*
* <p><strong>Response Body Schema</strong>
*
* <pre>{@code
* {
* id: String (Required)
* status: String (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)
* }
* }
* }
* }</pre>
*
* @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 the {@link PollerFlux} for polling of status details for long running operations.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public PollerFlux<PollResult, ImageOperationStatus> beginStartGenerateImageWithModelAsync(
BinaryData imageGenerationOptions, RequestOptions requestOptions) {
return PollerFlux.create(
Duration.ofSeconds(1),
() -> this.startGenerateImageWithResponseAsync(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)),
TypeReference.createInstance(PollResult.class),
TypeReference.createInstance(ImageOperationStatus.class));
}

/**
* Starts the generation of a batch of images from a text caption.
*
* <p><strong>Request Body Schema</strong>
*
* <pre>{@code
* {
* prompt: String (Required)
* n: Integer (Optional)
* size: String(256x256/512x512/1024x1024) (Optional)
* user: String (Optional)
* }
* }</pre>
*
* <p><strong>Response Body Schema</strong>
*
* <pre>{@code
* {
* id: String (Required)
* status: String (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)
* }
* }
* }
* }</pre>
*
* @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 the {@link SyncPoller} for polling of status details for long running operations.
*/
@ServiceMethod(returns = ReturnType.LONG_RUNNING_OPERATION)
public SyncPoller<PollResult, ImageOperationStatus> beginStartGenerateImageWithModel(
BinaryData imageGenerationOptions, RequestOptions requestOptions) {
return SyncPoller.createPoller(
Duration.ofSeconds(1),
() -> this.startGenerateImageWithResponse(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)),
TypeReference.createInstance(PollResult.class),
TypeReference.createInstance(ImageOperationStatus.class));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
public final class CompletionsFinishReason extends ExpandableStringEnum<CompletionsFinishReason> {

/** Completions ended normally and reached its end of token generation. */
@Generated public static final CompletionsFinishReason STOPPED = fromString("stopped");
@Generated public static final CompletionsFinishReason STOPPED = fromString("stop");

/** Completions exhausted available token limits before generation could complete. */
@Generated public static final CompletionsFinishReason TOKEN_LIMIT_REACHED = fromString("tokenLimitReached");
@Generated public static final CompletionsFinishReason TOKEN_LIMIT_REACHED = fromString("length");

/**
* Completions generated a response that was identified as potentially sensitive per content moderation policies.
*/
@Generated public static final CompletionsFinishReason CONTENT_FILTERED = fromString("contentFiltered");
@Generated public static final CompletionsFinishReason CONTENT_FILTERED = fromString("content_filter");

/**
* Creates a new instance of CompletionsFinishReason value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ public final class State extends ExpandableStringEnum<State> {
/** The operation has completed processing with a failure and cannot be further consumed. */
@Generated public static final State FAILED = fromString("failed");

/** The entity has been deleted but may still be referenced by other entities predating the deletion. */
@Generated public static final State DELETED = fromString("deleted");

/**
* Creates a new instance of State value.
*
Expand Down
6 changes: 3 additions & 3 deletions sdk/openai/azure-ai-openai/tsp-location.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
commit: baab681702af69fd815cd7dc9310ed1438bd0ef7
directory: specification/cognitiveservices/OpenAI.Inference
additionalDirectories:
- specification/cognitiveservices/OpenAI.Authoring
commit: fe056966cf070be84e92dd2dc1b566bae35002cf
repo: Azure/azure-rest-api-specs
additionalDirectories: []