Follow-up Suggestions
AI-generated contextual follow-up questions after responses
Overview
After the AI responds, ChatJS can generate contextual follow-up questions using a fast, cheap model. These appear as clickable buttons below the last assistant message. Clicking a suggestion sends it as a new user message.
Quick Start
Enable follow-up suggestions in chat.config.ts:
ai: {
tools: {
followupSuggestions: {
enabled: true,
},
},
}
No API keys or external services are required. Suggestions use one of your existing language model providers.
How It Works
- The main AI response completes
- A fast model generates 3-5 contextual follow-up questions
- Suggestions stream to the client as the model produces them
- They render as buttons below the last assistant message
- Clicking a suggestion sends it as a new user message
Suggestions are UI-only. They are never included in the conversation context sent to the LLM.
Configuration
Model Selection
Configure which model generates suggestions in chat.config.ts:
ai: {
tools: {
followupSuggestions: {
enabled: true,
default: "google/gemini-2.5-flash-lite",
},
},
}
Use a fast, inexpensive model here. The suggestions prompt is lightweight and does not require a powerful model.
Related
- Follow-up Questions Cookbook for implementation details and code walkthrough