--- warning: DO NOT CHANGE THIS MANUALLY, THIS IS GENERATED BY https://github.com/duckdb/community-extensions repository, check README there title: dc excerpt: | DuckDB Community Extensions Compose fast bounded judgments, semantic resolution, and selective LLM reasoning with provenance extension: name: dc description: Compose fast bounded judgments, semantic resolution, and selective LLM reasoning with provenance version: 0.2.2 language: C++ build: cmake license: Apache-2.0 maintainers: - prasanthj excluded_platforms: "wasm_mvp;wasm_eh;wasm_threads;windows_amd64;windows_arm64;windows_amd64_mingw;windows_amd64_rtools" opt_in_platforms: "linux_arm64;osx_amd64;osx_arm64" requires_toolchains: vcpkg vcpkg_commit: 84bab45d415d22042bd0b9081aea57f362da3f35 repo: github: prasanthj/duckdb-dual-cognition ref: 8a4c282095efbf0e7ff5dd744940b917ab678104 variegata: 8a4c282095efbf0e7ff5dd744940b917ab678104 andium: 8a4c282095efbf0e7ff5dd744940b917ab678104 docs: hello_world: | INSTALL dc FROM community; LOAD dc; CREATE SECRET cognition ( TYPE dc, SYSTEM_ONE_PROVIDER 'typesafe', SYSTEM_ONE_API_KEY 'ts-...', SYSTEM_ONE_MODEL 'jev-1.13.0', SYSTEM_TWO_PROVIDER 'openai', SYSTEM_TWO_API_KEY 'sk-...', SYSTEM_TWO_MODEL 'gpt-5.6-luna' ); SELECT item, result.choice AS category, result.confidence FROM ( SELECT item, system_one_choice( item, 'Classify the support request.', '{"billing":"payments", "technical":"product failures", "security":"access and data risk"}'::JSON ) AS result FROM support_requests ); extended_description: | `dc` brings a two-stage AI enrichment pipeline into DuckDB SQL. **System One** handles bounded, highly batchable judgments with `system_one_choice`, `system_one_score`, `system_one_noul`, and the relation-oriented `system_one_stream`. Semantic Resolution assigns foreign keys from per-row candidates with `system_one_resolve` and `system_one_resolve_stream`, including explicit `matched`, `ambiguous`, and `no_match` outcomes. **System Two** handles generation, summarization, and structured extraction with `system_two_generate`, `system_two_summarize`, and `system_two_extract`. The two paths compose through ordinary SQL. A query can classify every row with System One, escalate only results below a confidence threshold to System Two, and retain a single final column alongside the candidate, confidence, threshold, escalation result, and selected source. The native extension deduplicates equivalent work, batches rows, bounds concurrent provider requests, validates responses, stops queued work and aborts active client transfers when DuckDB interrupts a query, and offers query-local coalescing plus optional per-connection TTL/LRU caches. `dc_stats()` reports request, item, cache, retry, error, token, byte, and latency metrics independently for both systems. Provider credentials are stored through DuckDB's Secret Manager and are redacted from `duckdb_secrets()`. Plain HTTP endpoints are rejected except for loopback testing, and `SET enable_external_access = false` disables provider calls. Full SQL reference and runnable examples: https://github.com/prasanthj/duckdb-dual-cognition extension_star_count: 5 extension_star_count_pretty: 5 extension_download_count: 676 extension_download_count_pretty: 676 image: '/images/community_extensions/social_preview/preview_community_extension_dc.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 | |---------------------------|---------------|-------------|---------|----------| | dc_cache_clear | scalar | NULL | NULL | | | dc_stats | table | NULL | NULL | | | system_one_choice | scalar | NULL | NULL | | | system_one_noul | scalar | NULL | NULL | | | system_one_resolve | scalar | NULL | NULL | | | system_one_resolve_stream | table | NULL | NULL | | | system_one_score | scalar | NULL | NULL | | | system_one_stream | table | NULL | NULL | | | system_two_extract | scalar | NULL | NULL | | | system_two_generate | scalar | NULL | NULL | | | system_two_summarize | 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 | |---------------------------------------|---------------------------------------------------------|------------|--------|---------|--------------------------------------| | dc_system_one_batch_size | Maximum questions per HTTP request | BIGINT | GLOBAL | [] | 25 | | dc_system_one_cache_bytes | Query cache serialized byte budget (0 disables) | BIGINT | GLOBAL | [] | 8388608 | | dc_system_one_concurrency | Concurrent requests (global ceiling 10) | BIGINT | GLOBAL | [] | 10 | | dc_system_one_endpoint | Trusted TypeSafe endpoint | VARCHAR | GLOBAL | [] | https://api.typesafe.ai/v1/systemone | | dc_system_one_max_questions_per_query | Maximum billable questions dispatched by one query | BIGINT | GLOBAL | [] | 100000 | | dc_system_one_max_request_bytes | Serialized request byte cap | BIGINT | GLOBAL | [] | 65536 | | dc_system_one_max_requests_per_query | Maximum logical HTTP requests dispatched by one query | BIGINT | GLOBAL | [] | 2000 | | dc_system_one_max_retries | Retries for transient transport, 429 and 5xx errors | BIGINT | GLOBAL | [] | 2 | | dc_system_one_model | TypeSafe model | VARCHAR | GLOBAL | [] | jev-latest | | dc_system_one_retry_base_ms | Initial exponential retry delay | BIGINT | GLOBAL | [] | 100 | | dc_system_one_retry_max_delay_ms | Maximum retry delay including Retry-After | BIGINT | GLOBAL | [] | 5000 | | dc_system_one_session_cache_bytes | Opt-in connection LRU serialized byte budget | BIGINT | GLOBAL | [] | 0 | | dc_system_one_session_cache_ttl_ms | Connection cache non-sliding TTL | BIGINT | GLOBAL | [] | 60000 | | dc_system_one_timeout_ms | HTTP timeout per attempt | BIGINT | GLOBAL | [] | 30000 | | dc_system_two_batch_size | Maximum rows per Responses request | BIGINT | GLOBAL | [] | 25 | | dc_system_two_cache_bytes | System Two query-cache serialized byte budget | BIGINT | GLOBAL | [] | 8388608 | | dc_system_two_concurrency | Concurrent Responses requests | BIGINT | GLOBAL | [] | 5 | | dc_system_two_endpoint | OpenAI Responses endpoint | VARCHAR | GLOBAL | [] | https://api.openai.com/v1/responses | | dc_system_two_max_items_per_query | Maximum uncached System Two rows per query | BIGINT | GLOBAL | [] | 100000 | | dc_system_two_max_request_bytes | Serialized Responses request byte cap | BIGINT | GLOBAL | [] | 1048576 | | dc_system_two_max_requests_per_query | Maximum System Two HTTP requests per query | BIGINT | GLOBAL | [] | 2000 | | dc_system_two_max_retries | Retries for transient transport, 429 and 5xx errors | BIGINT | GLOBAL | [] | 2 | | dc_system_two_retry_base_ms | Initial exponential retry delay | BIGINT | GLOBAL | [] | 250 | | dc_system_two_retry_max_delay_ms | Maximum retry delay including Retry-After | BIGINT | GLOBAL | [] | 10000 | | dc_system_two_session_cache_bytes | System Two connection-cache serialized byte budget | BIGINT | GLOBAL | [] | 0 | | dc_system_two_session_cache_ttl_ms | System Two connection-cache TTL | BIGINT | GLOBAL | [] | 60000 | | dc_system_two_timeout_ms | HTTP timeout per attempt | BIGINT | GLOBAL | [] | 90000 | | temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |