UChat Official

Introduction

This comprehensive overview explores the core mechanism behind the AI chatbot's intent selector, a pivotal component that determines the user's intent and directs the conversation flow accordingly.

The intent selector acts as the brain of the chatbot, analyzing recent chat history, categorizing user inputs, and triggering the appropriate response flow without manual intervention.

This process is designed to be automated, efficient, and scalable, ensuring seamless user experiences across various interaction types.

Deep Dive into the Intent Selector Process

1. Understanding the Role of the Intent Selector

The intent selector's primary function is to identify the user's intent based on their latest input and route the conversation to the correct flow. It accomplishes this by:

  • Analyzing recent chat history

  • Categorizing user queries into predefined intents

  • Triggering specific flows such as small talk, FAQs, membership, coaching calls, or live support

This process ensures that the chatbot responds contextually and appropriately to user needs, enhancing engagement and efficiency.

2. Managing Chat History with JSON Slicing

To accurately determine intent, the system references recent chat history stored in a JSON custom field. Since this field has a character limit of 20,000, it’s essential to slice the data to retain only the most relevant parts.

Step

Action

Explanation

Slice Operation

get slice of items

Extracts the last 9 entries from chat history, ensuring enough context without exceeding limits.

Offset Setting

-9

Keeps the most recent 9 messages, discarding older ones.

Sample Data

Review of sliced data

Contains entries like system and user messages, providing context for intent analysis.

This approach balances context richness with data constraints, enabling GPT to make accurate intent predictions.

3. Using GPT for Intent Classification

The core of the intent detection relies on OpenAI's GPT model, specifically the GPT-4 Turbo variant, chosen for its speed and cost-efficiency.

  • Prompt Design:
    The prompt instructs GPT to determine the intent based solely on the user's latest message and recent chat history, outputting only the matched intent name.

  • Function Enablement:
    All predefined intent functions are enabled, allowing GPT to select the appropriate one based on the input.

  • Model Settings:

    • Model: GPT-4 Turbo (e.g., gpt-4-turbo-1106-preview)

    • Max Tokens: Default (sufficient for intent classification)

    • Temperature: 0.4 (to balance creativity and accuracy)

  • Response Handling:
    The response includes the matched intent, which is stored in a custom field for subsequent routing.

4. Mapping GPT Output to Flows

Once GPT determines the intent, the system maps this to specific conversation flows using conditional logic:

  • Intent Matching:
    The system checks if the intent_matched custom field contains specific keywords like small_talk, FAQ, membership, coaching, or live_support.

  • Conditional Routing:
    Based on the matched intent, the chatbot triggers the corresponding flow, such as:

    • Small Talk

    • FAQ

    • Membership

    • Coaching Call

    • Live Support

  • Fallback Handling:
    If no intent matches, the system can fallback to a default action, such as notifying an administrator or prompting manual intervention.

Intent Type

Triggered Flow

Description

Small Talk

Small Talk Flow

Handles casual conversations like greetings or general chit-chat.

FAQ

FAQ Flow

Provides answers to common questions.

Membership

Membership Flow

Manages membership-related inquiries.

Coaching

Coaching Call Flow

Handles coaching session requests, capturing parameters.

Live Support

Live Support Flow

Connects users to human agents or support resources.

5. Handling Intent Classification Failures

In cases where GPT fails to determine an intent:

  • The system maps this to an intent_match_fail custom field.

  • A notification can be sent to administrators for troubleshooting.

  • The chatbot can prompt the user for clarification or escalate the conversation.

This fallback mechanism ensures robustness and continuous operation even in ambiguous situations.

6. Expanding and Customizing the System

The system is designed to be scalable:

  • Adding new intents involves creating new functions and updating the conditional logic.

  • The number of notes (or conditions) is flexible; with just 11 notes, the core framework is established.

  • As the number of intents grows, the condition groups can be expanded accordingly.

7. Advantages of This Approach

  • No manual buttons or selections needed; the AI automatically determines the flow.

  • Context-aware: Uses recent chat history for accurate intent detection.

  • Flexible: Easily add or modify intents and flows.

  • Efficient: Uses GPT-4 Turbo for fast responses.

  • Scalable: Can handle multiple intents with minimal manual setup.

Summary

In summary, the intent selector is a crucial component that leverages chat history slicing, GPT-based intent classification, and conditional routing to create a dynamic, automated conversation system. This setup minimizes manual intervention, enhances user experience, and provides a robust framework for expanding chatbot capabilities. Future enhancements, such as detailed coaching call flows, will further refine the system's ability to capture parameters and personalize interactions. As the system evolves, it promises to deliver increasingly intelligent and seamless conversational experiences, making AI-driven chatbots a powerful tool for customer engagement and support.