Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

add back dotdict for backcompat (#572)

Charles Packerb65980e2b3c6
diff --git a/memgpt/local_llm/utils.py b/memgpt/local_llm/utils.py
index 386bc63cb..e721b03a7 100644
--- a/memgpt/local_llm/utils.py
+++ b/memgpt/local_llm/utils.py
@@ -6,6 +6,24 @@ import memgpt.local_llm.llm_chat_completion_wrappers.dolphin as dolphin
import memgpt.local_llm.llm_chat_completion_wrappers.zephyr as zephyr
+# deprecated for Box
+class DotDict(dict):
+ """Allow dot access on properties similar to OpenAI response object"""
+
+ def __getattr__(self, attr):
+ return self.get(attr)
+
+ def __setattr__(self, key, value):
+ self[key] = value
+
+ # following methods necessary for pickling
+ def __getstate__(self):
+ return vars(self)
+
+ def __setstate__(self, state):
+ vars(self).update(state)
+
+
def load_grammar_file(grammar):
# Set grammar
grammar_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), "grammars", f"{grammar}.gbnf")