Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import asyncio
from helpers.extension import Extension
from agent import LoopData
from plugins._memory.extensions.python.message_loop_prompts_after._50_recall_memories import DATA_NAME_TASK as DATA_NAME_TASK_MEMORIES, DATA_NAME_ITER as DATA_NAME_ITER_MEMORIES
Expand Down Expand Up @@ -26,5 +27,25 @@ async def execute(self, loop_data: LoopData = LoopData(), **kwargs):
loop_data.extras_temporary["memory_recall_delayed"] = delay_text
return

# otherwise await the task
await task
# otherwise await the task with error handling
try:
await task
except asyncio.TimeoutError:
self.agent.context.log.log(
type="warning",
heading="Memory recall timed out",
content="The memory search took too long and was cancelled. Continuing without memory context.",
)
except asyncio.CancelledError:
self.agent.context.log.log(
type="warning",
heading="Memory recall cancelled",
content="The memory search was cancelled. Continuing without memory context.",
)
except Exception as e:
from helpers import errors
self.agent.context.log.log(
type="warning",
heading="Memory recall error",
content=errors.format_error(e),
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
from helpers import errors, plugins
from helpers.extension import Extension
from litellm.exceptions import AuthenticationError
from helpers.dirty_json import DirtyJson
from agent import LoopData
from helpers.log import LogItem
Expand Down Expand Up @@ -80,6 +81,13 @@ async def memorize(self, loop_data: LoopData, log_item: LogItem, **kwargs):

try:
memories = DirtyJson.parse_string(memories_json)
except AuthenticationError as e:
if "nvapi-" in str(e):
log_item.update(heading="SKIPPED: Invalid API Key")
log_item.update(content="Memorization skipped due to configuration error.")
return
else:
raise
except Exception as e:
log_item.update(heading=f"Failed to parse memories response: {str(e)}")
return
Expand Down