Postgres Vector Store

Keep chunks of text as vectors in Postgres with pgvector, and search them.

v1.3.0Source

Install

Run SQL queries on a Postgres database, or insert, update, select, and delete rows. Start a workflow when a new row appears or when Postgres sends a notification. Keep AI Agent memory, and store and search vectors with pgvector.

Postgres@zerodot/postgresInstall
  1. Open System, then Nodes.
  2. Find Postgres and click Install.
  3. Use the new nodes at once. You do not restart.

How it works

Postgres Vector Store (postgres.vectorStore) is an action node in the Postgres package (@zerodot/postgres): Keep chunks of text as vectors in Postgres with pgvector, and search them.

Keeps chunks of text as vectors with pgvector. Supabase and Neon work too. Operation Mode:

  • Get Many: finds the chunks that are closest to the Prompt, with a score. Include Metadata adds the metadata. Metadata Filter is a JSON object. Rerank Results uses the reranker on Reranker.
  • Insert Documents: makes chunks of the items, embeds them, and inserts one row for each chunk. Connect a Default Data Loader to Document, or the node uses all data of each item with simple splitting.
  • Retrieve Documents (As Vector Store for Chain/Tool): the node is a supply (kind ai.vectorStore) and not a step. Connect it to the Vector Store port of the Vector Store Tool of the AI Agent.
  • Retrieve Documents (As Tool for AI Agent): the node is a tool (kind ai.tool). Connect it to the Tools port of the AI Agent. The tool name is the node name. Settings: Description, Limit, Include Metadata, Metadata Filter, and Rerank Results.
  • Update Documents: replaces the text, the metadata, and the vector of one chunk for each item, by ID.
  • Delete Documents: deletes chunks by their ID.

Connect an embedding model of @zerodot/ai-agent to Embedding. Insert makes the vector extension, the table (default public.zerodot_vectors), and an HNSW index (up to 2000 dimensions) when they are not there. Collection keeps sets of chunks apart in one table. The column names can be changed, to use a table that you have. Distance is Cosine, Euclidean, or Inner Product. The retrieve modes need zerodot with node SDK 1.5, and keep one connection for the run.

Logins it can use

Postgres (postgres): host, port, database, user, password, ssl (allow, disable, or require), allowUnauthorizedCerts. The password is secret.

Guides and related hubs