fehmikaya commited on
Commit
efa3471
·
verified ·
1 Parent(s): e192f86

Update ragagent.py

Browse files
Files changed (1) hide show
  1. ragagent.py +5 -2
ragagent.py CHANGED
@@ -113,12 +113,15 @@ class RAGAgent():
113
  '''
114
 
115
  persistent_client = chromadb.PersistentClient()
116
- collection = persistent_client.get_or_create_collection("collection_name")
 
 
 
117
 
118
  # Add to vectorDB
119
  vectorstore = Chroma(
120
  client=persistent_client,
121
- collection_name="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