Skip to content

pqnai

Queued forecasting and retrieval backed by an external Go worker

pqnai · Queued forecasting and retrieval backed by an external Go worker

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
102175pqnaipqnai0.3.0RAGPostgreSQLC

PostgreSQL · 14, 15, 16, 17

Relationships
Requiresvector

Usage

Sources:

pqnai exposes forecasting and retrieval procedures backed by the external pqnaid Go worker. This early version implements moving-average forecasts and chunked retrieval using pgvector and Ollama; ARIMA, hybrid retrieval and reranking remain planned.

Core Workflow

CREATE EXTENSION vector;
CREATE EXTENSION pqnai;
CALL pqnai.forecast(ARRAY[10,20,30,40,50]::double precision[], 3);
CALL pqnai.embed('The worker receives jobs using LISTEN and NOTIFY.');
CALL pqnai.ask('How does the worker receive jobs?', 1);

Operational Boundaries

Install vector first and create pqnai as a superuser. The fixed schema holds jobs, sources and chunks. The worker must use the same database and be able to reach Ollama. No PostgreSQL preload is declared; running the SQL extension alone does not provide inference. Upstream CI targets PostgreSQL 14–17.

Use top-level CALL outside an explicit transaction block: the procedures commit queued jobs before waiting for the worker. A timeout does not undo that committed work. pqnai.enqueue_job and pqnai.wait_for_job are lower-level queue helpers. Restrict job and stored-document access; per-tenant access control is not implemented in this version. The installed vector column has 384 dimensions, so changing the embedding dimension requires a schema migration. Plan retention for queue and document data.

Table reader