-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(serialization: add
serializable_overrides
parameter to `to_dic…
…t/json` and `from_dict/json` methods Allows for users to override the serializable metadata for a class.
- Loading branch information
1 parent
88e0f28
commit 24450e9
Showing
3 changed files
with
48 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
from __future__ import annotations | ||
|
||
import json | ||
from typing import Optional | ||
|
||
from griptape.memory.meta import BaseMetaEntry | ||
|
||
|
||
class MockMetaEntry(BaseMetaEntry): | ||
def to_dict(self) -> dict: | ||
def to_json(self, *, serializable_overrides: Optional[dict[str, bool]] = None) -> str: | ||
return json.dumps(self.to_dict()) | ||
|
||
def to_dict(self, *, serializable_overrides: Optional[dict[str, bool]] = None) -> dict: | ||
return {"foo": "bar"} |