Skip to main content
POST
Validate a result

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

database
string
required

Target database.

Body

application/json

POST /v1/validate/{database}: a result, the statement it came from and the question it is meant to answer. An unknown field is refused.

field_name
string
required

The full-text-indexed column the question's terms are looked up in when the result is refused: the column the statement searched.

rows
object[]
required

The rows the statement returned, each a JSON object of column name to cell value. An empty array is the query that answered nothing, or, sent on purpose before any query, the request to check the question's terms against the index alone.

statement
string
required

The statement that produced rows, as it ran.

table_name
string
required

The table the result came from.

question
string | null

The question the rows are meant to answer. Its anchors (tokens holding a digit, quoted or backticked spans, capitalized words past the first, identifier-shaped tokens) are what a row-returning result must mention, and what is looked up in the index on a refusal. Omitted, or a question naming nothing of that shape, leaves a non-empty result standing on its own.

Response

The verdict as JSON: valid, the check that decided, the question's anchors, and on a refusal the reason in the sub-agent's own words, the anchors absent from the searched column (no query over it will find them) and, for a line-window statement that matched nothing, the overlap suggestion to run instead. This route answers four of the five check values: no_rows (the statement returned nothing), aggregate (an aggregate, valid when it returned a non-zero number), anchors (the rows were held to the question's terms) and unchecked (rows came back and the question named nothing to hold them to). The fifth, graded, is a verdict a grading model reached; this route judges by the words alone and never returns it. For an aggregate over a search grouped by a column, group_column, groups and note add the facts about each group. Sent with empty rows, the check is the diagnosis alone, which of the question's terms the data holds, before any query is spent. valid means the result answers the question's terms, not that it is correct.

The verdict. valid is the bar the sub-agent holds its own queries to; reason is what the sub-agent would have handed its model to query again after, so a caller can show or act on the same words. valid means the result answers the question's terms, not that it is correct.

anchors
string[]
required

The anchors read off the question, in order, each once; empty when no question was sent or it named nothing of that shape. Returned so a caller can see what the bar actually was.

check
enum<string>
required

Which check decided.

Available options:
no_rows,
aggregate,
anchors,
unchecked,
graded
rows
integer
required

How many rows the request held.

Required range: x >= 0
valid
boolean
required

Whether this result would be accepted as the answer to this question.

absent
string[]

The anchors that occur nowhere in field_name: no query over it will find them. Filled only on a refusal about the anchors (no rows, or rows naming none); a result that stands is not diagnosed.

group_column
string | null

For an aggregate over a search grouped by a column: the column the statement groups by. With groups, it says what each total measures, so a total over the top k is not read as a size. Absent for any other statement, and when no facts were read about the groups.

groups
object[]

The facts about each group the rows name, under group_column: its whole length and its lines holding each search term. Absent when there are none.

note
string | null

What an aggregate's totals measure, in the sub-agent's wording. Absent for any other statement.

reason
string | null

Absent when valid; otherwise what is wrong, in the sub-agent's wording, including which anchors the data does not hold.

suggestion
string | null

A statement to run instead of one that returned nothing because it asked for rows INSIDE a line window (the overlap predicate it meant).