Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AutoPR Azure.AI.OpenAI] Fixing enum to have the proper values + reenabling csharp generation. #4191

Closed
wants to merge 1 commit into from
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
83 changes: 81 additions & 2 deletions sdk/openai/Azure.AI.OpenAI/api/Azure.AI.OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ public static partial class AzureOpenAIModelFactory
public static Azure.AI.OpenAI.EmbeddingItem EmbeddingItem(System.Collections.Generic.IEnumerable<float> embedding = null, int index = 0) { throw null; }
public static Azure.AI.OpenAI.Embeddings Embeddings(System.Collections.Generic.IEnumerable<Azure.AI.OpenAI.EmbeddingItem> data = null, Azure.AI.OpenAI.EmbeddingsUsage usage = null) { throw null; }
public static Azure.AI.OpenAI.EmbeddingsUsage EmbeddingsUsage(int promptTokens = 0, int totalTokens = 0) { throw null; }
public static Azure.AI.OpenAI.ImageLocation ImageLocation(System.Uri url = null, Azure.ResponseError error = null) { throw null; }
public static Azure.AI.OpenAI.ImageOperationResponse ImageOperationResponse(string id = null, long created = (long)0, long? expires = default(long?), Azure.AI.OpenAI.ImageResponse result = null, Azure.AI.OpenAI.State status = default(Azure.AI.OpenAI.State), Azure.ResponseError error = null) { throw null; }
public static Azure.AI.OpenAI.ImageResponse ImageResponse(long created = (long)0, System.Collections.Generic.IEnumerable<Azure.AI.OpenAI.ImageLocation> data = null) { throw null; }
}
public partial class ChatChoice
{
Expand Down Expand Up @@ -158,6 +161,55 @@ internal EmbeddingsUsage() { }
public int PromptTokens { get { throw null; } }
public int TotalTokens { get { throw null; } }
}
public partial class ImageGenerationOptions
{
public ImageGenerationOptions(string prompt) { }
public int? N { get { throw null; } set { } }
public string Prompt { get { throw null; } }
public Azure.AI.OpenAI.ImageSize? Size { get { throw null; } set { } }
public string User { get { throw null; } set { } }
}
public partial class ImageLocation
{
internal ImageLocation() { }
public Azure.ResponseError Error { get { throw null; } }
public System.Uri Url { get { throw null; } }
}
public partial class ImageOperationResponse
{
internal ImageOperationResponse() { }
public long Created { get { throw null; } }
public Azure.ResponseError Error { get { throw null; } }
public long? Expires { get { throw null; } }
public string Id { get { throw null; } }
public Azure.AI.OpenAI.ImageResponse Result { get { throw null; } }
public Azure.AI.OpenAI.State Status { get { throw null; } }
}
public partial class ImageResponse
{
internal ImageResponse() { }
public long Created { get { throw null; } }
public System.Collections.Generic.IReadOnlyList<Azure.AI.OpenAI.ImageLocation> Data { get { throw null; } }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct ImageSize : System.IEquatable<Azure.AI.OpenAI.ImageSize>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public ImageSize(string value) { throw null; }
public static Azure.AI.OpenAI.ImageSize Size1024x1024 { get { throw null; } }
public static Azure.AI.OpenAI.ImageSize Size256x256 { get { throw null; } }
public static Azure.AI.OpenAI.ImageSize Size512x512 { get { throw null; } }
public bool Equals(Azure.AI.OpenAI.ImageSize other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.AI.OpenAI.ImageSize left, Azure.AI.OpenAI.ImageSize right) { throw null; }
public static implicit operator Azure.AI.OpenAI.ImageSize (string value) { throw null; }
public static bool operator !=(Azure.AI.OpenAI.ImageSize left, Azure.AI.OpenAI.ImageSize right) { throw null; }
public override string ToString() { throw null; }
}
public partial class OpenAIClient
{
protected OpenAIClient() { }
Expand All @@ -180,16 +232,43 @@ public OpenAIClient(System.Uri endpoint, Azure.Core.TokenCredential tokenCredent
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.StreamingCompletions>> GetCompletionsStreamingAsync(string deploymentOrModelName, Azure.AI.OpenAI.CompletionsOptions completionsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Response<Azure.AI.OpenAI.Embeddings> GetEmbeddings(string deploymentOrModelName, Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.OpenAI.Embeddings>> GetEmbeddingsAsync(string deploymentOrModelName, Azure.AI.OpenAI.EmbeddingsOptions embeddingsOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Operation<Azure.AI.OpenAI.ImageOperationResponse> StartGenerateImage(Azure.WaitUntil waitUntil, Azure.AI.OpenAI.ImageGenerationOptions imageGenerationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual Azure.Operation<System.BinaryData> StartGenerateImage(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Operation<Azure.AI.OpenAI.ImageOperationResponse>> StartGenerateImageAsync(Azure.WaitUntil waitUntil, Azure.AI.OpenAI.ImageGenerationOptions imageGenerationOptions, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
public virtual System.Threading.Tasks.Task<Azure.Operation<System.BinaryData>> StartGenerateImageAsync(Azure.WaitUntil waitUntil, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; }
}
public partial class OpenAIClientOptions : Azure.Core.ClientOptions
{
public OpenAIClientOptions(Azure.AI.OpenAI.OpenAIClientOptions.ServiceVersion version = Azure.AI.OpenAI.OpenAIClientOptions.ServiceVersion.V2023_03_15_Preview) { }
public OpenAIClientOptions(Azure.AI.OpenAI.OpenAIClientOptions.ServiceVersion version = Azure.AI.OpenAI.OpenAIClientOptions.ServiceVersion.V2023_06_01_Preview) { }
public enum ServiceVersion
{
V2022_12_01 = 1,
V2023_03_15_Preview = 2,
V2023_05_15 = 2,
V2023_06_01_Preview = 3,
}
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct State : System.IEquatable<Azure.AI.OpenAI.State>
{
private readonly object _dummy;
private readonly int _dummyPrimitive;
public State(string value) { throw null; }
public static Azure.AI.OpenAI.State Canceled { get { throw null; } }
public static Azure.AI.OpenAI.State Deleted { get { throw null; } }
public static Azure.AI.OpenAI.State Failed { get { throw null; } }
public static Azure.AI.OpenAI.State NotRunning { get { throw null; } }
public static Azure.AI.OpenAI.State Running { get { throw null; } }
public static Azure.AI.OpenAI.State Succeeded { get { throw null; } }
public bool Equals(Azure.AI.OpenAI.State other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override int GetHashCode() { throw null; }
public static bool operator ==(Azure.AI.OpenAI.State left, Azure.AI.OpenAI.State right) { throw null; }
public static implicit operator Azure.AI.OpenAI.State (string value) { throw null; }
public static bool operator !=(Azure.AI.OpenAI.State left, Azure.AI.OpenAI.State right) { throw null; }
public override string ToString() { throw null; }
}
public partial class StreamingChatChoice
{
internal StreamingChatChoice() { }
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

132 changes: 132 additions & 0 deletions sdk/openai/Azure.AI.OpenAI/src/Generated/Docs/OpenAIClient.xml
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,137 @@ var result = client.GetChatCompletions("<deploymentId>", chatCompletionsOptions)
</member>
<member name="GetChatCompletions(string,RequestContent,RequestContext)">
</member>
<member name="StartGenerateImageAsync(WaitUntil,ImageGenerationOptions,CancellationToken)">
<example>
This sample shows how to call StartGenerateImageAsync with required parameters.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var imageGenerationOptions = new ImageGenerationOptions("<prompt>")
{
N = 1234,
Size = ImageSize.Size256x256,
User = "<User>",
};
var operation = await client.StartGenerateImageAsync(WaitUntil.Completed, imageGenerationOptions);
]]></code>
</example>
</member>
<member name="StartGenerateImage(WaitUntil,ImageGenerationOptions,CancellationToken)">
<example>
This sample shows how to call StartGenerateImage with required parameters.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var imageGenerationOptions = new ImageGenerationOptions("<prompt>")
{
N = 1234,
Size = ImageSize.Size256x256,
User = "<User>",
};
var operation = client.StartGenerateImage(WaitUntil.Completed, imageGenerationOptions);
]]></code>
</example>
</member>
<member name="StartGenerateImageAsync(WaitUntil,RequestContent,RequestContext)">
<example>
This sample shows how to call StartGenerateImageAsync with required parameters and request content, and how to parse the result.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var data = new {
prompt = "<prompt>",
};

var operation = await client.StartGenerateImageAsync(WaitUntil.Completed, RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
]]></code>
This sample shows how to call StartGenerateImageAsync with all parameters and request content, and how to parse the result.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var data = new {
prompt = "<prompt>",
n = 1234,
size = "256x256",
user = "<user>",
};

var operation = await client.StartGenerateImageAsync(WaitUntil.Completed, RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("expires").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("url").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
]]></code>
</example>
</member>
<member name="StartGenerateImage(WaitUntil,RequestContent,RequestContext)">
<example>
This sample shows how to call StartGenerateImage with required parameters and request content, and how to parse the result.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var data = new {
prompt = "<prompt>",
};

var operation = client.StartGenerateImage(WaitUntil.Completed, RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
]]></code>
This sample shows how to call StartGenerateImage with all parameters and request content, and how to parse the result.
<code><![CDATA[
var client = new OpenAIClient("<openAIApiKey>");

var data = new {
prompt = "<prompt>",
n = 1234,
size = "256x256",
user = "<user>",
};

var operation = client.StartGenerateImage(WaitUntil.Completed, RequestContent.Create(data));

BinaryData responseData = operation.Value;
JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement;
Console.WriteLine(result.GetProperty("id").ToString());
Console.WriteLine(result.GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("expires").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("created").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("url").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("result").GetProperty("data")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("status").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString());
Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString());
]]></code>
</example>
</member>
</members>
</doc>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading