philippgille/chromem-go
In-process Go vector database for RAG without a separate database server
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & Core Mechanics
chromem-go is an in-process vector database. db.go, collection.go, and document.go define its database, collection, and document structure; query.go and vector.go cover retrieval and vector operations, while persistence.go handles storage. The module declares Go 1.21 and has no third-party library dependencies. Its collection API is inspired by Chroma, but it neither connects to nor requires a Chroma server.
Documents can carry precomputed embeddings or get them from the collection’s EmbeddingFunc. Text queries use that function to obtain a query vector, then rank eligible documents by cosine similarity using an exhaustive scan. Ingestion and query processing can use Go concurrency. The application owns the rest of the RAG pipeline: it decides how to prepare documents, assemble prompts, and invoke the LLM.
Key Capabilities & Differentiators
The exact cosine search supports metadata equality filters and document substring inclusion or exclusion via $contains and $not_contains. v0.7.0 adds negative-query handling that can filter regular results or subtract a negative similarity contribution. Embedding adapters cover hosted providers including OpenAI, Azure OpenAI, Vertex AI, Cohere, Mistral, Jina, and mixedbread.ai, plus local endpoints such as Ollama, llmman, and LocalAI.
The default store is in memory. Optional immediate persistence writes a gob file per collection and document, with optional gzip compression. Whole-database export/import is a separate mechanism with optional gzip and AES-GCM encryption. v0.7.0 extends export/import to object storage such as S3; it does not make object storage the live query backend.
Trade-offs & Limitations
Embedding the database avoids a retrieval-service network hop and a separate deployment, though a remote embedding provider can still add latency and cost. In the published BenchmarkCollection_Query table on a Core i5-1135G7, queries took about 0.52 ms at 1,000 documents and 39.4 ms at 100,000. Use these figures as a reference for that workload, not as end-to-end RAG latency. Exact scans do more work as the number and dimensionality of candidate vectors increase, and persistence does not remove the need to keep the data in RAM.
Pinecone is the managed alternative if the vector layer needs to be a shared service rather than a library inside one application. Chroma is a closer API reference, but the similar collection calls do not establish compatibility. Before adopting chromem-go, benchmark with your actual vector dimensions, filters, and concurrent load. If you enable immediate persistence, also test write throughput and file counts on the target filesystem.
Hardware & Deployment Guide
Build chromem-go into a Go application using the module’s declared Go 1.21 baseline. chromem.NewDB() starts an in-memory database without a database daemon or container. A nil embedding function selects OpenAI and requires OPENAI_API_KEY when generating embeddings. For an offline text-query path, configure a locally running embedding endpoint such as Ollama or supply an embedding function that runs locally. If using file persistence, give the application a writable directory on durable storage and test backup restoration.
Pin the dependency and review the changelog before upgrades: the API is beta and can change before v1.0.0. v0.5.0 added single-file database export/import with optional compression and encryption. v0.6.0 added collection document deletion and experimental WebAssembly bindings. v0.7.0 added object-storage export/import and changed the license from AGPL to MPL-2.0.
$contains / $not_contains document filters.EmbeddingFunc support, and ingestion of existing vectors.BenchmarkCollection_Query on a Core i5-1135G7.A single-process Go application that needs RAG or semantic search over a corpus that fits in RAM and meets its latency target under exact scans.
You need a shared database service across replicas, approximate nearest-neighbor indexing, or a corpus that cannot fit comfortably in application memory.
Quick Start & Installation
import chromadb # setup Chroma in-memory, for easy prototyping. Can add persistence easily! client = chromadb.Client() # Create collection. get_collection, get_or_create_collection, delete_collection also available! collection = client.create_collection("all-my-documents") # Add docs to the collection. Can also update and delete. Row-based API coming soon! collection.add( documents=["This is document1", "This is document2"], # we handle tokenization, embedding, and indexing automatically. You can skip that and add your own embeddings as well metadatas=[{"source": "notion"}, {"source": "google-docs"}], # filter on these! ids=["doc1", "doc2"], # unique for each doc ) # Query/search 2 most similar results. You can also .get by id results = collection.query( query_texts=["This is a query document"], n_results=2, # where={"metadata_field": "is_equal_to_this"}, # opt
Comparison vs. Top RAG, Data & Memory Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| chromem-go ★ | 1.1k | +1 | Go | MPL-2.0 | In-process Go vector database for RAG without a separate database server |
| zvec | 16.3k | +29 | C++ | Apache-2.0 | In-process C++ vector database for local hybrid retrieval |
| txtai | 13.8k | +33 | Python | Apache-2.0 | A Python embeddings database for vector, SQL, and graph retrieval in self-hosted |
| LightRAG | 41k | +110 | Python | MIT | Graph-backed RAG for cross-document retrieval and multimodal indexing |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/philippgille/chromem-go.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about chromem-go
How do I integrate chromem-go into a Go RAG application?
chromem.NewDB(), and create a collection. Use AddDocuments to load content and Query to retrieve matches. Pass a custom EmbeddingFunc or supply existing document vectors if you want to manage embedding generation yourself. Your application passes the retrieved content to the LLM.Does it need a GPU, and how should I size the host?
Can I embed it in a proprietary product or self-host it?
When should I choose chromem-go over Pinecone or Chroma?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy