From the course: Building a Project with the ChatGPT API
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Construct a multi-turn conversation - ChatGPT Tutorial
From the course: Building a Project with the ChatGPT API
Construct a multi-turn conversation
- [Instructor] Let's continue building our ChatGPT-powered application by expanding the single prompt into a multi-turn conversation with the AI assistant. We'll show the AI assistant how to remember the conversation, showing the real power of ChatGPT. This API documentation shows a sample multi-turn conversation here in lines six through nine. There's a system message and a series of user and assistant messages. Each interaction with the AI assistant is a new session, which means the model doesn't remember previous prompts or responses. For the model to remember the entire chat message history, including user prompts and assistant responses, each must be included in the exchange. The messages parameter here on line five is the key to making this work. Notice the entire conversation is sent in this example. This technique is called prompt chaining. Let's navigate to the Jupyter Notebook to see it in action. While we…
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.