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.

fix: fix function imports (#1710)

Sarah Woodersfcb12e695c93
diff --git a/memgpt/functions/function_sets/base.py b/memgpt/functions/function_sets/base.py
index c44da3246..f29653a3d 100644
--- a/memgpt/functions/function_sets/base.py
+++ b/memgpt/functions/function_sets/base.py
@@ -1,10 +1,10 @@
-import datetime
-import math
from typing import Optional
from memgpt.agent import Agent
-from memgpt.constants import MAX_PAUSE_HEARTBEATS, RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
-from memgpt.utils import json_dumps
+from memgpt.constants import MAX_PAUSE_HEARTBEATS
+
+# import math
+# from memgpt.utils import json_dumps
### Functions / tools the agent can use
# All functions should return a response string (or None)
@@ -39,6 +39,10 @@ Returns:
def pause_heartbeats(self: Agent, minutes: int) -> Optional[str]:
+ import datetime
+
+ from memgpt.constants import MAX_PAUSE_HEARTBEATS
+
minutes = min(MAX_PAUSE_HEARTBEATS, minutes)
# Record the current time
@@ -63,6 +67,12 @@ def conversation_search(self: Agent, query: str, page: Optional[int] = 0) -> Opt
Returns:
str: Query result string
"""
+
+ import math
+
+ from memgpt.constants import RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
+ from memgpt.utils import json_dumps
+
if page is None or (isinstance(page, str) and page.lower().strip() == "none"):
page = 0
try:
@@ -93,6 +103,11 @@ def conversation_search_date(self: Agent, start_date: str, end_date: str, page:
Returns:
str: Query result string
"""
+ import math
+
+ from memgpt.constants import RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
+ from memgpt.utils import json_dumps
+
if page is None or (isinstance(page, str) and page.lower().strip() == "none"):
page = 0
try:
@@ -136,6 +151,11 @@ def archival_memory_search(self: Agent, query: str, page: Optional[int] = 0) ->
Returns:
str: Query result string
"""
+ import math
+
+ from memgpt.constants import RETRIEVAL_QUERY_DEFAULT_PAGE_SIZE
+ from memgpt.utils import json_dumps
+
if page is None or (isinstance(page, str) and page.lower().strip() == "none"):
page = 0
try: