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
pull/5521/head
NeonN3mesis 2023-10-04 00:16:08 -04:00 committed by GitHub
parent f81b466c9a
commit f227d5adb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -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')}"),