Suggestions
Get suggestions for your users after each assistant message.
Tambo automatically analyzes user interactions and generates contextual suggestions after each assistant message.
Using Suggestions
The useTamboSuggestions Hook
The main way to interact with suggestions is through the useTamboSuggestions
hook:
Hook Configuration
The useTamboSuggestions
hook accepts an optional configuration object:
When Suggestions Appear
Suggestions are automatically generated after each assistant (tambo) message in the thread. The hook manages:
- Loading states while generating suggestions
- Error handling for failed generations
- Automatic cleanup when messages change
Accepting Suggestions
The accept
function provides two modes:
Suggestion Types
Basic Suggestion Structure
State Management Types
The hook uses additional types for state management:
Error Handling
The hook provides built-in error handling for common scenarios:
Integration Example
Here's a complete example showing how to integrate suggestions with a message thread:
Suggestions are automatically generated for each tambo message when the
useTamboSuggestions
hook is used. You don't need to manually trigger
suggestion generation.