Skip to content

Commit

Permalink
Fix Warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerBarreto committed Sep 16, 2024
1 parent b9e40b4 commit 23e2f03
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public async Task SimpleTextToImageExampleAsync()
var kernel = builder.Build();
var service = kernel.GetRequiredService<ITextToImageService>();

var generatedImages = await service.GetImageContentsAsync(new TextContent("A cute baby sea otter"), new OpenAITextToImageExecutionSettings { Width = 1024, Height = 1024 });
var generatedImages = await service.GetImageContentsAsync(new TextContent("A cute baby sea otter"), new OpenAITextToImageExecutionSettings { Size = (Width: 1792, Height: 1024) });

this.Output.WriteLine(generatedImages[0].Uri!.ToString());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

using System;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Text.Json;
Expand All @@ -11,7 +10,6 @@
using Azure.AI.OpenAI;
using Azure.Core;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.AzureOpenAI;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Services;
Expand Down Expand Up @@ -156,14 +154,14 @@ public void ItShouldThrowExceptionIfNoEndpointProvided(bool useTokeCredential, s
[InlineData("bytes", "b64_json")]
[InlineData("b64_json", "b64_json")]
[InlineData("GeneratedImage.Bytes", "b64_json")]
public async Task GetUriImageContentsResponseFormatRequestWorksCorrectlyAsync(string? uri, string? expectedResponseFormat)
public async Task GetUriImageContentsResponseFormatRequestWorksCorrectlyAsync(string? responseFormatOption, string? expectedResponseFormat)
{
// Arrange
object? responseFormatObject = uri switch
object? responseFormatObject = responseFormatOption switch
{
"GeneratedImage.Uri" => GeneratedImageFormat.Uri,
"GeneratedImage.Bytes" => GeneratedImageFormat.Bytes,
_ => uri
_ => responseFormatOption
};

this._httpClient.BaseAddress = new Uri("https://api-host");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
using System;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.SemanticKernel;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Microsoft.SemanticKernel.Services;
using Moq;
using Xunit;
using OpenAI.Images;
using System.Text.Unicode;
using System.Text;
using Xunit;

namespace SemanticKernel.Connectors.OpenAI.UnitTests.Services;

Expand Down Expand Up @@ -42,7 +40,7 @@ public OpenAITextToImageServiceTests()
public void ConstructorWorksCorrectly()
{
// Arrange & Act
var sut = new OpenAITextToImageService("apikey", "organization", "model");
var sut = new OpenAITextToImageService("apiKey", "organization", "model");

// Assert
Assert.NotNull(sut);
Expand Down Expand Up @@ -80,14 +78,14 @@ public async Task GenerateImageWorksCorrectlyAsync(int width, int height, string
[InlineData("bytes", "b64_json")]
[InlineData("b64_json", "b64_json")]
[InlineData("GeneratedImage.Bytes", "b64_json")]
public async Task GetUriImageContentsResponseFormatRequestWorksCorrectlyAsync(string? uri, string? expectedResponseFormat)
public async Task GetUriImageContentsResponseFormatRequestWorksCorrectlyAsync(string? responseFormatOption, string? expectedResponseFormat)
{
// Arrange
object? responseFormatObject = uri switch
object? responseFormatObject = responseFormatOption switch
{
"GeneratedImage.Uri" => GeneratedImageFormat.Uri,
"GeneratedImage.Bytes" => GeneratedImageFormat.Bytes,
_ => uri
_ => responseFormatOption
};

var sut = new OpenAITextToImageService("api-key", httpClient: this._httpClient);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,18 @@
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.TextToImage.ITextToImageService.GetImageContentsAsync(Microsoft.SemanticKernel.TextContent,Microsoft.SemanticKernel.PromptExecutionSettings,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
<Right>lib/net8.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0006</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.TextToImage.ITextToImageService.GetImageContentsAsync(Microsoft.SemanticKernel.TextContent,Microsoft.SemanticKernel.PromptExecutionSettings,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Left>
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Abstractions.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>

0 comments on commit 23e2f03

Please sign in to comment.