surfacepipelineenrich
Pipelinepipeline · returns table

ENRICH

Add LLM-computed columns to query results

Table-in, table-out — composes downstream of SELECTs.

pipelinellmpipeline-composabletext

Syntax

THEN ENRICH {{ prompt }}
THEN ENRICH({{ prompt }})

Arguments

nametypedescription
promptVARCHAR
_tableTABLE

About

PIPELINE cascade for enriching query results with LLM-computed columns. Used with THEN ENRICH syntax for adding semantic columns: SELECT * FROM products THEN ENRICH('add sentiment score and category') Uses LLM to compute additional columns for each row based on the existing data and the enrichment specification.

Examples

Preserves original rows while adding the requested enrichment column

SELECT
  *
FROM
  (
    VALUES
      ('Great product'),
      ('Terrible experience')
  ) AS t (review) THEN ENRICH (
    'add a sentiment_label column with values positive or negative'
  ) THEN PYTHON (
    'result = pd.DataFrame({"ok":["sentiment_label" in df.columns and len(df) == 2]})'
  )

Nearby rabbit holes

same domain
Climb back to The Looking Glass