Vector Search & RAG
Build AI applications with semantic search. Telbase's PostgreSQL databases support the pgvector extension: your agent turns it on for the app's database with one command.
How It Works
- The agent registers the app with a PostgreSQL database:
telbase apps create my-app --provider cloudrun --database postgres. - It turns on pgvector, with the embedding preset that matches the app's embedding model:
bash
telbase db enable-extension pgvector --project my-app --preset openai-3-small- It creates the app's tables with the app's own tooling, through
telbase db run.
PostgreSQL only
pgvector works with PostgreSQL databases. SQLite databases don't support vector extensions.
telbase db extensions --project my-app lists the extensions available: pgvector, PostGIS, pg_trgm and uuid-ossp.Embedding Presets
Pass one with --preset; it sets the dimensions and the index. Without one, pgvector is enabled with 1,536 dimensions and an HNSW index (--dimensions, --index-type and --metric change them).
| Preset | Dimensions | Index Type | Use Case |
|---|---|---|---|
openai-ada-002 | 1,536 | HNSW | Legacy OpenAI embeddings |
openai-3-small | 1,536 | HNSW | OpenAI text-embedding-3-small (default) |
openai-3-large | 3,072 | None | OpenAI text-embedding-3-large |
claude | 1,024 | HNSW | Anthropic / Voyage AI embeddings |
cohere-english | 1,024 | HNSW | Cohere embed-english-v3 |
sentence-transformers | 384 | HNSW | all-MiniLM-L6-v2 and similar |
HNSW dimension limit
PostgreSQL's vector type has a hard 2,000-dimension limit for HNSW and IVFFlat indexes. The openai-3-large preset (3,072 dimensions) automatically disables indexing. For most RAG apps, openai-3-small (1,536 dimensions) offers the best balance of quality and performance.
A sample table
--create-table also creates an embeddings table (--table-name and --column-name name it):
bash
telbase db enable-extension pgvector --project my-app --preset claude --create-tableManual Setup
Or create the extension and your own embeddings table in SQL.
sql
-- Enable the pgvector extension
CREATE EXTENSION IF NOT EXISTS vector;
-- Create an embeddings table (1536 dimensions for OpenAI)
CREATE TABLE documents (
id SERIAL PRIMARY KEY,
content TEXT NOT NULL,
embedding vector(1536)
);
-- Create an HNSW index for fast similarity search
CREATE INDEX ON documents
USING hnsw (embedding vector_cosine_ops);You can run this SQL directly: telbase db exec --project my-app --file setup.sql
Using with Claude Code
Ask Claude in plain words; with the skills it runs the commands above.
bash
"Deploy my RAG app to Telbase with a PostgreSQL database and pgvector"
"Enable pgvector on my app's database with the openai-3-small preset"With the MCP server registered, the enable_database_extension tool does the same.
Next Steps
- Databases — PostgreSQL and SQLite database management
- Supported Frameworks — Python, Node.js, and more
- Custom Domains — Add your own domain
- CLI Reference — Full command reference