Skip to content

Follow-Up Questions

Overview

Follow-Up Questions are AI-generated clickable suggestions that help visitors continue the conversation. After the bot responds, it suggests 3-5 relevant questions the visitor might want to ask next.

User Experience

After receiving a bot response, visitors see:

[Bot's answer to their question]

👉 You might also want to ask:
  • How does pricing work?
  • Can I see a demo?
  • What integrations do you support?

Clicking a suggestion sends it as the visitor's next message.

Architecture

sequenceDiagram participant User participant Frontend participant LangGraph participant FollowUp as follow_up_suggester participant LLM User->>Frontend: Sends message Frontend->>LangGraph: Query LangGraph->>LangGraph: Generate response LangGraph->>FollowUp: After answer_writer FollowUp->>LLM: Generate suggestions based on:<br/>- Bot's answer<br/>- Conversation history<br/>- Visitor profile<br/>- Retrieved context LLM-->>FollowUp: 3-5 questions FollowUp-->>LangGraph: suggested_follow_ups[] LangGraph-->>Frontend: Response + suggestions Frontend->>Frontend: Render FollowUpQuestions component

Emoji Marker

  • 👉 (pointing right) in the response indicates follow-up suggestions are available
  • The marker is detected by dialog_state_extractor.py
  • When present, the suggestion_router routes to follow_up_suggester_node

Key Files

Backend

File Purpose
ixchat/nodes/follow_up_suggester.py Generates contextual follow-up questions
ixchat/nodes/suggestion_router.py Routes based on emoji markers
ixchat/nodes/dialog_state_extractor.py Extracts 👉 marker
prompts/website-agent/suggested-questions.md Langfuse prompt template

Frontend

File Purpose
shared/src/components/FollowUpQuestions.tsx Renders clickable suggestions

Generation Context

The LLM generates suggestions based on:

  1. Bot's answer - Most important, directly references what was said
  2. User's question - Original query context
  3. Conversation history - Previous exchanges
  4. Visitor profile - Company, sector, sub-sector
  5. Retrieved context - Available topics in knowledge base

Output Format

class FollowUpQuestions(BaseModel):
    questions: list[str] = Field(
        description="List of 3-5 follow-up questions",
        min_length=3,
        max_length=5,
    )

Routing Logic

Follow-up suggestions are skipped when the response contains:

Marker Meaning
👇 Demo proposal (uses suggested answers instead)
💌 Content gating offer
👈 Other special handling

Frontend Component

<FollowUpQuestions
    questions={suggestedFollowUps}
    onQuestionClick={(question) => sendMessage(question)}
    primaryColor={themeColor}
/>

Features: - Staggered animation on appearance - Click to send as next message - Respects theme colors

Debugging

Backend logs use the 💡 [FOLLOW-UP SUGGESTER] prefix:

💡 [FOLLOW-UP SUGGESTER] Generating follow-up questions based on assistant's answer
📝 Using assistant's answer for follow-up generation (length: 450 chars)
📚 Retrieved context available (length: 2000 chars)

Testing

poetry run pytest packages/ixchat/ixchat/nodes/tests/test_follow_up_suggester.py -v