Skip to content

Commit

Permalink
OpenAI-DotNet 7.2.2 (#161)
Browse files Browse the repository at this point in the history
- Fixed Image Generation for Azure
  • Loading branch information
StephenHodgson authored Nov 10, 2023
1 parent 2fdb135 commit 201f5fb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion OpenAI-DotNet/Images/ImagesEndpoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public async Task<IReadOnlyList<string>> GenerateImageAsync(
public async Task<IReadOnlyList<string>> GenerateImageAsync(ImageGenerationRequest request, CancellationToken cancellationToken = default)
{
var jsonContent = JsonSerializer.Serialize(request, OpenAIClient.JsonSerializationOptions).ToJsonStringContent(EnableDebug);
var response = await Api.Client.PostAsync(GetUrl("/generations"), jsonContent, cancellationToken).ConfigureAwait(false);
var endpoint = GetUrl($"/generations{(Api.OpenAIClientSettings.IsAzureDeployment ? ":submit" : string.Empty)}");
var response = await Api.Client.PostAsync(endpoint, jsonContent, cancellationToken).ConfigureAwait(false);
return await DeserializeResponseAsync(response, cancellationToken).ConfigureAwait(false);
}

Expand Down
6 changes: 4 additions & 2 deletions OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<RepositoryUrl>https://github.com/RageAgainstThePixel/OpenAI-DotNet</RepositoryUrl>
<PackageTags>OpenAI, AI, ML, API, gpt-4, gpt-3.5-tubo, gpt-3, chatGPT, chat-gpt, gpt-2, gpt, dall-e-2, dall-e-3</PackageTags>
<Title>OpenAI API</Title>
<Version>7.2.1</Version>
<PackageReleaseNotes>Version 7.2.1
<Version>7.2.2</Version>
<PackageReleaseNotes>Version 7.2.2
- Fixed Image Generation for Azure
Version 7.2.1
- Fixed a NRE with chat Message.ToString call when dynamic content is json element
- Removed improper set accessors for Function.Arguments and Function.Parameters properties
- Removed improper ChatResponse constructor
Expand Down
2 changes: 2 additions & 0 deletions OpenAI-DotNet/OpenAIClientSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ public OpenAIClientSettings(string resourceName, string deploymentId, string api

internal bool UseOAuthAuthentication { get; }

internal bool IsAzureDeployment => BaseRequestUrlFormat.Contains(AzureOpenAIDomain);

private readonly Dictionary<string, string> defaultQueryParameters = new Dictionary<string, string>();

internal IReadOnlyDictionary<string, string> DefaultQueryParameters => defaultQueryParameters;
Expand Down

0 comments on commit 201f5fb

Please sign in to comment.