feat: rag
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
# 持久化存储
|
||||
|
||||
import chromadb
|
||||
|
||||
# 持久化客户端
|
||||
# path指定数据存储的路径
|
||||
# 如果目录不存在,Chromadb会自动创建
|
||||
persistent_client = chromadb.PersistentClient(path="./chromadb_store")
|
||||
|
||||
|
||||
# 创建一个集合(类似创建一个表)
|
||||
collection = persistent_client.create_collection(
|
||||
name="notes", metadata={"description": "笔记集合"} # 集合名称 # 集合元数据
|
||||
)
|
||||
|
||||
# 列出所有集合,确认创建成功
|
||||
# list_collections() 返回所有集合的列表
|
||||
collections = persistent_client.list_collections()
|
||||
print(collections)
|
||||
|
||||
for col in collections:
|
||||
print(f"-{col.name}")
|
||||
Reference in New Issue
Block a user