surfacepipelinefilter
Pipelinepipeline · returns table

FILTER

Filter query results using LLM-based semantic matching

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

pipelinellmpipeline-composabletext

Syntax

THEN FILTER {{ prompt }}
THEN FILTER({{ prompt }})

Arguments

nametypedescription
promptVARCHAR
_tableTABLE

About

PIPELINE cascade for LLM-based filtering of query results. Used with THEN FILTER syntax for semantic filtering: SELECT * FROM products THEN FILTER('only eco-friendly items') Uses LLM to evaluate each row against the filter criteria and returns only matching rows with the SAME SCHEMA as input.

Examples

Keeps only rows that clearly match the semantic filter

SELECT
  *
FROM
  (
    VALUES
      ('Reusable bamboo cup'),
      ('Single-use plastic straw'),
      ('Recyclable paper bag')
  ) AS t (description) THEN FILTER (
    'keep rows that explicitly describe eco-friendly, reusable, or recyclable items'
  ) THEN PYTHON ('result = pd.DataFrame({"row_count":[len(df)]})')

Nearby rabbit holes

same domain
Climb back to The Looking Glass