streaming error: Could not load file or assembly "System.Threading.Tasks.Extensions, Version=4.2.0.0
I met below error when calling StreamChatAsync, could you please advise the reason. many thanks:
System.IO.FileLoadException: 'Could not load file or assembly "System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51" or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.'
Below is the code I wrote to call StreamChatAsync (my project uses .net framework 4.7):
var api = new OpenAI_API.OpenAIAPI(apiKey);
await api.Chat.StreamChatAsync(new ChatRequest()
{
Model = Model.ChatGPTTurbo,
MaxTokens = max_Tokens,
Messages = new ChatMessage[]
{
new ChatMessage(ChatMessageRole.User, prompt)
}
},
res =>
{
answer = res.Choices[0].Message.Content.Trim();
richTextBox1.SelectionStart = richTextBox1.TextLength;
richTextBox1.SelectionColor = Color.Blue;
richTextBox1.AppendText(answer);
});
Could anybody please take a look at this issue? this function is critical to my project. many thanks!!! @OkGoDoIt @esp0 @dex3r @gotmike
Try using System.Threading.Tasks.Extensions.dll I have downloaded raw dll and included to my project
@ericliu0408 I struggled with this as well in my .net framework project. The only working solution I found is to copy the right dll in the bin(/debug) folder.