当前位置:   article > 正文

chroma 向量库使用;查询、更新与插入_chroma如何更新库

chroma如何更新库

参考:
https://docs.trychroma.com/usage-guide
https://blog.csdn.net/weixin_46515328/article/details/131855650

chroma 支持保存文档、向量,和向量的ids值
##安装
pip install chromadb
  • 1
  • 2

1、使用

import chromadb

##这句可以数据库默认时刻保存,启动自动加载
chroma_client = chromadb.PersistentClient(path=".")
# chroma_client = chromadb.Client()

#创建Chroma数据集
collection = chroma_client.create_collection(name="my_collection2")

# 插入向量:
collection.add(
    embeddings=[[1.2, 2.3, 4.5], [6.7, 8.2, 9.2]],
    # documents=["This is a document", "This is another document"],
    metadatas=[{"source": "my_source"}, {"source": "my_source"}],
    ids=["id3", "id5"]
)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16

修改距离:
参考:https://github.com/nmslib/hnswlib/tree/master#python-bindings

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Guff_9hys/article/detail/775591
推荐阅读
相关标签
  

闽ICP备14008679号