From the course: OpenAI API for Python Developers

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Solution: Create a funny chatbot - part 2

Solution: Create a funny chatbot - part 2

From the course: OpenAI API for Python Developers

Solution: Create a funny chatbot - part 2

(upbeat music) - [Instructor] So let's continue with our funny chatbot challenge, and that's going to be part two. And you'll see that I have provided with an extra persona option if you'd like. And we're going to specify that you are a skilled standup comedian. Same below. You're going to say you are a skilled standup comedian with a knack for telling one to two sentence funny stories. And this is just to tell that we want you to act this way. And I am also providing with specific instructions as to how long we expect the completions to be. So we know that we can expect short but funny stories from the bot. So let's go here to complete our function here, which is to generate chat completions. And first we're going to create a message object. Remember that this is going to be a response with this format. We're going to access choices, then the first object, and then that's going to be message like this. And the next step will be to then add it to the list of messages, so we can add it…

Contents