前言
当今科技领域的发展日新月异,向量数据库成为了热门的话题之一。
这些数据库以其高效的向量检索和相似度搜索功能,为各种应用场景提供了强大的支持。
本文旨在汇总向量数据库
Milvus、Zilliz、Faiss、Qdrant、LlamaIndex、Chroma、LanceDB、Pinecone、Weaviate、
基本介绍
1. Milvus
Milvus是一个开源的向量相似度搜索引擎,由Zilliz团队开发。它提供了高性能的向量检索和相似度搜索功能,支持海量数据的快速查询。Milvus支持多种向量类型和距离度量方法,并提供了易于使用的API和丰富的功能,使得开发者可以轻松构建各种应用,如图像搜索、推荐系统和自然语言处理。
2. Zilliz:
Zilliz是一家专注于大规模向量数据分析的公司,他们开发了多个与向量相关的开源项目,其中包括Milvus和Chroma。Zilliz致力于提供高效的向量数据处理和分析解决方案,帮助用户在海量数据中进行快速的相似度搜索和数据分析。
3. Faiss:
Faiss是Facebook AI Research开发的一个高性能向量相似度搜索库。它支持多种向量索引结构和距离度量方法,并提供了高效的搜索算法,能够在大规模数据集上进行快速的相似度搜索。Faiss被广泛应用于图像识别、语音识别和自然语言处理等领域。
4. Qdrant:
Qdrant是一个开源的向量搜索引擎,由Qdrant团队开发。它提供了高性能的向量检索和相似度搜索功能,支持多种向量类型和距离度量方法。Qdrant还提供了丰富的查询语法和灵活的配置选项,使得用户可以根据自己的需求进行定制化的搜索。
Qdrant 因其易用性和用户友好的开发者文档,面世不久即获得关注。
Qdrant 以 Rust 语言构建,提供 Rust、Python、Golang 等客户端 API,能够满足当今主流开发人员的需求。
不过, Qdrant 作为后起之秀,和其他竞品仍然存在一定差距,例如界面及查询功能不够完善。
5. LlamaIndex:
LlamaIndex是一个基于向量的数据库引擎,由Llama Labs开发。它提供了高效的向量存储和检索功能,支持多种向量类型和距离度量方法。LlamaIndex还提供了易于使用的API和丰富的功能,使得开发者可以快速构建各种应用,如推荐系统、广告投放和智能搜索。
6. Chroma:
Chroma是Zilliz团队开发的一个开源的向量数据管理系统。它提供了高效的向量存储和查询功能,支持多种向量类型和距离度量方法。Chroma还提供了可扩展的架构和分布式计算能力,能够处理大规模的向量数据集。
Qdrant Cloud VS Zilliz Cloud
–这两个都是云服务,不同点在于
Qdrant 更适合追求低成本基础设施维护的开发人员。
而如果应用系统更注重性能和可扩展性,Zilliz Cloud/Milvus 是更合适的选择。因为 Zilliz Cloud/Milvus 具备可扩展性极强、性能更佳、延时更低的特点,适用于对性能指标有着严格要求的场景。
每秒查询次数(QPS)
测试结果显示,在 10,000,000 条 768 维的向量数据中进行检索时,Zilliz Cloud 两款实例的 QPS 分别是 Qdrant Cloud 实例的 7 倍和 1 倍。
具体见参考资料
Qdrant 用法
架构
同其他数据库一样,支持本地和服务器部署
docker 部署
提取预构建的 Docker 映像并运行容器:
-d 后台启动服务后
即可访问 http://10.0.180.16:7541/dashboard
安装包
pip install qdrant-client pymilvus
langchain demo
包括 本地 和 url 用法,下面的代码是将 文本 转换成向量 并存储到数据库
读取已存储的数据
加上 filter 过滤
View Code
纯 python 代码
FAISS 用法
Faiss是一个高效地稠密向量相似检索和聚类的工具包,
由Facebook开发,由C++编写,并且提供了python2和python3的封装。
安装
用法
- xb 对于数据库,它包含所有必须编入索引的向量,并且我们将搜索它。它的大小是nb-by-d
- xq对于查询向量,我们需要找到最近的邻居。它的大小是nq-by-d。如果我们只有一个查询向量,则nq = 1
Chroma 用法
非 langchain 用法
langchain 统一用法
暂未验证