--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: decide excerpt: | DuckDB Community Extensions Filter, classify, and score text with OpenAI Decisions, TypeSafe Jev, or Cloudflare Clef extension: name: decide description: Filter, classify, and score text with OpenAI Decisions, TypeSafe Jev, or Cloudflare Clef version: 0.2.1 language: C++ build: cmake license: MIT excluded_platforms: "osx_amd64;wasm_mvp;wasm_eh;wasm_threads" maintainers: - gzheng92 repo: github: gzheng92/duckdb-decide # Validated DuckDB 2.0.0 source revision: the v0.2.1 release commit. ref: a520e4b0a4aa9e7a1ed20e8fd825108f7e6ecd3a docs: hello_world: | -- OpenAI example; use your own API key. SET decisions_provider = 'openai'; CREATE OR REPLACE SECRET openai_key (TYPE decisions, API_KEY 'your-key', SCOPE 'decisions://openai'); SELECT decision_prob('The parcel arrived crushed.', 'Does this report physical damage?') AS probability; extended_description: | `decide` asks decision models yes/no, multiple-choice, and rubric questions from SQL. It supports OpenAI Decisions (the default, `gpt-6-luna`), TypeSafe Jev, and Cloudflare Clef (Workers AI) with the same functions: boolean predicates, probabilities, categorical choices, rubric scores, and explicit multi-question JSON answers. `SELECT * FROM decision_providers()` lists the providers, models, and credential names. 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 the selected provider and can incur API charges. ### Credentials Keep one `decisions` secret per provider, scoped to it, so each key is sent only to its own provider. Each provider also reads an environment variable. ```sql CREATE OR REPLACE SECRET openai_key (TYPE decisions, API_KEY 'sk-...', SCOPE 'decisions://openai'); CREATE OR REPLACE SECRET jev_key (TYPE decisions, API_KEY 'your-typesafe-key', SCOPE 'decisions://jev'); CREATE OR REPLACE SECRET cf_key (TYPE decisions, API_KEY 'workers-ai-token', ACCOUNT_ID 'your-account-id', SCOPE 'decisions://cloudflare'); ``` The environment variables are `OPENAI_API_KEY`, `TYPESAFE_API_KEY`, and `CLOUDFLARE_API_TOKEN` with `CLOUDFLARE_ACCOUNT_ID`. ### TypeSafe Jev and Cloudflare Clef ```sql SET decisions_provider = 'jev'; -- default model jev-latest SET decisions_provider = 'cloudflare'; -- default model clef; also 'clef-flash' SET decisions_model = 'jev-1.14.0'; -- optional override; RESET when switching SELECT decision_prob('The parcel arrived crushed.', 'Does this report physical damage?') AS probability; ``` Clef caps requests at 64 questions. Neither Jev nor Clef returns refusal answers. All providers accept text only. No API key is required to build or run the offline tests. This is an independent integration, not an official extension of OpenAI, TypeSafe, or Cloudflare. See the [README](https://github.com/gzheng92/duckdb-decide#readme) for function signatures, limits, refusal handling, and batching semantics. extension_star_count: 0 extension_star_count_pretty: 0 extension_download_count: 545 extension_download_count_pretty: 545 image: '/images/community_extensions/social_preview/preview_community_extension_decide.png' layout: community_extension_doc --- ### Compatibility Matrix This table covers all DuckDB releases that have not reached [end-of-life](https://duckdb.org/release_calendar), 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 ```sql INSTALL {{ page.extension.name }} FROM community; LOAD {{ page.extension.name }}; ``` {% if page.docs.hello_world %} ### Example ```sql {{ page.docs.hello_world }}``` {% endif %} {% if page.docs.extended_description %} ### About {{ page.extension.name }} {{ page.docs.extended_description }} {% endif %} ### 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_providers | table | 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 | Empty for the provider's URL; a loopback http://127.0.0.1 URL for mock tests | VARCHAR | GLOBAL | [] | | | decisions_model | Model id; empty for the provider's default_model | VARCHAR | GLOBAL | [] | | | decisions_provider | Decision provider: cloudflare, jev, openai; see decision_providers() | VARCHAR | GLOBAL | [] | openai | | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |