Skip to main content

Documentation 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.

Flock extends DuckDB with a suite of declarative SQL functions for LLM-powered analytics. Run text generation, classification, embedding, filtering, and hybrid search — all from standard SQL — against OpenAI, Azure, Ollama, or Anthropic/Claude. Flock also supports images and audio as first-class data types in your queries.

Quickstart

Install Flock and run your first LLM query in under 5 minutes

SQL Functions

Explore llm_complete, llm_filter, llm_embedding, and more

Hybrid Search & RAG

Build end-to-end RAG pipelines with fusion scoring functions

Multimodal Support

Analyze images and transcribe audio directly in SQL queries

What you can do with Flock

Flock makes it possible to call LLMs as part of any SQL query — using the same SELECT, WHERE, and GROUP BY patterns you already know.
-- Generate product descriptions for every row in a table
SELECT llm_complete(
    {'model_name': 'gpt-4o'},
    {'prompt': 'Write a one-sentence product description for {name}.', 
     'context_columns': [{'data': product_name, 'name': 'name'}]}
) AS description
FROM products;
-- Filter rows based on LLM evaluation
SELECT *
FROM customer_reviews
WHERE llm_filter(
    {'model_name': 'gpt-4o'},
    {'prompt': 'Is this review mentioning a shipping issue?',
     'context_columns': [{'data': review_text}]}
);

Key features

Four LLM providers

OpenAI, Azure OpenAI, Ollama, and Anthropic/Claude — all through the same SQL API

Aggregate functions

Reduce, rerank, and rank groups of rows using LLMs as GROUP BY aggregates

Structured output

Enforce JSON schemas on LLM responses for reliable downstream processing

LLM observability

Track token usage, API latency, and call counts with flock_get_metrics()

Hybrid search

Combine BM25 and vector scores using RRF, CombSUM, CombMNZ, and more

Browser & WASM

Run Flock-powered workloads in the browser via DuckDB-WASM

Getting started

1

Install DuckDB

Download DuckDB v1.5.0 or later from duckdb.org/docs/installation.
2

Install and load Flock

INSTALL flock FROM community;
LOAD flock;
3

Configure your provider

Set up API credentials for your chosen provider — OpenAI, Azure, Ollama, or Anthropic.
4

Run your first query

SELECT llm_complete(
    {'model_name': 'gpt-4o'},
    {'prompt': 'Summarize this in one sentence.',
     'context_columns': [{'data': text_column}]}
) AS summary
FROM my_table;

About the project

Flock is developed by the Data & AI Systems Laboratory (DAIS Lab) at Polytechnique Montréal. It is the subject of the VLDB 2025 demo paper Beyond Quacking: Deep Integration of Language Models and RAG into DuckDB. The project is MIT-licensed and available as a DuckDB community extension.

Build docs developers (and LLMs) love