Questions about large tables
Ask a model "how many orders were late last month?" over 2,000 rows and it will often be wrong, whatever the format. With ask() it doesn't read the rows. It writes a one-line query, and your code computes the exact answer.
Measured
| Approach | Counting questions right | Prompt size |
|---|---|---|
| Model reads the rows (JDogo) | 74 of 150 | the whole table |
| Model reads the rows (TOON) | 72 of 150 | the whole table |
| Model writes a query from the schema card | 150 of 150 | a few hundred tokens |
50 counting and totals questions on three models (E1). In the routing runs the schema-card prompt averaged 430 tokens against 3,611 with the rows.
When the model does read rows, the table itself is smaller in JDogo: the 2,000-row benchmark table is 98,810 tokens in JSON and 50,078 in JDogo.
How
from jdogo import ask
r = ask("How many orders shipped late?", orders, llm=call_model)
r.answer, r.route, r.expressionimport { ask } from "jdogo";
const r = await ask("How many orders shipped late?", orders, callModel);import jdogo
jdogo.register_pandas_accessor()
df.jdogo.ask("How many orders shipped late?", llm=call_model)Questions that need the rows (find, list, explain) fall back to sending them in the prompt layout. Read AI prompts and ask() for the rules, and Compute expressions for what a query can say.