Skip to main content

Enable Retool-managed Vectors on self-hosted deployments

Organizations with self-hosted Retool deployments must configure and enable Retool Vectors before use.

Install dependencies​

To use Retool Vectors for self-hosted deployments:

  • Configure Retool Database on your self-hosted deployment.
  • Install pgvector, an open-source PostgreSQL extension for similarity search, in the same database cluster as Retool Database. Ensure your pgvector version is compatible with your PostgreSQL version.
  • If you're using Amazon RDS, you also need to run PostgreSQL 15.2 or later.
Caution

Make sure to use Retool Database (often the retooldb-postgres container), not the platform database (often postgres). The platform database tracks app info, users, audit logs, etc. Retool Database is a PostgreSQL database you can use in apps and workflows, and has a UI for creating and editing tables.

Verify installation​

Once you have enabled Retool Database and pgvector, you can start using Vectors.

To verify that pgvector is installed correctly and the role you are using for Retool Database can create tables, run the following SQL statement in a query:

CREATE TABLE sample_vector_table (id serial PRIMARY KEY, embedding vector(1536));

Configure environment variables​

important

The following section is required only if your deployment is self-hosted and you are using a Retool-managed AI model. If you are using a self-managed model, you can skip this section.

Configure environment variables

To use Vectors on self-hosted deployments with a Retool-managed key, set the following environment variables. Retool authorizes requests with your self-hosted Retool license key, so you don't need to request a separate token from Retool.

Environment variableValue
LICENSE_KEYYour self-hosted Retool license key.
OPENAI_PROXY_HOSTSet to https://ai-proxy.retool.com.
OPENAI_SECRET_KEYSet to an empty string.
note

OPENAI_PROXY_API_TOKEN is optional. If your instance already sets it, the instance continues to use that token.

While these environment variables include OPENAI in the name, you can use them for any available provider.

Alternatively, bring your own key and set it from the Settings > AI resource page.

To turn off Retool-managed keys on your instance, set DISABLE_RETOOL_MANAGED_AI to true. Requests that use a Retool-managed key then fail until you unset the variable or users configure their own AI provider.

Enable Vectors​

Before creating a Vector, ensure that the feature is enabled. Navigate to Settings > AI, and toggle on the Vectors setting.

Error handling​

If you are experiencing issues creating vectors, connect to Retool Database using the available connection strings.

  1. Click the next to Database.
  2. Click Connection and copy the connection string you want to use (PSQL or Postgres).
  3. Use the connection string to connect to the database created.
  4. Retry creating the Vector resource in Retool.