Flock’s scalar functions apply an LLM operation to each row independently, making them a natural fit forDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/dais-polymtl/flock/llms.txt
Use this file to discover all available pages before exploring further.
SELECT projections and WHERE clauses. Each function takes a model configuration struct and a prompt configuration struct as arguments, then returns a result for every row processed.
All three functions share the same context_columns API for passing column data into the model. A context column entry looks like:
llm_complete
llm_complete calls an LLM for each row and returns the model’s text response as JSON. Use it to generate, transform, or enrich text — product descriptions, summaries, translations, and more.
Return type: JSON
Parameters
Model configuration (first argument)The registered model name to use for generation.
The DuckDB secret holding the API key for this model. Omit when using a model that does not require authentication (e.g., a local Ollama model).
An inline prompt string. Use
{alias} placeholders to reference named context columns. Mutually exclusive with prompt_name.The name of a pre-configured prompt stored in Flock’s prompt registry. Mutually exclusive with
prompt.The version of the named prompt to use. Only valid when
prompt_name is set. Defaults to the latest version.List of column references passed to the model as context. Each item must include
data and may include name and type.data(required) — the SQL column expressionname(optional) — alias used to reference this column in prompt placeholderstype(optional) —"tabular"(default) or"image"
Examples
llm_filter
llm_filter evaluates a yes/no question for each row and returns TRUE or FALSE. Place it in a WHERE clause to keep only the rows the model considers a match for your condition.
Return type: BOOLEAN
Parameters
Model configuration (first argument)The registered model name to use for evaluation.
The DuckDB secret holding the API key for this model.
An inline yes/no question. Use
{alias} placeholders to reference named context columns. Mutually exclusive with prompt_name.The name of a pre-configured filter prompt in Flock’s prompt registry. Mutually exclusive with
prompt.The version of the named prompt to use. Only valid when
prompt_name is set.List of column references passed to the model as context. Each item must include
data and may include name and type.data(required) — the SQL column expressionname(optional) — alias used to reference this column in prompt placeholderstype(optional) —"tabular"(default) or"image"
Examples
llm_embedding
llm_embedding encodes one or more text columns into a dense vector that captures semantic meaning. The resulting embeddings can be compared with DuckDB’s built-in array_cosine_similarity function for similarity search, clustering, and RAG retrieval.
Return type: DOUBLE[] (a list of double-precision floats)
llm_embedding supports text columns only. Passing type: 'image' in context_columns is not supported and will raise an error.Parameters
Model configuration (first argument)The registered embedding model name (e.g.,
text-embedding-3-small).The DuckDB secret holding the API key for this model.
List of text column references to embed. Multiple columns are concatenated before being sent to the model. Each item must include
data and may include name.data(required) — the SQL column expressionname(optional) — alias for this column