From the course: A Start to Using Generative AI in .NET
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Solution: Fix the bugs - .NET Tutorial
From the course: A Start to Using Generative AI in .NET
Solution: Fix the bugs
(upbeat music) - [Instructor] Welcome back. I hope you had fun with the challenge. Let's go over the solution together. Let's open up the solution. It looks like we are working with the streaming version of the chatbot. The first thing that pops up is that the code doesn't even compile. It looks like we have a number of errors in the foreach loop used for streaming. Result doesn't exist in the streaming result. Maybe a streaming result is not what it used to be. Let's see. It is generated by GetChatCompletionsStreaming, but weren't we using the async version? Let's quickly fix this by adding Async to the end of the method's name, Async. Awesome. We now have different errors. The foreach statement cannot operate on variables of type IAsyncEnumerable. Right, because we need to use the weight for each. Let's see. Okay, at least now the code compiles, so let's run it. Still no good. Here's the error. Can you see the problem? Yes, the model's name is spelled wrong. It's not…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Choosing a .NET library3m 37s
-
(Locked)
Creating a basic .NET Core console application3m 42s
-
(Locked)
Create the OpenAIClient object5m 17s
-
(Locked)
Hello chat6m 25s
-
(Locked)
The chat loop5m 19s
-
(Locked)
Error handling7m 35s
-
(Locked)
Using the Azure OpenAI service5m 35s
-
(Locked)
Streaming vs. non-streaming2m 43s
-
(Locked)
Implementing streaming completion7m 18s
-
(Locked)
Challenge: Fix the bugs41s
-
(Locked)
Solution: Fix the bugs6m 40s
-
-
-