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
# Install LightRAG Server as a tool using uv (recommended)uv tool install "lightrag-hku[api]"# Or using pip inside a virtual environment# python -m venv .venv# source .venv/bin/activate # Windows: .venv\Scripts\activate# pip install "lightrag-hku[api]"# Get the configuration template and edit it (see "Minimum .env Changes" below)curl -O https://raw.githubusercontent.com/HKUDS/LightRAG/main/env.example
cp env.example .env
lightrag-server
chromem-go vs LightRAG 常见问题 (FAQ)
chromem-go 和 LightRAG 在开源协议与商用合规上有什么区别?
philippgille/chromem-go 采用 MPL-2.0 · 弱传染协议(文件级开源协议,允许作为独立库在商业闭源项目中链接调用。);HKUDS/LightRAG 采用 MIT · 允许商用(宽松开源协议,允许商业使用、修改与私有化闭源分发(保留版权声明即可)。)。
2026 年 chromem-go 与 LightRAG 哪个社区增长更快?
按 RepoForAI 实时快照,chromem-go 总 Star 1,077(7日 +1),LightRAG 总 Star 41,022(7日 +110),近期增速由 LightRAG 领先。
团队技术选型时该如何二选一?
适合选用 chromem-go(Go):单进程 Go 应用需要 RAG 或语义搜索,语料能装入内存,且精确扫描实测满足时延预算;适合选用 LightRAG(Python):为持续更新的内部知识库搭建检索 API,例如需要关联多份操作手册或研究资料,并在文档撤下后及时更新索引。