From the course: Hands-On AI: Building Your First Conversational AI Chatbot

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Upgrade 2: Improving response coherence and context awareness (and resources)

Upgrade 2: Improving response coherence and context awareness (and resources)

From the course: Hands-On AI: Building Your First Conversational AI Chatbot

Upgrade 2: Improving response coherence and context awareness (and resources)

- [Instructor] In this upgrade, we are going to focus on improving coherence and context awareness. If you've ever talked to a bot that responds to every message like it's hearing from you for the first time, you know how quickly that can get frustrating. Human conversations don't work that way. We build meaning over time, responding not just to the current sentence, but also to the overall context. For a chat bot to feel more natural, it has to do the same. Some basic chat bots treat every user message as a standalone prompt, responding without remembering previous conversations. But if we want them to carry on the conversation, they need a way to remember what's been said. That's where context memory comes in. Now, we're going to show you how to add a lightweight memory mechanism using a list called conversation_history. This list will keep track of recent chat history. Every time the user says something, their message is added to the history. We then construct a new prompt by…

Contents