Smart Grid AI Assistant Tools SetupPremium
The Smart Grid provides AI Assistant tools that enable you to apply Grid operations through natural language prompts. The Grid supports three main approaches for connecting these tools to your backend AI service, allowing you to choose the level of control that best fits your application requirements.
The AI Assistant tools that support these approaches for integrating with your AI service are:
Choose an integration approach based on how much control you need over the AI communication:
- Automatic integration—The simplest approach where you pass a
requestUrland the Grid handles the communication with your AI service automatically. - Controlled integration—Automatic handling with request/response customization.
- Manual integration—Full control over AI service communication while using the built-in AI Assistant UI.
Each integration approach requires a backend AI service to process natural language prompts and return structured Grid commands. For guidance on implementing your backend service, see the AI Service Setup article.
Automatic Integration
The automatic approach is the simplest way to integrate AI functionality with your Grid. The AI Assistant toolbar tool handles all communication with your AI service internally through HTTP requests.
To configure automatic integration, add a GridToolbarAIAssistant component to the Grid and set its requestUrl property to point to your custom AI service endpoint:
<GridToolbarAIAssistant requestUrl="https://your-ai-service.com/api/grid" />
The
requestUrldefines the endpoint where your natural language queries will be processed. It should point to your custom AI service that can understand your domain-specific data and business logic.
For comprehensive information about implementing your AI service including detailed request/response formats and server-side implementation, see AI Service Setup.
Controlled Integration
In the controlled approach, you maintain full control over the AI assistant's state and behavior while leveraging built-in AI service communication. This allows you to validate AI suggestions and apply custom business logic before executing operations.
<GridToolbarAIAssistant
requestUrl="https://your-ai-service.com/api/grid"
onPromptRequest={handleBeforeRequest}
onResponseSuccess={onResponseSuccess}
/>
The following example demonstrates controlled integration where the AI Assistant still handles the HTTP request automatically, but the prompt outputs are customized through request and response event handlers.
Request Options
When using requestUrl, you can also customize the settings of the internally sent HTTP request through the requestOptions property. This allows you to add authentication headers, configure request parameters, and set other HTTP options without having to implement custom request logic:
<GridToolbarAIAssistant requestUrl="https://your-ai-service.com/api/grid" requestOptions={{ timeout: 5000 }} />
The
requestOptionsproperty is only applicable when you have defined arequestUrl. When implementing manual integration, you handle the HTTP request configuration directly in your custom implementation.
Manual Integration
For complete control over the AI interaction, you can manually handle all AI service communication through the onPromptRequest event. This approach gives you complete control over how requests are sent and responses are processed, making it suitable for complex scenarios or proprietary AI systems.
<GridToolbarAIAssistant onPromptRequest={handleBeforeRequest} />
The onPromptRequest event provides the user's prompt, Grid column information, and request settings, allowing you to implement fully customized AI service communication while maintaining access to the Grid context.
The following example demonstrates how to manually send requests to an AI service and process the AI responses to apply basic data operations (filtering, sorting, and grouping) to the Grid. Because this demo showcases the manual mode of the component, it also demonstrates how to use the outputs prop along with additional logic to display the prompt output history.