
A powerful chat widget library for AI agents - Built for React and vanilla JavaScript
Documentation β’ Features β’ Installation β’ Usage β’ Contributing
dynamiq-assistant allows you to seamlessly integrate AI agents into your applications through customizable chat widgets. Built specifically for agentic AI experiences, it provides React and vanilla JavaScript components that connect directly to your Dynamiq-powered AI agents.
Dynamiq is an orchestration framework for agentic AI and LLM applications, enabling businesses to build, deploy, and manage intelligent AI agents at scale.
- π€ AI Agent Integration - Purpose-built for connecting to Dynamiq AI agents
- π± Cross-Platform Support - Works with React and vanilla JavaScript
- π¨ Customizable UI - Fully customizable appearance with theme support
- π‘ Streaming Support - Real-time streaming responses from AI agents
- π File Upload - Enable AI agents to process images, PDFs, and documents
- π― Flexible Positioning - Position the agent widget anywhere on your page
- π§ Event Handlers - Handle agent feedback, actions, and responses
- π Vega Chart Support - AI agents can render data visualizations seamlessly
npm install @dynamiq/assistant marked@15 vega@5.33.0 vega-lite@5.23.0 vega-embed@6.29.0
Or using yarn:
yarn add @dynamiq/assistant marked@15 vega@5.33.0 vega-lite@5.23.0 vega-embed@6.29.0
To use @dynamiq/assistant
, first navigate to your Dynamiq deployment:
- Go to Deployments and ensure Endpoint Authorization is disabled
- Click on the Integration tab
- Switch to the Chat Widget menu item
- Copy your unique API URL
import { DynamiqAssistant } from '@dynamiq/assistant/react';
const App = () => {
return (
<DynamiqAssistant
title="Dynamiq Assistant"
placeholder="Type your message..."
position="bottom-right"
api={{
url: '<YOUR_API_URL>',
streaming: true,
}}
allowFileUpload={true}
maxFileSize={10 * 1024 * 1024} // 10MB
acceptedFileTypes="image/*,.pdf,.doc,.docx,.txt"
params={{
userId: '123',
sessionId: '234',
userName: 'John Doe',
language: 'en',
}}
prompts={[
{ icon: 'π¬', text: 'What documents are needed for the loan?' },
{
icon: <FontAwesomeIcon icon={faUser} />,
text: 'What is the maximum loan amount?',
},
]}
footerText={
'Powered by <a href="https://getdynamiq.ai" target="_blank">Dynamiq</a>'
}
/>
);
};
import { DynamiqAssistant } from '@dynamiq/assistant/vanilla';
const assistant = new DynamiqAssistant('#dynamiq-assistant-container', {
title: 'Dynamiq Assistant',
placeholder: 'Type your message...',
position: 'bottom-left',
api: {
url: '<YOUR_API_URL>',
streaming: true,
},
allowFileUpload: false,
maxFileSize: 5 * 1024 * 1024, // 5MB
acceptedFileTypes: 'image/*,.pdf',
});
<script src="https://cdn.jsdelivr.net/npm/vega@5.33.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite@5.23.0"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed@6.29.0"></script>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@dynamiq/assistant@latest/dist/index.browser.js"></script>
<script>
const assistant = new dynamiq.DynamiqAssistant(
'#dynamiq-assistant-container',
{
title: 'Dynamiq Assistant',
placeholder: 'Type your message...',
position: 'bottom-left',
api: {
url: '<YOUR_API_URL>',
streaming: true,
},
}
);
</script>
Your assistant will appear as an elegant chat widget on your page:
Name | Type | Description |
---|---|---|
title |
string | ReactNode |
The title of the assistant. Can be string or ReactNode. |
placeholder |
string |
The placeholder text of the chat input. |
welcomeTitle |
string |
The title of the welcome screen. |
welcomeSubtitle |
string |
The subtitle of the welcome screen. |
position |
string |
The position of the assistant. Can be bottom-right , bottom-left , top-right , or top-left . |
api.url |
string |
The URL of the assistant endpoint. |
api.streaming |
boolean |
Whether to enable response streaming. |
allowFileUpload |
boolean |
Whether to allow file uploads. |
maxFileSize |
number |
The maximum file size for file uploads in bytes. |
acceptedFileTypes |
string |
The accepted file types for file uploads. |
params |
object |
The parameters to pass to the assistant input. |
params.userId |
string |
The user ID. By default crypto.randomUUID() . |
params.sessionId |
string |
The session ID. By default crypto.randomUUID() . |
toggleButton |
string |
The ID of the button to toggle the assistant. |
prompts |
array |
The prompts to show in the assistant. |
prompts.icon |
string | ReactNode |
The icon to show in the prompt. |
prompts.text |
string |
The text to show in the prompt. |
theme.primaryColor |
string |
The primary color of the assistant. |
theme.secondaryColor |
string |
The secondary color of the assistant. |
theme.fontFamily |
string |
The font family of the assistant. |
allowFullScreen |
boolean |
Whether to show the full screen button. |
footerText |
string |
The text to show in the footer. |
poweredBy |
string |
The text to show in the powered by section. |
humanSupport |
string |
The text to show in the human support section. |
intermediateStreaming |
boolean |
Whether to show the intermediate steps if they are available. By default true . |
Name | Description |
---|---|
onFeedback |
The callback function to handle the feedback. |
onImageBlock |
The callback function to handle image blocks. |
onLink |
The callback function to handle links. |
We welcome contributions! Please see our Contributing Guide for details on how to get started.
# Install dependencies
npm install
# Run development server
npm run dev
# Build the library
npm run build
# Run tests
npm run test
# Lint code
npm run lint
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.