Skip to content

Commit

Permalink
Address UT and IT
Browse files Browse the repository at this point in the history
  • Loading branch information
RogerBarreto committed Sep 30, 2024
1 parent 31b6d8c commit 3ea6fab
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,7 @@ public async Task GenerateImageWorksCorrectlyAsync(int width, int height, string
Assert.Equal(modelId, sut.Attributes["ModelId"]);

// 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 @@ -36,7 +36,7 @@ public OpenAITextToImageService(
HttpClient? httpClient = null,
ILoggerFactory? loggerFactory = null)
{
this._client = new(modelId, apiKey, organization, null, httpClient, loggerFactory?.CreateLogger(this.GetType()));
this._client = new(modelId ?? "dall-e-2", apiKey, organization, null, httpClient, loggerFactory?.CreateLogger(this.GetType()));
}

/// <inheritdoc/>
Expand All @@ -45,5 +45,5 @@ public Task<IReadOnlyList<ImageContent>> GetImageContentsAsync(
PromptExecutionSettings? executionSettings = null,
Kernel? kernel = null,
CancellationToken cancellationToken = default)
=> this._client.GetImageContentsAsync(input, executionSettings, kernel, cancellationToken);
=> this._client.GetImageContentsAsync(this._client.ModelId, input, executionSettings, kernel, cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public async Task OpenAITextToImageUseDallE2ByDefaultAsync()
Assert.NotNull(openAIConfiguration);

var kernel = Kernel.CreateBuilder()
.AddOpenAITextToImage(apiKey: openAIConfiguration.ApiKey, modelId: null)
.AddOpenAITextToImage(apiKey: openAIConfiguration.ApiKey)
.Build();

var service = kernel.GetRequiredService<ITextToImageService>();
Expand Down

0 comments on commit 3ea6fab

Please sign in to comment.