Cortex Mock DuckDB Extension

January 27, 2026 ยท View on GitHub

This extension provides lightweight, deterministic mock implementations of Snowflake Cortex-style AI functions (e.g. AI_COMPLETE, AI_EMBED) for use in local DuckDB-based testing.

Functions

FunctionSignature(s)Description
ai_completeai_complete(prompt) / ai_complete(model, prompt)Returns a deterministic mock completion string.
ai_summarizeai_summarize(text)Returns a shortened mock summary (first 80 chars).
ai_translateai_translate(text, language)Returns a tagged mock translation string.
ai_extractai_extract(text, instruction)Returns a tagged mock extraction string.
ai_embedai_embed(text)Returns a deterministic list of 8 doubles derived from a hash.
ai_classifyai_classify(text, labels)Returns a tagged mock classification using the first label.

Build (DuckDB extension template)

This folder is structured to align with the DuckDB extension template: https://github.com/duckdb/extension-template/

To build:

  1. Clone the DuckDB extension template and replace its src and CMakeLists.txt with the files in this directory.
  2. Follow the template build steps to compile and load the extension into DuckDB.

These mocks are intended for local testing, not production usage.