-
Notifications
You must be signed in to change notification settings - Fork 1
AI assistance
data-primals-engine includes a powerful, built-in AI assistant named Prior. This assistant is designed to understand natural language queries, allowing you to interact with your data, generate insights, and perform actions without writing complex code or API requests.
To use the AI assistant, you must first provide API keys for one or more supported AI providers. The engine natively supports providers like OpenAI, Google (Gemini), DeepSeek, and Anthropic.
You can configure your keys in two ways:
-
Environment Variables: Set the appropriate variable in your
.envfile. This is the recommended approach for production.# Choose one or more providers OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx GOOGLE_API_KEY=AIzaSyxxxxxxxxxxxxxxxxxxxx DEEPSEEK_API_KEY=sk-xxxxxxxxxxxxxxxxxxxx
-
envModel: For user-specific keys, you can store them in theenvmodel within the application. The assistant will automatically look for a key belonging to the current user.
Once a key is configured, the AI assistant chat interface becomes available in the UI.
The assistant, "Prior," can perform a wide range of actions based on your natural language commands.
You can ask the assistant to find, filter, and display your data. It can present the results in various formats.
-
Simple Search:
"Show me the latest 5 orders from French customers."
-
Chart Generation: Create charts on the fly.
"Create a bar chart of user sign-ups per month for the last year."
-
Custom HTML Views: Generate sophisticated, styled views of your data using Handlebars templates.
"Build a dashboard of my active projects with their status and due dates, using a modern dark theme."
The assistant can create, update, or delete data, but it will always ask for your confirmation before executing a modifying action. This provides a critical safety layer.
-
Create Data:
"Create a new task to 'Follow up with Client X' due tomorrow."
-
Update Data:
"Update the status of all tickets in the 'Support' category to 'resolved'."
-
Delete Data:
"Delete all draft products created before last month."
When you issue such a command, the assistant will respond with a summary of the action it intends to perform and a "Confirm" button. The action is only executed after you click it.
The assistant can answer questions about the data it has access to.
"What was our total revenue in the last quarter?"
When you send a message, the assistant follows a strict reasoning process:
- Analyze Intent: It first analyzes your request to understand what you want to do.
-
Search Models (Internal Step): Its first action is always to call the
search_modelstool internally. This gives it the exact structure, field names, and types for the relevant data models. This step is crucial for preventing errors and "hallucinations." -
Formulate Action: Based on your intent and the model structures it found, it formulates a final action, such as
search,generateChart, or apostrequest. -
Execute or Confirm:
- If it's a read-only action (like
searchorgenerateChart), it executes it and displays the result. - If it's a write action (like
postordelete), it presents the action to you for confirmation.
- If it's a read-only action (like
Beyond the chat interface, you can leverage AI directly within your automation Workflows. The GenerateAIContent action allows you to call an AI model as a step in a workflow.
This is perfect for tasks like:
- Summarizing a new support ticket.
- Generating a product description when a new product is added.
- Classifying incoming data based on its content.
- Translating text.
Example workflowAction:
{
"name": "Summarize Ticket",
"type": "GenerateAIContent",
"aiProvider": "OpenAI",
"aiModel": "gpt-4-turbo",
"prompt": "Summarize the following support ticket in one sentence: {triggerData.description}"
}This integration of AI both as an interactive assistant and as an automation component makes data-primals-engine a powerful platform for building intelligent applications.