Skip to content

Commit

Permalink
feat(bridge/python): memory write method
Browse files Browse the repository at this point in the history
  • Loading branch information
louistiti committed May 23, 2023
1 parent 7fd4be1 commit 51f57e3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bridges/python/src/sdk/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,16 @@ def read(self):
except Exception as e:
print(f'Error while reading memory for "{self.name}": {e}')
raise e

def write(self, memory):
if self.default_memory and self.memory_path:
try:
with open(self.memory_path, 'w') as f:
json.dump(memory, f, indent=2)

return memory
except Exception as e:
print(f'Error while writing memory for "{self.name}": {e}')
raise e
else:
raise ValueError(f'You cannot write into the memory "{self.name}" as it belongs to another skill')

0 comments on commit 51f57e3

Please sign in to comment.