DigitalOcean AI-Native Cloud services as SQL functions
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL docn FROM community;
LOAD docn;
Example
-- Set your key in the shell before starting DuckDB:
-- export DO_MODEL_ACCESS_KEY='...'
-- or inside DuckDB: SET do_model_access_key = '...';
LOAD docn;
-- List the available models (no key needed)
SELECT name, type FROM do_models() LIMIT 5;
-- A few rows to work with
CREATE TABLE reviews AS
FROM (VALUES
('The app crashes every time I upload a photo.'),
('Fast delivery and great support, thank you!'),
('I was charged twice this month.')
) t(review);
-- Yes/no question per row: 0.97 means very likely yes
SELECT review, (do_decide(review, 'Is the customer happy?') ->> 'noul')::DOUBLE AS happy
FROM reviews;
-- Pick one label per row: bug, praise, billing
SELECT review, do_decide(review, 'What is this about?', 'choice', ['bug', 'billing', 'praise']) ->> 'choice' AS topic
FROM reviews;
-- Free text answer per row
SELECT review, do_prompt('Reply to this review in one sentence: ' || review) AS reply
FROM reviews;
-- Similarity search with embeddings
SELECT review
FROM reviews
ORDER BY list_cosine_similarity(do_embed(review), do_embed('billing issue')) DESC
LIMIT 1;
About docn
The docn extension brings the DigitalOcean AI-Native Cloud to DuckDB. It exposes DigitalOcean services as SQL functions, starting with Serverless Inference: do_models lists the available models, do_decide answers closed questions (yes/no, choice, score) about text, do_prompt sends prompts to chat models and do_embed turns text into embedding vectors. See https://github.com/digitalocean-labs/duckdb-do for documentation.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| do_decide | scalar | NULL | NULL | |
| do_embed | scalar | NULL | NULL | |
| do_models | table | NULL | NULL | |
| do_prompt | scalar | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| do_decide_model | Model used by do_decide | VARCHAR | GLOBAL | [] | typesafe-jev-1.13.0 |
| do_embed_model | Model used by do_embed | VARCHAR | GLOBAL | [] | qwen3-embedding-0.6b |
| do_max_concurrent_requests | Maximum inference requests in flight at once, shared by all threads | BIGINT | GLOBAL | [] | 32 |
| do_model_access_key | DigitalOcean model access key. Leave unset to use the DO_MODEL_ACCESS_KEY environment variable | VARCHAR | GLOBAL | [] | NULL |
| do_prompt_model | Model used by do_prompt | VARCHAR | GLOBAL | [] | deepseek-4-flash |
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |