This SDK uses the previous version of RAG Framework as backend. We are working on updating it to the new version.
Features
The Mercury Assistant SDK provides several key features:- Shadow DOM Technology:
- Renders HTML elements independently, preserving your app’s design.
- Limitations: Currently, only system fonts are supported.
- Chat Window Integration:
- Embed the chat window in any HTML element as a full-page view, a floating button, or a sidebar, providing flexible integration options.
- Chat Behavior Management:
- The SDK manages the chat session automatically. When a user initiates a conversation, a thread ID is saved in LocalStorage, allowing the chat to persist across sessions.
- Proactive Suggestions:
- Our AI assistant can suggest questions proactively, guiding the conversation and enhancing the user experience. This feature can be disabled through the SDK settings.
Setup
Before integrating the Mercury Assistant SDK into your web application, you’ll need to complete the following steps:1. Request Access
- Contact a member of the innovations team to set up the assistant for your use case
- Find team member contact information in the Peak Innovations Members directory
2. Prepare Knowledge Base
- Compile your knowledge base content into PDF files
- Submit these files to the innovations team for processing
- The team will handle the uploading and vectorization of your content
3. Obtain Credentials
- Once your knowledge base is processed, you’ll receive a unique
appId - This
appIdwill be used to configure your assistant and access your specific knowledge base
4. Begin Integration
- After receiving your
appId, you can proceed with implementing the SDK - Follow the configuration guidelines below to customize the assistant for your needs
Configuration Options
The configuration is stored in one JSON object which you can use to create an assistant, see theinitMercuryChat here:
Basic Configuration
Assistant Customization
Greeting Configuration
Suggested Questions
Visual Customization
Input Field Customization
References & Citations
Reset Conversation
Implementation Example
Storage Management
The SDK automatically manages chat sessions using LocalStorage. You can override this behavior by providing custom storage functions:Best Practices
- Responsive Design
- Always specify either fixed dimensions or responsive values for
heightandwidth - Use theme variables for consistent styling across different screen sizes
- Performance
- Enable
showAssistantMessageReferencesonly when citation display is necessary - Use
randomlySelectedSuggestedQuestionsto limit the number of displayed suggestions
- User Experience
- Provide clear greeting messages to guide users
- Configure reset conversation options for better session management
- Use appropriate theme colors that match your application’s design
- Accessibility
- Ensure sufficient color contrast in theme configuration
- Provide meaningful alt text for assistant and message icons
- Use clear, descriptive labels in the interface
Common Issues and Solutions
- Chat Window Not Appearing
- Verify that the container ID exists in your HTML
- Check if the appId is correct and active
- Ensure all required configuration options are provided
- Styling Conflicts
- Use the provided
classNameoption to add custom styles - Utilize the theme configuration for consistent styling
- Avoid global styles that might affect the chat interface
- Local Storage Issues
- Implement custom storage functions if needed
- Clear local storage when testing new configurations
- Handle storage errors gracefully
- Message Reference Display
- Enable
showAssistantMessageReferencesfor citation display - Configure
globalReferenceDialogfor additional context - Handle reference loading states appropriately