Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerBarreto committed Sep 24, 2024
1 parent 373870e commit de0c4f2
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
using Moq;
using OpenAI.Images;

#pragma warning disable CS0618 // Type or member is obsolete

namespace SemanticKernel.Connectors.AzureOpenAI.UnitTests.Services;

/// <summary>
Expand Down Expand Up @@ -75,9 +77,7 @@ public async Task GenerateImageWorksCorrectlyAsync(int width, int height, string
var sut = new AzureOpenAITextToImageService("deployment", "https://api-host", "api-key", modelId, this._httpClient, loggerFactory: this._mockLoggerFactory.Object);

// Act
#pragma warning disable CS0618 // Type or member is obsolete
var result = await sut.GenerateImageAsync("description", width, height);
#pragma warning restore CS0618 // Type or member is obsolete

// Assert
Assert.Equal("https://image-url/", result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
using Microsoft.SemanticKernel.Connectors.AzureOpenAI;
using Microsoft.SemanticKernel.Connectors.OpenAI;

#pragma warning disable CS0618 // Type or member is obsolete

namespace SemanticKernel.Connectors.AzureOpenAI.UnitTests.Settings;

/// <summary>
Expand Down Expand Up @@ -242,9 +244,8 @@ public void FromExecutionSettingsWithDataDoesNotIncludeEmptyStopSequences()
var executionSettings = new AzureOpenAIPromptExecutionSettings { StopSequences = [] };

// Act
#pragma warning disable CS0618 // AzureOpenAIChatCompletionWithData is deprecated in favor of OpenAIPromptExecutionSettings.AzureChatExtensionsOptions
var executionSettingsWithData = AzureOpenAIPromptExecutionSettings.FromExecutionSettingsWithData(executionSettings);
#pragma warning restore CS0618

// Assert
Assert.Null(executionSettingsWithData.StopSequences);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.Connectors.AzureOpenAI.AzureOpenAITextToImageService.GenerateImageAsync(System.String,System.Int32,System.Int32,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Microsoft.SemanticKernel.Connectors.AzureOpenAI.dll</Left>
<Right>lib/net8.0/Microsoft.SemanticKernel.Connectors.AzureOpenAI.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.Connectors.AzureOpenAI.AzureOpenAITextToImageService.GenerateImageAsync(System.String,System.Int32,System.Int32,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Connectors.AzureOpenAI.dll</Left>
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Connectors.AzureOpenAI.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/en-us/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.Connectors.OpenAI.OpenAITextToImageService.GenerateImageAsync(System.String,System.Int32,System.Int32,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/net8.0/Microsoft.SemanticKernel.Connectors.OpenAI.dll</Left>
<Right>lib/net8.0/Microsoft.SemanticKernel.Connectors.OpenAI.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
<Target>M:Microsoft.SemanticKernel.Connectors.OpenAI.OpenAITextToImageService.GenerateImageAsync(System.String,System.Int32,System.Int32,Microsoft.SemanticKernel.Kernel,System.Threading.CancellationToken)</Target>
<Left>lib/netstandard2.0/Microsoft.SemanticKernel.Connectors.OpenAI.dll</Left>
<Right>lib/netstandard2.0/Microsoft.SemanticKernel.Connectors.OpenAI.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
using SemanticKernel.IntegrationTests.TestSettings;
using Xunit;

#pragma warning disable CS0618 // Type or member is obsolete

namespace SemanticKernel.IntegrationTests.Connectors.AzureOpenAI;

public sealed class AzureOpenAITextToImageTests
Expand Down Expand Up @@ -67,6 +69,6 @@ public async Task GetImageContentsCanReturnImageUrlAsync()
Assert.NotNull(result);
Assert.NotEmpty(result);
Assert.NotEmpty(result[0].Uri!.ToString());
Assert.StartsWith("https://", result[0].Uri);
Assert.StartsWith("https://", result[0].Uri!.ToString());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using SemanticKernel.IntegrationTests.TestSettings;
using Xunit;

#pragma warning disable CS0618 // Type or member is obsolete

namespace SemanticKernel.IntegrationTests.Connectors.OpenAI;
public sealed class OpenAITextToImageTests
{
Expand Down

0 comments on commit de0c4f2

Please sign in to comment.