diff --git a/src/Catalog.API/Extensions/Extensions.cs b/src/Catalog.API/Extensions/Extensions.cs index 379106b7..767a23d7 100644 --- a/src/Catalog.API/Extensions/Extensions.cs +++ b/src/Catalog.API/Extensions/Extensions.cs @@ -39,7 +39,7 @@ public static void AddApplicationServices(this IHostApplicationBuilder builder) else if (!string.IsNullOrWhiteSpace(builder.Configuration.GetConnectionString("openai"))) { builder.AddOpenAIClientFromConfiguration("openai"); - builder.Services.AddEmbeddingGenerator(s => s.GetRequiredService().AsEmbeddingGenerator(builder.Configuration["AI:OpenAI:EmbeddingModel"]!)) + builder.Services.AddEmbeddingGenerator(sp => sp.GetRequiredService().AsEmbeddingGenerator(builder.Configuration["AI:OpenAI:EmbeddingModel"]!)) .UseOpenTelemetry() .UseLogging() .Build(); diff --git a/src/WebApp/Extensions/Extensions.cs b/src/WebApp/Extensions/Extensions.cs index 66697224..ceb910b8 100644 --- a/src/WebApp/Extensions/Extensions.cs +++ b/src/WebApp/Extensions/Extensions.cs @@ -113,7 +113,7 @@ private static void AddAIServices(this IHostApplicationBuilder builder) if (!string.IsNullOrWhiteSpace(builder.Configuration.GetConnectionString("openai")) && !string.IsNullOrWhiteSpace(chatModel)) { builder.AddOpenAIClientFromConfiguration("openai"); - builder.Services.AddChatClient(s => s.GetRequiredService().AsChatClient(chatModel ?? "gpt-4o-mini")) + builder.Services.AddChatClient(sp => sp.GetRequiredService().AsChatClient(chatModel ?? "gpt-4o-mini")) .UseFunctionInvocation() .UseOpenTelemetry(configure: t => t.EnableSensitiveData = true) .UseLogging()