Vector Search & RAG

Build AI applications with semantic search. Telbase auto-detects vector dependencies in your project and provisions pgvector on your PostgreSQL database — no manual setup required.

Zero configuration
When you deploy a project with langchain, pgvector, or other vector packages, Telbase automatically enables pgvector and configures the right embedding dimensions. Just run telbase deploy.

How It Works

When you deploy a Python project with vector dependencies, Telbase runs a three-step pipeline:

  1. Dependency scan — Telbase reads requirements.txt or pyproject.toml and extracts Python dependencies
  2. Vector package detection — Matches against 9 known vector/RAG packages
  3. Auto-provision — Enables the pgvector extension on your Neon database and infers the optimal embedding preset from your AI SDK (OpenAI, Anthropic, Cohere, or sentence-transformers)
Neon databases only
Auto-detection works with PostgreSQL databases on Neon. SQLite databases (Turso) don't support vector extensions. The provisioning is non-blocking — if it fails, your deploy continues normally.

Supported Packages

Telbase detects the following packages in your Python dependencies:

PackageDescription
pgvectorPostgreSQL vector similarity search
langchainLLM orchestration framework
llama-indexData framework for LLM applications
llamaindexAlternative package name for LlamaIndex
chromadbEmbedding database (pgvector recommended on Telbase)
sentence-transformersLocal sentence embedding models
pinecone-clientPinecone vector database client
@pinecone-database/pineconePinecone SDK (alternative package)
weaviate-clientWeaviate vector database client
Embedding preset inference
When Telbase detects vector packages, it also checks your AI SDK to infer the right embedding dimensions: openai → 1536d, @anthropic-ai/sdk → 1024d, cohere-ai → 1024d, sentence-transformers → 384d. If no SDK is detected, it defaults to openai-3-small (1536 dimensions).

Embedding Presets

Telbase infers the best embedding preset from your AI SDK. You can also specify one explicitly with --pgvector-preset.

PresetDimensionsIndex TypeUse Case
openai-ada-0021,536HNSWLegacy OpenAI embeddings
openai-3-small1,536HNSWOpenAI text-embedding-3-small (default)
openai-3-large3,072NoneOpenAI text-embedding-3-large
claude1,024HNSWAnthropic / Voyage AI embeddings
cohere-english1,024HNSWCohere embed-english-v3
sentence-transformers384HNSWall-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.

Deploy a RAG App

For a single-service RAG app (e.g., FastAPI with pgvector):

bash
telbase deploy

Telbase detects your framework, scans requirements.txt for vector packages, provisions a PostgreSQL database with pgvector, and deploys your app. The DATABASE_URL is set automatically.

Structured feedback
The deploy response includes a decision manifest showing exactly what was detected and provisioned: pgvector auto-enabled (openai-3-small, 1536 dims, HNSW, cosine). This is machine-readable — Claude Code can parse and act on it.

CLI Flags

Override auto-detection behavior with these flags:

FlagDescription
--pgvectorForce-enable pgvector even without detected packages
--no-pgvectorDisable auto-detection and skip pgvector provisioning
--pgvector-preset <name>Override the inferred embedding preset
bash
# Force a specific preset
telbase deploy --pgvector-preset openai-3-small

# Enable pgvector manually (no auto-detection needed)
telbase deploy --pgvector --pgvector-preset claude

# Disable auto-detection
telbase deploy --no-pgvector

Manual Setup

If your project doesn't use any of the auto-detected packages, you can enable pgvector manually and create your own embeddings table.

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 --file setup.sql

Using with Claude Code

Telbase's MCP integration gives Claude Code full control over database extensions.

bash
# In Claude Code, just describe what you need:
"Deploy my RAG app with pgvector support"

# Or manage extensions directly:
"Enable pgvector on my database with the openai-3-small preset"

The enable_database_extension MCP tool handles provisioning, and the telbase://docs/rag resource provides Claude Code with context about vector search capabilities.

Next Steps