This project demonstrates how to create an "Executive Summary" generated by Luzmo IQ, accompanied by an embedded dashboard. The project is mainly created for use during a workshop at Luzmo's Data Talks event in Paris.
- AI-Powered Business Analytics: Automatically generates an AI summary from your sales data using Luzmo IQ, with live status updates
- Interactive Dashboard: Embeds a Luzmo dashboard for deeper data exploration
data-talks_ai-workshop/
├── iq_summary_with_embedded_dashboard.html # Main demo application
├── neon_db_workshop_sales_schema_and_data.sql # Database setup with sample sales data
└── workshop_sql-dataset-definition.sql # SQL query for denormalized Luzmo dataset
You can skip this if you'd like to connect your own data source to Luzmo!
-
Create Neon Account
- Go to https://console.neon.tech/signup
- Sign up for a free account
-
Set Up Database Schema & Data
- In your Neon console, go to the SQL Editor
- Copy and paste the entire content of
neon_db_workshop_sales_schema_and_data.sql
- Execute the script to create tables, insert sample data, and set up a read-only user
-
Get Connection Details
- In Neon console, go to Dashboard → Connection Details
- Note down your connection string (make sure to swith to the "Role"
luzmo_readonly_user
)
-
Start Free Trial
Sign up for a free trial account (or log in to your existing Luzmo account)
-
Connect Your Data Source
- In Luzmo, click "Connect" to add a new data source
- Select the PostgreSQL connector
- Use the connection details from Neon:
- Host: Your Neon host (e.g.,
ep-cool-name-123456-pooler.us-east-1.aws.neon.tech
) - Port:
5432
- Database:
neondb
(or your database name) - Username:
luzmo_readonly_user
- Password:
SuperSecretPassword123
- Host: Your Neon host (e.g.,
- Create the connection
-
Create Dataset
- In Luzmo, create a new SQL Dataset
- Use the query from
workshop_sql-dataset-definition.sql
:
SELECT po.*, -- Case statement to map sales codes into meaningful descriptions CASE WHEN po.sales_code = 'S001' THEN 'No discount' WHEN po.sales_code = 'S020' THEN 'Vendor discount' WHEN po.sales_code = 'S500' THEN 'End-of-day discount' ELSE 'Other / Unknown' END AS sales_code_description, c.customer_first_name, c.customer_last_name, c.customer_email, c.customer_date_of_birth, p.product_name, p.product_category, p.product_release_date, s.store_name, s.store_country FROM product_orders po JOIN customers c ON po.customer_id = c.customer_id JOIN products p ON po.product_id = p.product_id JOIN stores s ON po.store_id = s.store_id
-
Create a Dashboard
- Create a new dashboard in Luzmo and add some charts using your dataset (e.g., revenue by store, top products)
- Note down your Dashboard ID (found in the dashboard URL, or dashboard settings at the bottom)
-
Generate token via Embed button
- In your Luzmo dashboard, click the "Embed" button
- Copy the Embed Key and Embed Token
- Important: These are temporary tokens for demo purposes and are only valid for 30 minutes!
-
Recommended: Generate via API
In production setups, Embed Authorization tokens are requested server-side in your application; for the sake of this demo application, we can use tools like Postman or Insomia (or just plain curl requests) to manually generate an Embed key-token pair. This might be necessary if you'd like to e.g. specify extracontext
for Luzmo IQ (somewhat like a "Master prompt").- Create a Luzmo API key-token pair in your account settings: https://app.luzmo.com/settings/api-tokens
- Use your API key-token pair to generate a temporary Embed key-token pair via an HTTP request to the
/authorization
API endpoint (see this guide). Make sure to give access to both your dashboard and dataset (e.g. via a Collection).
curl https://api.luzmo.com/0.1.0/authorization -H "Content-Type: application/json" -d @- << EOF { "action": "create", "version": "0.1.0", "key": "<your Luzmo API key>", "token": "<your Luzmo API token>", "properties": { "type": "embed", "username": "luzmo-iq-embed@example.com", "name": "Embed Luzmo IQ Test User", "suborganization": "Company A", "email": "luzmo-iq-embed@example.com", "access": { "collections": [ { "id": "<collection_id>", "inheritRights": "use" } ] } } } EOF
Open iq_summary_with_embedded_dashboard.html
and update the following values in the CONFIG
object (around line 84):
const CONFIG = {
// Replace with your actual embed credentials
authKey: "YOUR_EMBED_KEY_HERE",
authToken: "YOUR_EMBED_TOKEN_HERE",
dashboardId: "YOUR_DASHBOARD_ID_HERE"
};
You can also customize the "Executive Summary" prompt by modifying BUSINESS_SUMMARY_PROMPT
in the HTML file (right below the CONFIG
object):
const BUSINESS_SUMMARY_PROMPT = `Your custom prompt here...`;
Simply open iq_summary_with_embedded_dashboard.html
in your web browser. The application will automatically start generating AI insights while allowing you to already slice-and-dice in the embedded dashboard!
The project uses Luzmo's Message streaming API (/ai/v1/message
) to get real-time AI responses:
- Streaming States:
Analyzing
→Querying
→Summarizing
→Completed
- Response Modes:
text_only
(used in this demo),chart_only
, ormixed
-
"Failed to load dashboard"
- Check that your embed key-token pair is correctly set
- Ensure your dashboard ID is valid
- If you're not on the EU multitenant VPC, make sure to adapt the API Host URL and App Server URL in the
CONFIG
object
-
"No data found"
- Confirm your Neon database has data
- Check that your Luzmo dataset is properly configured
- Verify the SQL query in your dataset
-
"Connection failed"
- Verify your connection string is correct
- Check that the read-only database user has the proper permissions to query the schema, tables, etc.
- Luzmo Documentation: https://developer.luzmo.com
- Luzmo Academy: https://academy.luzmo.com
- Neon Documentation: https://neon.tech/docs