chromem-go
Embeddable vector database for Go with Chroma-like interface and zero third-party dependencies.
Overview
chromem-go is an embeddable vector database designed for simplicity, performance, and ease of integration into Go applications without relying on external databases. It supports in-memory operations with optional persistence capabilities, catering to common use cases such as retrieval augmented generation (RAG), question answering, text search, recommendation systems, classification, and clustering.
Capability facts
No sourced capability facts yet. Facts appear after ingest scans repo manifests (Dockerfile, package.json, MCP configs).
Categories
Tags
README
chromem-go
Embeddable vector database for Go with Chroma-like interface and zero third-party dependencies. In-memory with optional persistence.
Because chromem-go is embeddable it enables you to add retrieval augmented generation (RAG) and similar embeddings-based features into your Go app without having to run a separate database. Like when using SQLite instead of PostgreSQL/MySQL/etc.
It's not a library to connect to Chroma and also not a reimplementation of it in Go. It's a database on its own.
The focus is not scale (millions of documents) or number of features, but simplicity and performance for the most common use cases. On a mid-range 2020 Intel laptop CPU you can query 1,000 documents in 0.3 ms and 100,000 documents in 40 ms, with very few and small memory allocations. See Benchmarks for details.
⚠️ The project is in beta, under heavy construction, and may introduce breaking changes in releases before
v1.0.0. All changes are documented in theCHANGELOG.
Contents
- Use cases
- Interface
- Features + Roadmap
- Installation
- Usage
- Benchmarks
- Development
- Motivation
- Related projects
Use cases
With a vector database you can do various things:
- Retrieval augmented generation (RAG), question answering (Q&A)
- Text and code search
- Recommendation systems
- Classification
- Clustering
Let's look at the RAG use case in more detail:
RAG
The knowledge of large language models (LLMs) - even the ones with 30 billion, 70 billion parameters and more - is limited. They don't know anything about what happened after their training ended, they don't know anything about data they were not trained with (like your company's intranet, Jira / bug tracker, wiki or other kinds of knowledge bases), and even the data they do know they often can't reproduce it exactly, but start to hallucinate instead.
Fine-tuning an LLM can help a bit, but it's more meant to improve the LLMs reasoning about specific topics, or reproduce the style of written text or code. Fine-tuning does not add knowledge 1:1 into the model. Details are lost or mixed up. And knowledge cutoff (about anything that happened after the fine-tuning) isn't solved either.
=> A vector database can act as the up-to-date, precise knowledge for LLMs:
- You store relevant documents that you want the LLM to know in the database.
- The database stores the embeddings alongside the documents, which you can either provide or can be created by specific "embedding models" like OpenAI's
text-embedding-3-small.chromem-gocan do this for you and supports multiple embedding providers and models out-of-the-box.
- Later, when you want to talk to the LLM, you first send the question to the vector DB to find similar/related content. This is called "nearest neighbor search".
- In the question to the LLM, you provide this content alongside your question.
- The LLM can take this up-to-date precise content into account when answering.
Check out the example code to see it in action!
Interface
Our original inspiration was the Chroma interface, whose core API is the following (taken from their README):
Chroma core interface
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 automatic