Spaces:
Sleeping
Sleeping
Update ragagent.py
Browse files- ragagent.py +5 -2
ragagent.py
CHANGED
@@ -113,12 +113,15 @@ class RAGAgent():
|
|
113 |
'''
|
114 |
|
115 |
persistent_client = chromadb.PersistentClient()
|
116 |
-
|
|
|
|
|
|
|
117 |
|
118 |
# Add to vectorDB
|
119 |
vectorstore = Chroma(
|
120 |
client=persistent_client,
|
121 |
-
collection_name=
|
122 |
embedding_function=embedding_function,
|
123 |
)
|
124 |
|
|
|
113 |
'''
|
114 |
|
115 |
persistent_client = chromadb.PersistentClient()
|
116 |
+
if collection_name in [c.name for c in persistent_client.list_collections()]:
|
117 |
+
persistent_client.delete_collection(collection_name)
|
118 |
+
|
119 |
+
collection = persistent_client.create_collection(collection_name)
|
120 |
|
121 |
# Add to vectorDB
|
122 |
vectorstore = Chroma(
|
123 |
client=persistent_client,
|
124 |
+
collection_name=collection_name,
|
125 |
embedding_function=embedding_function,
|
126 |
)
|
127 |
|