mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-28 09:38:17 +00:00
add clear
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
from crewai.utilities.file_handler import PickleHandler
|
from crewai.utilities.file_handler import PickleHandler
|
||||||
|
|
||||||
|
|
||||||
@@ -29,3 +31,10 @@ class CrewTrainingHandler(PickleHandler):
|
|||||||
data[agent_id] = {train_iteration: new_data}
|
data[agent_id] = {train_iteration: new_data}
|
||||||
|
|
||||||
self.save(data)
|
self.save(data)
|
||||||
|
|
||||||
|
def clear(self) -> None:
|
||||||
|
"""Clear the training data by removing the file or resetting its contents."""
|
||||||
|
if os.path.exists(self.file_path):
|
||||||
|
with open(self.file_path, "wb") as file:
|
||||||
|
# Overwrite with an empty dictionary
|
||||||
|
self.save({})
|
||||||
|
|||||||
Reference in New Issue
Block a user