← Back to outline
Mastering Natural-Language Queries on Your Data · Lesson 2 of 7

2. From Question to Answer: The Six-Step Pipeline

Trace the full journey of a natural-language query — from your question through code generation, sandboxed execution, summary writing, number verification, chart suggestion and follow-up proposals.

When you type a question like "total revenue by region for Q2," OUPI doesn't hand your data to a language model and hope for the best. Instead, it follows a precise six-step pipeline:

  1. Code generation — The model reads your dataset's structure (columns, types, a sample of rows) and writes executable code that answers your question.
  2. Security check — That code is inspected before it runs: no network access, no file-system reach beyond your dataset, and the question itself is screened for manipulation attempts.
  3. Sandboxed execution — The validated code runs in an isolated environment on the full dataset — every row, not a sample.
  4. Plain-language summary — The model writes a human-readable answer from the computed result.
  5. Number verification — Every figure in the summary is compared against the actual computed data. Any mismatch is flagged with a warning.
  6. Chart suggestion & follow-ups — If the result shape suits a visualization, a chart is proposed. Related follow-up questions are also suggested to keep your analysis moving.

Arithmetic is always done by code, never approximated by a model. That's the core reliability guarantee.

Why code, not a model doing math?

A language model reading 10,000 rows will approximate — it might round, skip, or hallucinate totals. Code counts exactly. After the code runs, the summary is checked against the computed figures, so a wrong number cannot slip in unnoticed. What can vary is how your question was interpreted, which is why OUPI shows you the generated code and the result table alongside the summary. If the interpretation is off, you can adjust your wording and re-ask.

Security at every gate

Before any generated code touches your data, it passes through multiple guards. Suspicious patterns are blocked and logged. The question itself is screened for prompt-manipulation attempts. Execution then happens inside a sandbox — isolated from the network, the file system, and the rest of the platform. Your data never leaves the platform during this processing. This means you can query sensitive business data (sales figures, margins, HR metrics) without worrying about leakage.

Tip

Ask one thing at a time and name columns as they appear in your data. Be specific about periods and groupings: "top 10 customers by margin in 2025" beats "show me customer info." If a column name is ambiguous, the engine will state its assumption — correct it and re-ask.

What you keep after each query

Every query stores four artifacts: the generated code, the result table, the plain-language summary, and the suggested chart. Save a query to re-run it later on refreshed data — when your dataset is updated, the same logic runs on the new rows. Saved queries are shareable with your team, so a well-crafted question becomes a reusable analytical asset, not a one-off answer.

Know the limits

The engine answers questions the data can answer. It will not invent missing columns or fill gaps with assumptions. For very large datasets, the model samples the structure to understand it, but the computation still runs on all rows. If your analysis requires complex, multi-step modeling (forecasting, scenario building), consider launching a mission where @oupi can iterate over several steps rather than answering in a single query.

Try it now

Go to the Query page in OUPI Data. Pick a dataset you've already imported and type a specific question — for example, "average order value by month in 2024." Once you get the answer, expand the code and result table to trace the six steps yourself. Then save the query so you can re-run it when the data refreshes.

Take this course in OUPI → This exercise is done inside the OUPI platform.
Recap

Every natural-language query follows six steps: code generation → security check → sandboxed execution → summary → number verification → chart & follow-ups. Arithmetic is always done by code on the full dataset, and the summary is verified against computed figures. You can inspect the code, save queries for re-use on refreshed data, and share them with your team. For questions the data can't answer or complex modeling, escalate to a mission.