From the course: Creating AI Applications with Python and GitHub Models
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Solution: Make changes to the code as required
From the course: Creating AI Applications with Python and GitHub Models
Solution: Make changes to the code as required
(upbeat music) - [Lecturer] At the end of our previous solution video, the Python code for making calls to the open AI chat completion API didn't work. So let's try and fix our Python code. I can see that the error that we have is because we've used an older version of the chat completion from OpenAI. So we have the option of running OpenAI migrate and there are a couple of options available to us. So let me just go ahead and select this link and let me go ahead and try and find some code that will work for us. And so if I compare this code to what I had earlier, you can see that the problem seems to be that I'm using OpenAI chat completion.create. While as, what I actually need is client.chat.completions.create. And so let me just go ahead and copy this bit of code and let's head back to the code section here and let's replace this. So I've got to be a little bit careful here. So I'm going to go ahead and replace this with this code. So I'm going to use response as my variable name…
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
-
-
-
-
Using GitHub spaces2m 29s
-
(Locked)
Challenge: Choose your LLM18s
-
(Locked)
Solution: Choose your LLM1m 25s
-
(Locked)
Challenge: Create your app45s
-
(Locked)
Solution: Create your app5m 39s
-
(Locked)
Challenge: Make changes to the code as required29s
-
(Locked)
Solution: Make changes to the code as required4m 49s
-
(Locked)
Deploy the app to production4m 20s
-
-