戳戳猫的小窝
更新日志
关于
常用的向量数据库有Chroma、Qdrant、Milvus、Pinecone、Weaviate和Faiss等等。 我们选择使用Qdrant,因为它安装方便,且支持多种编程语言。 ## 1 下载数据库 github官方库:[qdrant/qdrant: Qdrant - High-performance, massive-scale Vector Database and Vector Search Engine for the next generation of AI. Also available in the cloud https://cloud.qdrant.io/](https://github.com/qdrant/qdrant) 夸克网盘链接:https://pan.quark.cn/s/1925c4864e01 蓝奏云链接:https://nyazira.lanzouo.com/ijni02sumo3a ## 2 运行数据库 解压后双击qdrant.exe,即可启动数据库。 访问http://localhost:6333/dashboard即可通过UI查看数据库。 ## 3 创建数据库 ```python from qdrant_client import QdrantClient from qdrant_client.models import Distance, VectorParams client = QdrantClient(host="127.0.0.1", port=6333) client.create_collection( collection_name="test_collection", vectors_config=VectorParams(size=1024, distance=Distance.COSINE), ) ``` 通过以上代码,我们可以在qdrant中创建一个名为“test_collection”的数据库集合,该集合能存储1024维的向量,通过余弦计算向量的距离。
向量数据库安装