microsoft / semantic-kernel

Integrate cutting-edge LLM technology quickly and easily into your apps
https://aka.ms/semantic-kernel
MIT License
21.87k stars 3.26k forks source link

Kernel DI bug: HTTP status: 404 #1329

Closed gpww closed 1 year ago

gpww commented 1 year ago

Describe the bug something wrong with DI of SemanticKernel builder WithOpenAIChatCompletionService

1.clone https://github.com/jimbobbennett/console-gpt

  1. upgate Microsoft.SemanticKernel to 0.13.277.1-preview or higher
  2. you can get this error: Invalid request: The request is not valid, HTTP status: 404
  3. copilot chat sample app has the same problem

replace the following code can fix this problem temporarily: services.AddSingleton(serviceProvider => Kernel.Builder .WithOpenAIChatCompletionService(openAIOptions.ChatModel, openAIOptions.Key) .WithOpenAIChatCompletionService(openAIOptions.TextModel, openAIOptions.Key) .Build());

to:

IKernel kernel = Kernel.Builder .WithOpenAIChatCompletionService(openAIOptions.ChatModel, openAIOptions.Key) .WithOpenAITextCompletionService(openAIOptions.TextModel, openAIOptions.Key) .Build();

ConsoleGPTService._semanticKernel= kernel;//微软源码有bug,临时方案
nhandangt commented 1 year ago

@gpww Where is this file that we should change? Can I have a path or file name, please?

nacharya1 commented 1 year ago

@gpww thanks for raising this. We searched and couldnt find this reference. If you are able to see this persisting please respond and we will take another look. We are closing this as no repo.