diff --git a/ex_app/lib/agent.py b/ex_app/lib/agent.py index 4e897d1..9e4d158 100644 --- a/ex_app/lib/agent.py +++ b/ex_app/lib/agent.py @@ -85,6 +85,9 @@ async def call_model( system_prompt_text += "Use the find_person_in_contacts tool to find a person's email address and location.\n" if tool_enabled("find_details_of_current_user"): system_prompt_text += "Use the find_details_of_current_user tool to find the current user's location.\n" + + if task['input'].get('memories', None) is not None: + system_prompt_text += "You can remember things from other conversations with the user. If relevant, take into account the following memories:\n\n" + "\n".join(task['input']['memories']) + "\n\n" # this is similar to customizing the create_react_agent with state_modifier, but is a lot more flexible system_prompt = SystemMessage( system_prompt_text.replace("{CURRENT_DATE}", current_date) diff --git a/ex_app/lib/main.py b/ex_app/lib/main.py index 85a9625..aac0f75 100644 --- a/ex_app/lib/main.py +++ b/ex_app/lib/main.py @@ -159,7 +159,7 @@ async def background_thread_task(): task = response["task"] log(nc, LogLvl.INFO, 'New Task incoming') log(nc, LogLvl.DEBUG, str(task)) - log(nc, LogLvl.INFO, str({'input': task['input']['input'], 'confirmation': task['input']['confirmation'], 'conversation_token': ''})) + log(nc, LogLvl.INFO, str({'input': task['input']['input'], 'confirmation': task['input']['confirmation'], 'conversation_token': '', 'memories': task['input'].get('memories', None)})) asyncio.create_task(handle_task(task, nc)) diff --git a/ex_app/lib/provider.py b/ex_app/lib/provider.py index a793de3..1a502c4 100644 --- a/ex_app/lib/provider.py +++ b/ex_app/lib/provider.py @@ -14,5 +14,12 @@ description="Used tools", shape_type=ShapeType.LIST_OF_TEXTS ) + ], + optional_input_shape= [ + ShapeDescriptor( + name="memories", + description="Injected memories", + shape_type=ShapeType.LIST_OF_TEXTS + ) ] ) \ No newline at end of file