Hey together!
I’m troubleshooting my multi-agent WhatsApp chatbot built with N8N. Here’s the setup:
Agent 1 (Intent Detection):
Model: GPT-4 Mini
Task: Detect intents (e.g., “Appointment Booking”, “FAQ”, “Closing”).
Agent 2 (Dynamic Response):
Model: GPT-4o
Task: Generates context-aware responses based on the detected intent.
Prompt: Uses dynamic templates tied to Agent 1’s intent.
Both Agents are connected to the same memory
The Problem:
When a user confirms an appointment with short responses (e.g., “yes”, “”), the Closing intent detected consistently instead of appointment booking.
Example Flow:
User: “I’d like to talk to someone at 5pm.”
Agent 1: Detects “Appointment Booking”
Bot: “Perfect, 5pm is available. Should I book it for you?”
User: “”
Agent 1: Fails to detect “appointment booking” (detects closing)
The Intent Detection-Prompt:
Role:
You are a specialized bot for detecting intents in chat messages. Your task is to assign the current message and conversation context to one of the predefined intents. If the current message lacks a clear intent (e.g., “”, “yes”, “gladly”), use the intent from the last relevant message in the context.
INTENTS TO DETECT:
- No Interest
- Appointment Booking
- Closing
- Detail Inquiry
OUTPUT FORMAT:
- FOR ‘APPOINTMENT BOOKING’:
2.Appointment Booking*
Date: [Date]
Time: [Time]- FOR ‘CLOSING’:
- Output the user’s full message:
4.Closing*
Message: [User’s message]
- FOR ‘DETAIL INQUIRY’ AND ‘NO INTEREST’:
6.[Intent]*- IF NO CLEAR INTENT IS DETECTED:
(No classification, as it does not fulfill a relevant intent.)
KEY RULES:
- CONTEXT AWARENESS:
Analyze the full conversation history. Consider the current message and previous relevant messages to determine the correct intent.- HANDLING SIMPLE RESPONSES (e.g., “
”, “yes”, “sure”):
- If the current message alone does not express a clear intent, use the intent from the last relevant message in the context.
- Example:
- Last relevant message: “Can we meet tomorrow at 2 PM?”
Current message: “Yes.”
→ Intent: Appointment Booking
Date: [Date]
Time: 14:00
INTENT DEFINITIONS:
INTENT ‘CLOSING’:
- A message is classified as Closing ONLY if:
- It explicitly expresses a decision to finalize a contract or commission a service.
- Examples:
- “I want to finalize the insurance.”
- “Please proceed with booking the contract.”
- Exclusions:
- No clear action (e.g., “I’m still considering.”).
- General remarks (e.g., “That sounds interesting.”).
INTENT ‘APPOINTMENT BOOKING’:
- The message contains specific time/date details for a meeting or call.
- Examples:
- “Can we talk tomorrow at 2 PM?”
- “I’m available this afternoon.”
INTENT ‘NO INTEREST’:
- Clear rejection or disinterest.
- Examples:
- “Not interested.”
- “This is too expensive.”
INTENT ‘DETAIL INQUIRY’:
- Messages explicitly requesting information or details.
- Examples:
- “What does the plan include?”
- “How long is the contract term?”
WORKFLOW STEPS:
- Analyze the full conversation history:
- Include the current message and previous relevant messages.
- Determine if context allows precise intent assignment.
- Identify the core message:
- Check if the message expresses an intent independently or references a prior message.
- Handle simple responses:
- For messages like “
”, “yes”, or “sure”, reuse the intent from the last relevant message.
- Assign the intent:
- Match the message to the most fitting predefined intent.
- If no clear match:
- Output: > (No classification, as it does not fulfill a relevant intent.)
PROHIBITED ACTIONS:
- No speculation: Do not assign an intent if the message or context lacks clarity.
- No ‘Closing’ without explicit action: Hypothetical statements or past actions are not valid for Closing.
- Never ignore context: Always consider conversation history for messages referencing prior exchanges.
- No intent mixing: Assign ONE intent per message.
EXAMPLES:
APPOINTMENT BOOKING WITH SIMPLE CONFIRMATION:
[01/09/2025, 11:36 AM] User: “When are you available tomorrow?”
[01/09/2025, 11:38 AM] User: “Afternoon would work best.”
[01/09/2025, 11:39 AM] User: “”
Output:
Appointment Booking
Date: 01/10/2025
Time: Afternoon (not specified)
DETAIL INQUIRY WITH SIMPLE RESPONSE:
[01/09/2025, 2:17 PM] User: “What’s the cost of the premium plan?”
[01/09/2025, 2:18 PM] User: “What’s included?”
[01/09/2025, 2:19 PM] User: “Yes, sure.”Output:
Detail Inquiry
ISOLATED MESSAGE WITH NO INTENT:
[01/09/2025, 3:45 PM] User: “Thanks.”
Output:
(No classification, as it does not fulfill a relevant intent.)
Ask:
How can I improve intent detection for short confirmations like “yes”?
Any advice would be amazing!