如何查看LangChain中VectorStore内的文档/嵌入数量?
查看Chroma向量存储中的文档/嵌入数量
你可以通过以下两种方式查看数量:
直接获取嵌入(或文档)总数:调用Chroma底层集合的
count()方法doc_count = vectorstore._collection.count() print(f"文档/嵌入数量:{doc_count}")注:通过
from_documents创建的向量存储中,每个文档对应一个嵌入,所以这个数值同时代表文档数和嵌入数。通过获取所有文档列表统计长度:
doc_list = vectorstore.get()['documents'] print(f"文档数量:{len(doc_list)}")
内容的提问来源于stack exchange,提问作者information_interchange
相关产品推荐
相关产品推荐

