From the course: Hands-On AI: Build Your Own GPTs

User intent detection - ChatGPT Tutorial

From the course: Hands-On AI: Build Your Own GPTs

User intent detection

- [Instructor] Chitchat WeChat Bot is a type of conversation where the user mentions something that's not directly related to their primary goal. For example, they might ask, what's the weather like today? Do you have any hobbies? What's the capital of Greece? What's two plus two, or tell me a joke? These topics are outside the scope of our custom GPT. In this section, we are going to build a gift advisor. Ladies, Lilis will provide a personalized recommendations for birthday gifts, wedding presents, and tokens of appreciation. If a user request falls outside gift shopping, we want Lilis to gently remind them of her specific role and guide the conversation back. But how can we achieve this? The tool we'll use is code State Machine. A State Machine is a model used to represent systems with a limited number of distinct states. A simple example is the traffic light, which has three colors, green, yellow, and red. To change these colors, we use a timer to count seconds. If it's red and the timer reaches 60 seconds, the traffic light switches from red to green. If it's yellow and the timer reaches five seconds, the traffic light switches from yellow to red. The new color depends on the current color, and the elapsed time. We'll use State Machine to design the flow for Lilis. When a conversation begins, run a user intent detection. If the user inquires about gift shopping, go to the gift state. Otherwise, if the inquiries are unrelated, switch to the others state. Now we can move forward to create the pentagram prompt for Lilis. Simple to our approach with KK and a senzu, we added details for the persona, the context, the output, and the constraint. You can take a closer look at this components by looking back in this video. We want to highlight the task components because we'll integrate the State Machine here. We are adding a layer of intent detection, for example, classified intent of user input. If it's about gift recommendations, go to gift. Otherwise, go to others. In gift state, when users ask for gift suggestions, step one, do not offer gift advice immediately. Instead, ask the user a couple questions for details about the recipient and occasion. Step two, ask the user about budget. Step three, ask for preferences or restrictions. Step four, identify key factors that will influence the gift suggestions. Step five, generating gift recommendations. Others, if the user's request falls outside, gently remind them of your specific role and guide conversation back. Great, now, let's bring Lilis to life using the State Machine approach. Click the button, Create. From the Configured tab, we call her Gift Advisor Lilis. Upload the profile photo. Description about Lilis. I'm Lilis, your personal lives give advisor ready to find the perfect gift for any occasion person in the budget. Let's make gift giving, thoughtful, exciting, and stress free. Give some conversation starters to show users how to kick off the conversation. For example, you can say, birthday gift for my friend, or Valentines Day gift that goes beyond the usual chocolates and flowers. Or gifts for a Secret Santa Exchange at the office. Educational gift for a 7-year-old. Next, in the Knowledge section, upload knowledge. Excelling at gift giving. I create this essay using ChatGPT. I asked ChatGBT to write an essay about how to become excellent at giving gifts as a professor teaching MBA courses at a university. Click Upload Files. Select a File. Finally paste the State Machine prompt in the Instructions section. Now let's test Lilis with some chitchat. What's the weather like today? Cool, we see Lilis didn't answer about weather. She is trying to get conversation back to gift shopping. Lilis, do you have any hobbies? Cool. Now I'm asking Lilis what's the capital of Greece? Something not related to gift shopping and see how Lilis can turn back the conversation. Let's run a test with math question. What's two plus three, which is definitely not related to gift shopping. See, Lilis is smart. She is turning the conversation around and asking me about the recipient and the occasion. Sorry, Lilis, just one more test. Tell me a joke. Cool, Lilis is so focused. Lilis is showing us that she is even more patient and rational than many of us. This really showcases the incredible potential GPT has in customer service.

Contents