From f227d5adb19413526a77c9d75538c6530fc09a41 Mon Sep 17 00:00:00 2001 From: NeonN3mesis <129052650+NeonN3mesis@users.noreply.github.com> Date: Wed, 4 Oct 2023 00:16:08 -0400 Subject: [PATCH] Fixed stacking prompt instructions (#5520) fixed issue with prompt instruction stacking prompt instructions were stacking making the agent eventually return an error because the prompt was full of repeating instructions --- autogpts/autogpt/autogpt/agents/agent.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/autogpts/autogpt/autogpt/agents/agent.py b/autogpts/autogpt/autogpt/agents/agent.py index a7267959..05ce17f2 100644 --- a/autogpts/autogpt/autogpt/agents/agent.py +++ b/autogpts/autogpt/autogpt/agents/agent.py @@ -108,10 +108,12 @@ class Agent( def build_prompt( self, *args, - extra_messages: list[ChatMessage] = [], + extra_messages: [list[ChatMessage]] = None, include_os_info: Optional[bool] = None, **kwargs, ) -> ChatPrompt: + if extra_messages is None: + extra_messages = [] # Clock extra_messages.append( ChatMessage.system(f"The current time and date is {time.strftime('%c')}"),