Skip to Content
DocumentationGetting StartedInstallation

Installation

Getting Unforget running takes about 2 minutes. You need Python and PostgreSQL — that’s it.

1. Install the package

pip install unforget

This gives you the core library with local embedding (no API keys needed). If you want to integrate with a specific LLM provider or add the REST API, grab the extras you need:

pip install unforget[openai] # Wrap your OpenAI client with memory pip install unforget[anthropic] # Wrap your Anthropic client with memory pip install unforget[api] # Mount a FastAPI router with 17 endpoints pip install unforget[spacy] # Better named entity extraction

You can combine them: pip install unforget[openai,api]

2. Start PostgreSQL

Unforget uses PostgreSQL with the pgvector extension. If you already have PostgreSQL running, just enable pgvector and skip ahead.

The easiest way to get started is Docker:

docker-compose.yml
services: postgres: image: pgvector/pgvector:pg16 environment: POSTGRES_USER: unforget POSTGRES_PASSWORD: unforget POSTGRES_DB: unforget ports: - "5433:5432" volumes: - unforget-data:/var/lib/postgresql/data volumes: unforget-data:
docker compose up -d

This starts PostgreSQL 16 with pgvector on port 5433 — data persists across restarts.

Don’t want Docker? Use unforget-embed for an embedded PostgreSQL that requires zero setup:

pipx install unforget-embed unforget-embed start

3. Verify it works

from unforget import MemoryStore store = MemoryStore("postgresql://unforget:unforget@localhost:5433/unforget") await store.initialize() print("Connected!") await store.close()

initialize() automatically creates the database schema, builds all the indexes (HNSW for vectors, GIN for full-text search, B-tree for scoping), and preloads the embedding model. First run takes a few seconds while the model downloads; after that, startup is instant.

What got installed

  • Embedding model (all-MiniLM-L6-v2) — runs locally, 384 dimensions, ~3ms per embedding with ONNX
  • Cross-encoder reranker (ms-marco-MiniLM-L-6-v2) — reranks search results for better precision
  • pgvector — enables fast vector similarity search inside PostgreSQL

No external API calls are made during normal operation. Everything runs on your machine.

Optional: faster embeddings with ONNX

The default embedding uses PyTorch. For 2-3x faster inference, install ONNX Runtime:

pip install onnxruntime

Unforget auto-detects it and switches — no code changes needed.

Last updated on
Apache 2.0 · Unforget