ai_toolkit
ai_toolkit · AI-powered query generation and explanation tools for PostgreSQL.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100949 | ai_toolkit | ai_toolkit | 1.0 | RAG | Unknown | C++ |
PostgreSQL · 18
Usage
Sources:
ai_toolkit 1.0 puts natural-language query generation, query and error explanation, and persistent prompt context inside PostgreSQL. Its most important boundary is that ai_toolkit.query(text) sends database context to a configured external model and executes the SQL returned by that model.
Core Workflow
Configure all four required settings, restart PostgreSQL, and create the extension. The reviewed upstream version requires PostgreSQL 18.
Use ai_toolkit.explain_query(text) and ai_toolkit.explain_error(text) for advisory text. Treat ai_toolkit.query(text) as a privileged execution path, not as a read-only SQL generator.
Memory and Utility Functions
ai_toolkit.set_memory(category, key, value, notes)stores context for later prompts.ai_toolkit.get_memory(category, key),ai_toolkit.view_memories(), andai_toolkit.search_memory(search_term)retrieve that context.ai_toolkit.help()returns the extension’s built-in help.
Operational Boundaries
Calls are synchronous backend operations and depend on provider availability, latency, rate limits, and cost. The API key is held in PostgreSQL configuration, while prompts can include schema, data, errors, and stored memory. Restrict function execution, use a low-privilege role and transaction guardrails, review provider retention policy, and never trust generated SQL without an application-level approval boundary.