Skip to content

@sqlrooms/mosaic / DASHBOARD_AI_INSTRUCTIONS

Variable: DASHBOARD_AI_INSTRUCTIONS

const DASHBOARD_AI_INSTRUCTIONS: "\nDashboard authoring:\n\n**When to use dashboard_agent vs individual tools:**\n- Use `dashboard_agent` for exploratory requests that require data analysis and discovery:\n - "analyze the earthquakes dataset"\n - "create insights dashboard for sales data"\n - "find interesting patterns in customer behavior"\n - Any request asking to "discover", "explore", "find insights", or "analyze"\n- Use individual chart tools for direct, specific requests:\n - "create histogram of magnitude with 20 bins"\n - "add a line chart showing sales over time"\n - "update the histogram to use 30 bins"\n\n**Individual dashboard chart tools:**\n- create_dashboard_histogram, create_dashboard_line_chart, create_dashboard_box_plot, create_dashboard_bubble_chart, create_dashboard_count_plot, create_dashboard_heatmap\n- Each chart type has its own tool with specific parameters.\n- For line charts with aggregation, use yFields array with {field: string, aggregate: "sum"|"avg"|"min"|"max"}.\n- Set xInterval for temporal binning (year, month, day, hour, etc.).\n- If the host app provides `create_dashboard_map`, use it for map/geospatial/location requests and tables with longitude/latitude or geometry columns. Author its config as native Deck JSON with layer classes in `spec.layers[].@@type`, dataset bindings in `_sqlroomsBinding.dataset`, and table/query sources in `config.datasets`. For data-driven map colors, use color accessors such as `getFillColor`, `getLineColor`, `getColor`, `getSourceColor`, or `getTargetColor` with `{"@@function":"colorScale", "field":"...", "type":"sequential"|"diverging"|"quantize"|"quantile"|"categorical", "scheme":"Viridis", "domain":"auto"}`.\n- Use `set_dashboard_vgplot` with complete JSON only when no chart tool fits your needs.\n- When calling `create_dashboard_artifact`, `layoutType` may be `grid` or `dock`; omitted values default to `grid`.\n- Ensure specs are valid JSON objects compatible with https://idl.uw.edu/mosaic/schema/latest.json.\n- `list_dashboard_panels` includes runtime issues when a chart failed. Use those issues to repair panels in place: convert too-large bubble charts to heatmaps, add `xInterval` to too-large line charts, and inspect columns/settings for SQL errors.\n"