-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Motivation and Context Implement Azure OpenAI Dall E ### Description Implement Azure OpenAI Image Generation according to the official [documentation](https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#image-generation) and the examples provided by Azure OpenAI Studio, so that it can be used in SK. Due to the differences between the API of Azure OpenAI Dall-E and OpenAI Dall-E, some modifications have been made to OpenAIClientBase under CustomClient to ensure compatibility. Co-authored-by: Lee Miller <lemiller@microsoft.com> Co-authored-by: Shawn Callegari <36091529+shawncal@users.noreply.github.com> Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com>
- Loading branch information
1 parent
fa3eb27
commit 471ec9c
Showing
11 changed files
with
645 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
dotnet/src/Connectors/Connectors.AI.OpenAI/ImageGeneration/AzureImageGenerationResponse.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
namespace Microsoft.SemanticKernel.Connectors.AI.OpenAI.ImageGeneration; | ||
|
||
/// <summary> | ||
/// Image generation response | ||
/// </summary> | ||
public class AzureImageGenerationResponse | ||
{ | ||
/// <summary> | ||
/// Image generation result | ||
/// </summary> | ||
[JsonPropertyName("result")] | ||
public ImageGenerationResponse? Result { get; set; } | ||
|
||
/// <summary> | ||
/// Request Id | ||
/// </summary> | ||
[JsonPropertyName("id")] | ||
public string Id { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Request Status | ||
/// </summary> | ||
[JsonPropertyName("status")] | ||
public string Status { get; set; } = string.Empty; | ||
|
||
/// <summary> | ||
/// Creation time | ||
/// </summary> | ||
[JsonPropertyName("created")] | ||
public int Created { get; set; } | ||
|
||
/// <summary> | ||
/// Expiration time of the URL | ||
/// </summary> | ||
[JsonPropertyName("expires")] | ||
public int Expires { get; set; } | ||
} |
40 changes: 40 additions & 0 deletions
40
dotnet/src/Connectors/Connectors.AI.OpenAI/ImageGeneration/AzureImageOperationStatus.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.SemanticKernel.Connectors.AI.OpenAI.ImageGeneration; | ||
|
||
/// <summary> | ||
/// Azure image generation response status | ||
/// <see herf="https://learn.microsoft.com/en-us/azure/cognitive-services/openai/reference#image-generation" /> | ||
/// </summary> | ||
public static class AzureImageOperationStatus | ||
{ | ||
/// <summary> | ||
/// Image generation Succeeded | ||
/// </summary> | ||
public const string Succeeded = "succeeded"; | ||
|
||
/// <summary> | ||
/// Image generation Failed | ||
/// </summary> | ||
public const string Failed = "failed"; | ||
|
||
/// <summary> | ||
/// Task is running | ||
/// </summary> | ||
public const string Running = "running"; | ||
|
||
/// <summary> | ||
/// Task is queued but hasn't started yet | ||
/// </summary> | ||
public const string NotRunning = "notRunning"; | ||
|
||
/// <summary> | ||
/// The image has been removed from Azure's server. | ||
/// </summary> | ||
public const string Deleted = "deleted"; | ||
|
||
/// <summary> | ||
/// Task has timed out | ||
/// </summary> | ||
public const string Cancelled = "cancelled"; | ||
} |
Oops, something went wrong.