surfaceq & aask
Q & Ascalar · returns varchar

ASK

Apply any arbitrary prompt to text (ultimate flexibility)

Per-row — runs once for each row.

qallmtext

Syntax

{{ text }} ASK '{{ prompt }}'
ASK '{{ prompt }}' FROM {{ text }}

Arguments

nametypedescription
textVARCHAR
promptVARCHARAny instruction or question (e.g., 'is this urgent?', 'translate to Spanish')

About

Generic prompt application - apply any arbitrary instruction/question to text. This is the ultimate flexible operator. Instead of specialized operators like MEANS, EXTRACTS, ALIGNS, you can use ASK for anything: - Sentiment analysis: "what's the sentiment?" - Translation: "translate to French" - Classification: "is this spam?" - Transformation: "rewrite this professionally" - Extraction: "find the phone number" - Analysis: "rate quality 1-10" - Comparison: "does this match X?" - Generation: "write a subject line" Perfect for: - Ad-hoc queries where you don't have a specialized operator - Prototyping before creating a dedicated cascade - One-off analysis tasks - Exploratory data analysis

Examples

Function: Question answered from text

SELECT
  semantic_ask (
    'The sky is blue because of Rayleigh scattering',
    'What color is the sky?'
  )

Function: Price extracted via question

SELECT
  semantic_ask (
    'The product costs $99.99 and ships within 3 days',
    'How much does it cost?'
  )

Infix ASK: extracts answer from text

WITH
  t AS (
    SELECT
      'Einstein developed the theory of relativity' AS fact
  )
SELECT
  fact ASK 'Who developed this?'
FROM
  t

Function with concat: compound first arg

SELECT
  semantic_ask (
    'Albert' || ' ' || 'Einstein discovered relativity',
    'Who discovered relativity?'
  )

Function with concat: column concatenation

WITH
  t AS (
    SELECT
      'Paris' AS city,
      'France' AS country
  )
SELECT
  semantic_ask (
    city || ' is the capital of ' || country,
    'What is the capital?'
  )
FROM
  t

Function with UPPER: nested function call

SELECT
  semantic_ask (UPPER('the sky is blue'), 'What color?')

Nearby rabbit holes

same domain
Climb back to The Looking Glass