ndi CLI; each tool also lists its SDK method and
endpoint.
Before you ask
Every tool on this page reads an ingested workspace. Upload the files, ingest them, and wait for ingestion to finish before asking.ndi workspace create --json prints the workspace as JSON; the id is its
workspace_id field. ndi workspace stats shows what has been ingested. A file that is not
ingested yet answers file_not_ingested.
Look before you ask
Two fast calls show what a workspace holds before you spend a question on it:POST /v1/workspaces/{workspace_id}/tools/folder-metadatalists a folder and finds files by name (name_contains), with each file’s exact path.POST /v1/workspaces/{workspace_id}/tools/file-metadatadescribes one file by path: its category, a summary, and its sections or tabs with their own summaries and key terms.
Pick in order
Read the question, then take the first rule that matches.- The question is an audit test over journal entries or a general ledger (approvals, posting dates, users, round amounts, cut-off): use journal-entry testing.
- The question is about one file you can name: use file QA.
- The question needs a calculation or comparison across one or more spreadsheets or table files: use table QA.
- The question is one turn of a conversation: a follow-up to an earlier answer, or one the asker may need to clarify: use QA.
- Anything else: use automatic search. When you
already know the route, say so:
--mode factfor a fact written in the documents (a number, a name, a date, a clause) that needs no reasoning;--mode agentfor reasoning (comparing documents, explaining why, reconciling, several steps) or for filtering, ranking, or counting documents by their values, which the agent answers from the metadata catalog as a table. Unsure: omit--modeand the service picks.
Example prompts
Filters on journal or ledger lines go to journal-entry testing, not
automatic search. Automatic search lists documents and register entries; it
does not test ledger rows.
File QA
ndi ask-file PATH QUERY · SDK client.tools.qa_file · POST /v1/workspaces/{workspace_id}/tools/qa-file
Answers a question about one file: a document, a workbook, an image, or a
recording. It reads that file and reasons over it, and cites the passages it
used.
- Returns: an
answerandcitationsfrom the file. Passoutput_schema(SDK and API) to get the answer as JSON instructured_answer. - Use when: the question names one file, or you already know which file holds the answer.
- Do not use when: the answer could be in any of several files (automatic search); the question spans several workbooks (table QA).
PATH is the file’s full path in the workspace, exactly as uploaded (see
file paths). --component limits the question
to one sheet or section, named as
file metadata lists it.
Table QA
SDKclient.tools.query_tables · POST /v1/workspaces/{workspace_id}/tools/query-tables
Answers one question over one or more spreadsheets or table files: totals,
movements, comparisons, and joins across workbooks. It cites the tables it
used.
- Returns: an
answer, citations, any sources it could not use, and a preview of the rows behind the answer. Passoutput_schemato get JSON instructured_answer. - Use when: the answer has to be computed from tables, especially across several files.
- Do not use when: the files are PDFs or other documents (file QA or deep search); the question is an audit test over a ledger (journal-entry testing).
- Python
- curl
Journal-entry testing
ndi je-testing · SDK client.search.je_testing · POST /v1/workspaces/{workspace_id}/je-testing
Performs an audit test over an ingested journal or general-ledger package. It
does not search for passages: it tests the whole population against your
criterion and reports how many entries meet it, with the queries behind
every figure so the result can be checked.
- Returns: a job whose result has an
answer,figures(each criterion with its count and population),criteria,discrepancies, andsql_receipts.exhaustedmeans the run stopped before it finished; the answer is partial. - Use when: the question is a journal-entry test: who posted or approved, when, at what amount, with what description, compared with what threshold or period.
- Do not use when: the question is about documents rather than ledger lines (automatic search); it is a calculation over a trial balance or another non-ledger workbook (table QA).
--path scopes the test to one file and can repeat. Save facts every test
should know, such as how the journal ID is built, once with
ndi workspace global-context --set "...". See
Journal-entry testing.
Automatic search
ndi automatic-search · SDK client.search.automatic · POST /v1/workspaces/{workspace_id}/automatic-search
Answers one question over the workspace by one of two routes: the fact route,
a quick lookup that quotes what is written, or the agent, which reads
documents, queries tables, and filters the metadata catalog, and explains how
it reached the answer. Without --mode the service picks the route and says
which it took.
- Returns: a job whose result has
routing(the route taken),output(that route’s answer), andoutput_job_id. When the agent answers from the catalog,output.catalogis a table of matching documents with an exacttotal_matches; it carries up to 200 rows, andnext_cursorpages the rest withndi filtered-search --cursor. Passoutput_schema(SDK and API) to get the answer as JSON in the route’sstructured_answer. - Use when: the question is about the workspace and no earlier rule in Pick in order matches.
- Know the route already?
--mode factfor a stated fact,--mode agentfor reasoning or a filtered list or count. Either runs with no routing step and keeps the automatic result shape.
QA
SDKclient.search.qa · POST /v1/workspaces/{workspace_id}/qa
One turn of a conversation, answered by automatic search’s agent. Pass the
previous result’s answer.session_id as session_id to ask a follow-up; the
agent may ask a clarifying question instead of guessing.
- Returns: a job whose result is an
automatic_agent:answer(with citations, SQL receipts,session_id, and anyclarification_questions) and, when the agent answered from the catalog, acatalogtable. Passoutput_schemaon a turn to get that turn’s answer as JSON. - Use when: the question follows up an earlier answer, or the asker can answer a question back.
- Do not use when: the question stands alone (automatic search can take the faster fact route). The CLI has no QA command; use the SDK or the API.
Knowledge graph
Build: SDKclient.ingestion.build_knowledge_graph · POST /v1/workspaces/{workspace_id}/knowledge-graph/builds
The knowledge graph links the companies, people, contracts, accounts, and
other entities your documents mention, across all files. It is not a separate
question tool. Build it once, and automatic search (both routes) and QA use
it on their own. Questions about how entities relate, or
every document that mentions one, get better answers once it is built.
A workspace has no graph until you build one. Build after ingestion, and
again after you add many files, or set knowledge_graph.auto_build on the
workspace to rebuild after every ingestion.
- Python
- curl
Deprecated tools
These keep working until they are retired. Each names what replaces it.Fact search (deprecated)
SDKclient.search.fact · POST /v1/workspaces/{workspace_id}/fact-search
Finds facts stated in the workspace and answers with them. It retrieves and
quotes; it does not compare, calculate, or explain. It answers in seconds and
always returns an answer.
- Returns: a job whose result has an
answer, theevidencesit is drawn from (each with its source file), andgrounding_job_idsfor exact locations in the source. - Use when: the answer is written down somewhere: a figure, a name, a date, a clause, a definition.
- Do not use when: the question asks why or how, or compares sources (deep search); filters a list by value (filtered search); needs arithmetic over tables (table QA).
--prefix limits the search to files under a folder, and --path (repeatable)
to exact files; the two add up, so the search covers the folder’s files plus the
named ones. --top-k caps the number of citations when the fact route answers.
Deep search (deprecated)
SDKclient.search.deep · POST /v1/workspaces/{workspace_id}/deep-search
Answers questions that need reasoning. It reads across documents and tables,
compares and calculates, and explains how it reached the answer. It takes
longer than fact search, up to minutes.
- Returns: a job whose result has an
answer, theevidencesand claims behind it, receipts for any calculation it ran, andgrounding_job_ids. - Use when: the question compares sources, asks why, reconciles figures, or needs several steps to answer.
- Do not use when: a single stated fact answers it (fact search is faster); it is a filter or count over documents (filtered search); it is an audit test over a ledger (journal-entry testing).
Filtered search (deprecated)
ndi filtered-search · SDK client.search.filtered (Python) · POST /v1/workspaces/{workspace_id}/filtered-search
Answers questions that filter, rank, or count documents and register entries
by their values: amounts, dates, parties, statuses, document types. The answer
is a table with one row per matching document or entry, and a total.
- Returns: a job whose result has
rows,columns,total_matches,total_files,exhaustive, andnext_cursorfor the next page. - Use when: the question has conditions such as “over 1,000 USD”, “dated in March”, “from vendor X”, “not yet paid”, or asks for “all”, “how many”, or “top N”.
- Do not use when: you want one fact or an explanation (automatic search); the rows are journal or ledger lines (journal-entry testing); you need arithmetic across workbooks (table QA).
exhaustive is false, total_matches is a
floor, not a census. Page with --cursor, pasting the previous result’s
next_cursor.
Common mistakes
--mode factfor a “why” question. The fact route quotes what is written; it does not explain or compare. Use--mode agent, or omit--mode.- Starting a new search for a follow-up. Automatic search keeps no
conversation; “and for FY2024?” means nothing on its own. Use QA with the
previous turn’s
session_id. - File QA across many files. File QA reads exactly one file. If you do not know which file holds the answer, use automatic search.
- Automatic search over ledger lines. Its catalog lists documents and register entries. Tests over journal lines are journal-entry testing.
- Journal-entry testing on non-ledger data. A trial balance or a fixed asset register is table QA.
- Table QA on PDFs. Table QA reads spreadsheets and table files. Ask a PDF with file QA, or search across PDFs with automatic search.
- Asking before ingestion finishes. Every tool answers only from files that are already ingested.
- Expecting graph answers without a build. The knowledge graph does nothing until it has been built for the workspace.