Suggestions
Implementing intelligent suggestions and recommendations.
Suggestions
Hydra AI automatically analyzes user interactions and generates contextual suggestions after each assistant message.
Using Suggestions
The useHydraSuggestions Hook
The main way to interact with suggestions is through the useHydraSuggestions
hook:
Hook Configuration
The useHydraSuggestions
hook accepts an optional configuration object:
When Suggestions Appear
Suggestions are automatically generated after each assistant (Hydra) 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 Hydra message when the
useHydraSuggestions
hook is used. You don't need to manually trigger
suggestion generation.