Grok Integration Documentation
Overview
The Grok Integration provides a seamless interface to interact with the X.AI Grok API, which is designed for advanced chat completions and AI-generated summaries specific to data dashboards. This integration allows users to leverage AI capabilities for generating insights, chat interactions, and automated summaries based on various data inputs.
Purpose
The primary purpose of the Grok Integration is to facilitate:
- Chat-driven interactions using the Grok API for real-time communication.
- Automated summaries and insights generation for dashboard tiles, allowing users to quickly understand their data visualizations.
- Enhanced data analysis through AI by providing context-aware responses based on previous interactions.
Settings
The Grok integration comprises several essential settings, which need to be configured to establish robust API interactions.
1. apiKey
- Input Type: String
- Description: This is the key required to authenticate API requests to the Grok service. It is crucial for ensuring secure access to your Grok account. If this key is not provided, the integration cannot function, and all API calls will be denied.
- Default Value:
null(must be set by the user)
2. model
- Input Type: String
- Description: This setting allows users to specify the model ID for performing API calls to the Grok service. By default, it uses 'grok-beta', which is intended for general usage. Changing this value can provide different behavior or capabilities depending on the AI model that is chosen.
- Default Value:
'grok-beta'
3. messages
- Input Type: Array
- Description: A list of messages, each specifying a
role(either 'user' or 'system') andcontent. This forms the basis for the conversation and affects the generated AI responses. The integration will throw an error if this array is empty or not provided during chat completion. - Default Value:
[](must be populated for functions that require chat)
4. maxTokens
- Input Type: Numeric
- Description: Defines the maximum number of tokens that can be generated in the response. This setting affects the length of the output; a higher value allows for more extensive responses, while a lower value restricts the output to brief summaries.
- Default Value:
500
5. temperature
- Input Type: Numeric
- Description: Controls the randomness of the output generated by the model. Values can range from 0 to 2. A lower temperature results in more deterministic outputs, while a higher temperature may yield more diverse and creative responses.
- Default Value:
0.7
6. stream
- Input Type: Boolean
- Description: When enabled, allows for streaming chat completions, meaning responses will be sent in chunks as they are generated. This can provide a more dynamic user experience when interacting via chat.
- Default Value:
false
7. system
- Input Type: String
- Description: An optional string configuration that can be provided to set contextual information for the AI model. This can enhance the focus and relevance of generated responses based on specific guidelines or instructions for the conversation.
- Default Value:
null
How It Works
The integration operates by sending structured requests to the Grok API endpoint, utilizing Bearer token authentication for secure and authenticated access. Users can configure the various settings to tailor the integration to fulfill their specific analytic and conversational requirements.
- Initialization of the integration is performed with a provided API key.
- Users can set or change the AI model being used for interactions.
- When a chat or summary request is initiated, messages and configuration options are validated.
- Data is formatted and sent to the Grok API, where responses are generated based on the provided inputs.
- The integration can handle both single-request completions and streaming responses for ongoing interaction.
Expected Data
The Grok integration expects structured JSON data for several key functions, above all:
- Messages: A structured array defining conversations with roles and content.
- Tile Data: This may include various forms of visualization data (e.g., numerical arrays, objects) for generating summaries.
- Configuration Objects: Contains additional optional data to refine responses further.
AI Integrations
The Grok integration leverages AI capabilities specifically designed for analytical tasks:
- Generating summaries and insights based on data visualizations.
- Engaging in dynamic conversations that reference historical context and user questions.
- Adjusting outputs based on real-time user inputs and the specified AI model.
Billing Impact
Utilizing the Grok integration may incur costs based on:
- The number of API calls made.
- The tokens used per request (specific billing terms may apply depending on X.AI's pricing policies).
It is essential for users to review their usage statistics regularly to manage costs effectively.
Use Cases & Examples
Use Case 1: Automated Insight Generation for Dashboards
A product management team uses the Grok integration to automatically generate summaries for their analytics dashboard. This saves time and improves understanding among team members who might not be data-savvy.
Use Case 2: Chat Interaction for User Queries
Customer support teams can leverage the Grok integration to respond to user inquiries about data directly from the dashboard, providing immediate context-aware support.
Detailed Example Configuration
For the first use case, the following is a sample configuration that automatically summarizes a product analytics dashboard:
{
"tileTitle": "Product Performance Overview",
"tileType": "bar",
"tileData": [
{"product": "A", "sales": 1200, "returns": 50},
{"product": "B", "sales": 900, "returns": 30},
{"product": "C", "sales": 1500, "returns": 75}
],
"tileConfig": {
"visualizationType": "bar"
},
"context": "Analyze the overall performance of products to identify trends.",
"userQuestion": "What can you tell me about the products in Q1 2023?",
"dataFilterInfo": "Sales data for the first quarter."
}By utilizing this configuration with the generateTileSummary method, the integration can produce actionable insights that inform strategic decisions for the product management team.