pg_ai_sdk
Translate natural language to SQL using Clickhouse ai-sdk-cpp
pg_ai_sdk · Translate natural language to SQL using Clickhouse ai-sdk-cpp
Overview
Usage
Sources:
- Official upstream README
- Official extension control file (pg_ai_sdk.control)
- Official extension SQL (pg_ai_sdk–1.0.sql)
pg_ai_sdk — This project is a PostgreSQL extension that translates natural language queries into SQL using the ClickHouse/ai-sdk-cpp. It allows users to query their database by asking questions in plain English. Use it for the corresponding vector, model, or retrieval workflow. Use the pinned upstream revision linked above as the API boundary and test it on the target PostgreSQL build.
Core Workflow
Install the extension in the intended database, run the smallest upstream example above when available, and verify the installed version and returned values before integrating it into application SQL.
Important Objects
generate_sql_from_text(natural_language_query TEXT)is an extension function and returnsTEXT.generate_sql_from_text(natural_language_query TEXT, model_name TEXT)is an extension function and returnsTEXT.pg_ai_sdk_execute_json(natural_language_query text)is an extension function and returnstext.pg_ai_sdk_execute_json(natural_language_query text, model_name TEXT)is an extension function and returnstext.
Requirements and Caveats
- The reviewed control file declares default version
1.0. - The control file marks the extension as relocatable.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.