pg_ai
PostgreSQL extension that provides (RAG capable)SQL functions to interpret data using multi modal LLMs and vectors.
pg_ai · PostgreSQL extension that provides (RAG capable)SQL functions to interpret data using multi modal LLMs and vectors.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101513 | pg_ai | pg_ai | 0.0.1 | RAG | Apache-2.0 | C |
Usage
Sources:
- Official upstream README
- Official extension control file (pg_ai.control)
- Official extension SQL (pg_ai–0.0.1.sql)
pg_ai — PostgreSQL extension with builtin RAG capabilities, enabling the interpretation and querying of data through both natural language and SQL functions. 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
pg_ai_create_vector_store(store NAME, sql_query TEXT, notes NAME = NULL)is an extension function and returnsTEXT.pg_ai_generate_image(column_name TEXT, prompt TEXT = NULL)is an extension function and returnsTEXT.pg_ai_help()is an extension function and returnsTEXT.pg_ai_insight(column_name TEXT, prompt TEXT = NULL)is an extension function and returnsTEXT.pg_ai_moderation(column_name TEXT, prompt TEXT = NULL)is an extension function and returnsTEXT.pg_ai_query_vector_store(store NAME, nl_query TEXT, count INT = 2)is an extension function and returnsSETOF.pg_ai_generate_image_aggis an aggregate exposed by the extension.pg_ai_insight_aggis an aggregate exposed by the extension.pg_ai_moderation_aggis an aggregate exposed by the extension.
Requirements and Caveats
- The reviewed control file declares default version
0.0.1. - The control file marks the extension as non-relocatable.
- Confirm privileges, supported PostgreSQL versions, upgrade behavior, and failure cases against the pinned source before production use.