Search Shortcut cmd + k | ctrl + k
decide

Filter, classify, and score text using OpenAI Decisions from SQL

Maintainer(s): gzheng92

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 decide FROM community;
LOAD decide;

Example

-- Requires OpenAI Decisions API access and a paid API key.
CREATE SECRET openai_decisions (TYPE decisions, API_KEY 'your-key');
SELECT decision_prob('The parcel arrived crushed.',
                     'Does this report physical damage?') AS probability;

About decide

decide integrates the OpenAI Decisions API with DuckDB SQL. It provides boolean predicates, probabilities, categorical choices, rubric scores, and explicit multi-question JSON answers. Typed functions batch 20 rows per request by default; set decisions_batch_size = 1 for independent row evaluation. Non-NULL inputs and instructions are sent to OpenAI and can incur API charges. Credentials use DuckDB's decisions secret type or OPENAI_API_KEY. No API key is required to build or run the offline tests. The integration currently accepts text only and targets gpt-6-luna. This is an independent integration with an upstream API in public beta. See the README for function signatures, limits, refusal handling, and batching semantics.

Added Functions

function_name function_type description comment examples
decision scalar NULL NULL  
decision_answers scalar NULL NULL  
decision_choice scalar NULL NULL  
decision_prob scalar NULL NULL  
decision_score 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
decisions_batch_size Rows per request for typed functions (1 to 128) UBIGINT GLOBAL [] 20
decisions_endpoint OpenAI Decisions URL; loopback HTTP allowed for mock tests VARCHAR GLOBAL [] https://api.openai.com/v1/decisions
decisions_model Cloudflare model: 'clef' (default) or 'clef-flash' VARCHAR GLOBAL [] clef
decisions_provider Backend: 'openai' (default) or 'cloudflare' (Workers AI Clef) VARCHAR GLOBAL [] openai
temp_directory Set the directory to which temporary files are written. VARCHAR GLOBAL [] post.db.tmp