From 564a51ba605c3397cd2d778e111a00158aa2e012 Mon Sep 17 00:00:00 2001 From: Rick Caudle Date: Wed, 31 Jan 2024 11:09:45 -0500 Subject: [PATCH] change Kernel to be added as transient as this is how the SK should be used in DI, Singleton can result in issues with SK. --- Program.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Program.cs b/Program.cs index 1594f0d..114f583 100644 --- a/Program.cs +++ b/Program.cs @@ -14,16 +14,16 @@ { services.AddApplicationInsightsTelemetryWorkerService(); services.ConfigureFunctionsApplicationInsights(); - services.AddSingleton(s => + services.AddTransient(s => { var builder = Kernel.CreateBuilder(); builder.AddAzureOpenAIChatCompletion( _apiDeploymentName, _apiEndpoint, - _apiKey + _apiKey ); return builder.Build(); - }); + }); }) .Build();