Configuring AIDB v7
To use AIDB, add it to shared_preload_libraries, create the extensions in the database, and verify the installation.
Configure shared_preload_libraries
In the
postgresql.conffile, addaidbto theshared_preload_librariesparameter:shared_preload_libraries = 'aidb'
Note
If
shared_preload_librariesalready has other extensions listed, appendaidbusing a comma separator. The order doesn't matter.Restart Postgres.
Create the extensions
Create the AIDB extension in your database:
CREATE EXTENSION aidb CASCADE;
The
CASCADEoption automatically installs the requiredvectorextension if it isn't already present.PGD users
If you're running EDB Postgres Distributed (PGD), run the following after creating the extension to register AIDB catalog tables in the replication set:
SELECT aidb.bdr_setup();
If you plan to use external data sources such as S3-compatible object stores or local file system volumes, also install the Postgres File System (PGFS) extension:
CREATE EXTENSION pgfs;
For more information, see PGFS documentation.
Enable VectorChord (optional)
If you installed VectorChord, create the extension in your database:
CREATE EXTENSION vectorchord;
To also enable hybrid search (BM25 + vector):
CREATE EXTENSION vectorchord_bm25;
VectorChord knowledge bases can then be configured at the knowledge base level — see Knowledge bases.
Proxy settings
If your environment routes outbound HTTP traffic through a proxy, set the HTTP_PROXY and HTTPS_PROXY environment variables in the Postgres environment file. On Ubuntu with community Postgres, this file is at /etc/postgresql/<version>/main/environment:
echo "HTTP_PROXY = 'http://<your-proxy-settings>/'" | sudo tee -a /etc/postgresql/16/main/environment echo "HTTPS_PROXY = 'http://<your-proxy-settings>/'" | sudo tee -a /etc/postgresql/16/main/environment
Then restart Postgres for the changes to take effect:
sudo systemctl restart postgresql@16-mainReplace <your-proxy-settings> with your proxy address, and 16 with your Postgres version. Consult the documentation for your Postgres distribution for the exact location of the environment file.
Note
Air-gapped environments are not currently supported.
Validate the installation
Confirm that the extensions are installed by running \dx in psql and looking for aidb, vector, pgfs (if installed), and vectorchord and vectorchord_bm25 (if those extensions were installed) in the output:
aidb=# \dx
List of installed extensions
Name | Version | Schema | Description
-----------------------+---------+------------+------------------------------------------------------------
aidb | 7.3.1 | aidb | aidb: makes it easy to build AI applications with postgres
pgfs | 1.0.6 | pgfs | pgfs: enables access to filesystem-like storage locations
vector | 0.8.0 | public | vector data type and ivfflat and hnsw access methods
vectorchord | 0.3.0 | public | vectorchord: fast vector search for postgres
vectorchord_bm25 | 0.1.0 | public | vectorchord_bm25: bm25 full-text search for postgres