From bd209045c49fe2066d4dd60d3776e967864b239c Mon Sep 17 00:00:00 2001 From: Evan Wheeler Date: Mon, 25 Nov 2024 14:03:18 +0300 Subject: [PATCH] also retry aux_act_once upon TypeError --- tinytroupe/agent.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tinytroupe/agent.py b/tinytroupe/agent.py index a18598d..69035dd 100644 --- a/tinytroupe/agent.py +++ b/tinytroupe/agent.py @@ -422,7 +422,8 @@ def act( # Aux function to perform exactly one action. # Occasionally, the model will return JSON missing important keys, so we just ask it to try again - @repeat_on_error(retries=5, exceptions=[KeyError]) + # Sometimes `content` contains EpisodicMemory's MEMORY_BLOCK_OMISSION_INFO message, which raises a TypeError on line 443 + @repeat_on_error(retries=5, exceptions=[KeyError, TypeError]) def aux_act_once(): # A quick thought before the action. This seems to help with better model responses, perhaps because # it interleaves user with assistant messages.