Skip to content

AI MasterMind

AI MasterMind lets you query your data using natural language. Ask questions about your metrics, logs, and datasets — get streaming SQL, charts, and tables in return. The system is designed to find the right dataset semantically, give you full visibility into what it picked, and let you steer the conversation by pinning context.

A typical Icelake tenant has thousands of datasets. Pattern-matching on metric names is brittle and burns LLM rounds. MasterMind grounds the LLM with a curated, semantically-ranked view of your data:

  1. Catalog summary — every chat session opens with a system prompt that lists top sources (with display name and description), top metrics, label keys with their JSON paths, and a DESCRIBED DATASETS section ranked by semantic relevance to your question.
  2. Vector retrieval — dataset descriptions are embedded with Mistral mistral-embed (1024-dim, multilingual: works the same in English and German). Embeddings are stored in Postgres pgvector with an HNSW cosine index. When you send a question, MasterMind embeds it on the fly and runs a cosine-similarity ranking against your described datasets.
  3. Keyword fallback — undescribed datasets stay discoverable. A parallel ILIKE pass on dataset and metric names (English and German stopwords filtered) backs up the semantic search, so a brand-new tenant’s catalog isn’t invisible until somebody writes descriptions.

The richer the descriptions on your sources and datasets, the better the grounding. Adding even a one-sentence description to your busiest sources noticeably improves answer quality.

Two-phase confirm: see what MasterMind picked before it runs

Section titled “Two-phase confirm: see what MasterMind picked before it runs”

When you click Send, MasterMind doesn’t fire the LLM immediately. First it shows a dashed banner above the input listing the dataset candidates it found for your question — semantic hits ranked first, keyword hits filling in. You can:

  • Send with N pinned — proceed with the proposed set
  • Skip — let MasterMind discover datasets on its own without the proposed set
  • Cancel — back out and rephrase
  • + Pin dataset — add another dataset before sending, via a search popover

The set you confirm becomes the authoritative pinned context for that turn. Unchecking a candidate in the banner unpins it. Power users who trust retrieval can toggle Auto-confirm in localStorage to skip the banner entirely.

Pinned datasets are session-scoped soft constraints. The LLM is told to prefer them and to briefly explain when it reaches for something outside the set — it isn’t a hard filter, so MasterMind can still pick the right tool when your question crosses domains. Pins clear on a fresh chat or when you load a saved session.

Dataset chips: see what each answer touched

Section titled “Dataset chips: see what each answer touched”

Below every assistant message, MasterMind renders a chip per dataset its SQL referenced. Hover any chip to see:

  • The dataset’s metric or log stream name
  • The source it belongs to and the source’s description
  • The dataset’s own description (if one exists)

A session-scoped strip above the chat collects the union of all datasets touched in the conversation. The view is the same whether you’re streaming live or reloading a session you wrote weeks ago — assistant messages are persisted with their full segment order (text → chart → table → text), so historical chats render exactly as they did in real-time.

Descriptions are the backbone of semantic grounding:

  • Sources — every source (Prom remote-write, OTLP, Loki push, MQTT, CSV upload) carries a human-facing description and an optional AI-only llm_hint (which falls back to description if blank). Edit them on the Data In → Sources detail panel.
  • Datasets — real datasets (metric, log, csv roots) are editable on the dataset detail panel. Virtual label-combination datasets inherit their parent’s description automatically.

Both descriptions feed the LLM via the catalog summary. Descriptions on real datasets are also embedded for vector search.

MasterMind uses a two-phase tool design for token efficiency:

  1. Explore — the LLM executes SQL via execute_sql and sees only a 5-row summary
  2. Present — the LLM calls display_data; full results stream to the frontend while the LLM receives only {"status":"displayed","row_count":N}

This keeps LLM token usage minimal while delivering complete datasets to the user. Combined with the catalog-summary grounding, typical conversations now resolve in 4–6 tool rounds instead of 15+.

ProviderModelsConfiguration
AnthropicClaude Haiku 4.5 (default), Sonnet, OpusAPI key in admin dashboard
MistralMistral Large, Medium, SmallAPI key in admin dashboard

Configure providers in Setup → Admin → AI in the admin dashboard. A separate Mistral key is required for embedding generation (semantic search and the dataset description backfill). See Get a Mistral API Key and Get an Anthropic API Key.

MasterMind uses Server-Sent Events (SSE) for real-time streaming:

  • Text — streamed token-by-token as the LLM generates its answer
  • Tool calls — visual indicators while the LLM queries DuckDB
  • Charts — auto-rendered area, bar, line, and pie charts from query results
  • Tables — full data tables with sorting, search, and CSV export
  • Wide-format multi-metric charts — when the LLM asks for two metrics on one chart (e.g. temperature and humidity over time), it produces wide-format SQL with FILTER clauses so each metric becomes its own column

Any chart or table from a MasterMind conversation can be saved as a reusable visualization:

  1. Click the save icon on any data panel
  2. Edit the title, chart type, and column configuration in the side sheet
  3. The visualization appears on the Visualizations page with live data and can be added to dashboards

The underlying SQL is also saved so you can iterate on it directly — useful when MasterMind’s first cut is close but not quite right.

  • “Show me the top 10 metrics by sample count in the last 24 hours”
  • “What’s the average temperature from my IoT sensors grouped by device?”
  • “Find log entries with errors from the last hour and show a timeline”
  • “How is my home PV battery charging today?” — works once the source carries a description like “Home Assistant telemetry — room sensors, PV battery, appliance power”

MasterMind also sees the geo table — public weather warnings (DWD), air-quality readings (OpenAQ), and Overture places, divisions, buildings and roads — alongside your own metrics and logs. That makes a whole class of cross-signal questions answerable in one chat turn:

  • “Are any active DWD weather warnings covering my Home Assistant locations?”
  • “Plot today’s PV power against rain warnings overlapping my address.”
  • “Did NO₂ at the nearest OpenAQ station spike when my workshop CO₂ logger reported a window-open event?”
  • “How many schools are there in Sankt Jürgen, Lübeck?” — and follow up with “now show hospitals” without re-asking about the neighbourhood.
  • “List every Overture transit stop within 500 m of my warehouse coordinates.”
  • “Show the top 5 districts in Berlin by error-log volume from api-gateway in the last hour.”

Naming a city or neighbourhood in chat triggers a dedicated resolve_place tool that resolves the name against Overture divisions (exact name within parent geometry → exact name + country → fuzzy fallback) and returns up to five ranked candidates with a confidence score. MasterMind picks the top hit when confidence is high, or asks you to disambiguate when several match equally well.

The resolved geometry is cached server-side and referenced via a tiny @place/<id> placeholder in the follow-up SQL — multi-KB polygons never round-trip through the LLM, so spatial filters always match the exact boundary the user named. Follow-up questions about the same neighbourhood reuse the cached geometry transparently.

When the LLM emits a query whose result has a geometry column (rendered via ST_AsGeoJSON), MasterMind automatically renders the result as an interactive map alongside the table — same widget used by the SQL Workbench. The map is part of the saved conversation, so reloading the session weeks later replays the exact view.