[Feature] add app.delete() method (#1187)

Co-authored-by: Deven Patel <deven298@yahoo.com>
This commit is contained in:
Deven Patel
2024-01-23 14:27:30 +05:30
committed by GitHub
parent 2d9fbd4e49
commit b7d365119c
3 changed files with 48 additions and 2 deletions

View File

@@ -674,3 +674,15 @@ class EmbedChain(JSONSerializable):
def delete_all_chat_history(self, app_id: str):
self.llm.memory.delete(app_id=app_id)
self.llm.update_history(app_id=app_id)
def delete(self, source_id: str):
"""
Deletes the data from the database.
:param source_hash: The hash of the source.
:type source_hash: str
"""
self.db.delete(where={"hash": source_id})
logging.info(f"Successfully deleted {source_id}")
# Send anonymous telemetry
if self.config.collect_metrics:
self.telemetry.capture(event_name="delete", properties=self._telemetry_props)

View File

@@ -75,3 +75,8 @@ class BaseVectorDB(JSONSerializable):
:type name: str
"""
raise NotImplementedError
def delete(self):
"""Delete from database."""
raise NotImplementedError