feat: collection name everywhere (#310)

Co-authored-by: cachho <admin@ch-webdev.com>
This commit is contained in:
Jonas
2023-08-09 03:38:35 -04:00
committed by GitHub
parent 1ee1e671d1
commit eeac84e2d9
10 changed files with 222 additions and 15 deletions

View File

@@ -32,7 +32,7 @@ class EmbedChain:
self.config = config
self.db_client = self.config.db.client
self.collection = self.config.db.collection
self.collection = self.config.db._get_or_create_collection(self.config.collection_name)
self.user_asks = []
self.is_docs_site_instance = False
self.online = False
@@ -325,6 +325,14 @@ class EmbedChain:
memory.chat_memory.add_ai_message(streamed_answer)
logging.info(f"Answer: {streamed_answer}")
def set_collection(self, collection_name):
"""
Set the collection to use.
:param collection_name: The name of the collection to use.
"""
self.collection = self.config.db._get_or_create_collection(collection_name)
def count(self):
"""
Count the number of embeddings.