Chroma
一、项目简介
Chroma 是一个为 AI 应用而生的轻量向量数据库。它主打「嵌入式优先、API 极简」,几行代码就能把文本转成向量并做相似度检索,与 LangChain、LlamaIndex 等框架深度集成,是原型开发和小规模 RAG 的首选。
二、核心特性
- 简单易用:pip 安装即可,无需单独部署服务(也可 C/S 模式);
- 自动向量化:内置 Embedding 模型,也可接入自定义;
- 元数据过滤:支持按标签/条件过滤检索;
- 框架集成:LangChain / LlamaIndex 官方支持;
- 持久化:支持落盘与内存模式。
三、适用场景
- RAG 原型验证与本地知识库;
- 小规模语义搜索;
- 教学与 Demo 演示。
四、快速上手
pip install chromadb
import chromadb
client = chromadb.Client()
col = client.create_collection("demo")
col.add(documents=["向量数据库入门"], ids=["1"])
print(col.query(query_texts=["数据库"], n_results=1))
五、注意事项
- 大规模、分布式、生产级场景建议选 Milvus / Qdrant;
- 默认 Embedding 对中文效果一般,中文场景可换 BGE/GTE。