microsoft / semantic-kernel

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

Method not found: 'Void Azure.AI.OpenAI.ChatCompletion Options.set_ChoicesPerPrompt(System.Nullable`1<Int32>)' #2114

Closed nkidambi closed 1 year ago

nkidambi commented 1 year ago

_chatRequestSettings.MaxTokens = maxTokens; _chatHistory.AddMessage(AuthorRole.User, prompt); string reply = await _chatGPT.GenerateMessageAsync(_chatHistory, _chatRequestSettings).ConfigureAwait(false);

To Reproduce Steps to reproduce the behavior:

  1. Update nuget package to the latest version
  2. Follow the example 17 to generate messages
  3. See error

Expected behavior The response from Azure OpenAI is returned.

Platform

Additional context I tried with ChatCompletionsAsync method too. Got the same error. Below is the exception detail -

System.AggregateException HResult=0x80131500 Message=One or more errors occurred. (Method not found: 'Void Azure.AI.OpenAI.ChatCompletionsOptions.set_ChoicesPerPrompt(System.Nullable`1)'.) Source=System.Private.CoreLib StackTrace: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) at System.Threading.Tasks.Task.Wait() at AIArt.UI.Business.OpenAIManager.GenerateGeneralResponse(String flowText, String prompt) in C:\Kidambi\GitHub\nkidambi\AIArT\AIArt.UI.Business\OpenAIManager.cs:line 20 at AIArt.Wpf.UserControls.ChatControl.d__7.MoveNext() in C:\Kidambi\GitHub\nkidambi\AIArT\AIArt.Wpf\UserControls\ChatControl.xaml.cs:line 43

This exception was originally thrown at this call stack: [External Code] Microsoft.SemanticKernel.AI.ChatCompletion.ChatCompletionExtensions.GenerateMessageAsync(Microsoft.SemanticKernel.AI.ChatCompletion.IChatCompletion, Microsoft.SemanticKernel.AI.ChatCompletion.ChatHistory, Microsoft.SemanticKernel.AI.ChatCompletion.ChatRequestSettings, System.Threading.CancellationToken) in ChatCompletionExtensions.cs AIArt.UI.Business.SemanticKernelManager.GetChatGPTResponse(string, string, int) in SemanticKernelManager.cs AIArt.UI.Business.OpenAIManager.GenerateGeneralResponse.AnonymousMethod__0() in OpenAIManager.cs

Inner Exception 1: MissingMethodException: Method not found: 'Void Azure.AI.OpenAI.ChatCompletionsOptions.set_ChoicesPerPrompt(System.Nullable`1)'.

nkidambi commented 1 year ago

Got the answer from Discord.

If referencing the Azure.AI.OpenAI package in the same project, beta 6 has a breaking change that’s incompatible with the current version of SK. Either downgrade to beta 5 or wait for the next SK release which updated to beta 6.