infer runs typed inference with a prompt over a text or image column and returns a column of AI envelopes, one for each row. An AI envelope is a STRUCT value with the typed AI response, field-level confidence scores, and associated metadata.
Chowder picks the model from your input and output schema. See Models.
Signature
Input
Pass text, such as thecontent column from read_documents or a text column from read_parquet.
For images, pass the image column from read_images, read_videos, or read_mcap. It holds the encoded image bytes, which infer decodes for the vision model.
Prompt
The prompt can be a question or an instruction. ForBOOL output, write a statement or question that the input can confirm as true or false, such as 'The customer intends to cancel.' or 'Does the customer intend to cancel?'. If text input doesn’t provide enough evidence, output is NULL, meaning unknown.
Output schema
output_schema defines the SQL type of the AI response, and output conforms to that type.
ENUM with an empty label, such as ENUM('', 'other'), fails before any model runs. See SQL data types for canonical names, aliases, and the supported inference subset.
AI envelope
Each row’s AI envelope has these fields:
Rows that fail or have null input stay in the result with a null
output. For failed rows, error explains why.
Use the AI response
SELECT aliases can be referenced by the WHERE clause.
Boolean classification
By default, text input withBOOL uses Bitsy, a classifier built for Boolean decisions grounded in documents. It checks your statement or question against the text and returns probabilities for true, false, and unknown in one forward pass, without generating text. unknown means the text doesn’t provide enough evidence to decide, so missing evidence isn’t forced into true or false. Bitsy is trained to decide from the text you pass, not from facts it remembers.
Bitsy selects the most probable label: true, false, or unknown. The probabilities field is a struct with one probability for each label. These probabilities sum to 1, subject to floating-point rounding.
The confidence field is the model’s probability for the selected label. For example, if probabilities is {"true": 0.15, "false": 0.80, "unknown": 0.05}, output is false and confidence is 0.80.
When unknown is selected, output is SQL NULL and confidence equals probabilities.unknown. This is a classifier prediction and does not itself indicate an inference error. Inspect error to distinguish it from a failure.
Only Bitsy returns probabilities. Other outputs, including image input with BOOL, use field-level confidence.
Behavior
inferruns only on the rows the query needs. For example, it runs on rows that satisfy theWHEREconditions.- Results are cached, so
inferdoesn’t recompute results for the same input, prompt, and output schema. See Caching.