From 6cb06fab9d929d515f5892dc2ad9ad490a4a8dec Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 10 Jul 2025 10:50:45 +0200 Subject: [PATCH 1/3] fix(agent): Update system prompt Signed-off-by: Marcel Klehr --- ex_app/lib/agent.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ex_app/lib/agent.py b/ex_app/lib/agent.py index 5b0748f..72d54cd 100644 --- a/ex_app/lib/agent.py +++ b/ex_app/lib/agent.py @@ -62,10 +62,11 @@ def call_model( # this is similar to customizing the create_react_agent with state_modifier, but is a lot more flexible system_prompt = SystemMessage( """ -You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools! If you used a tool, you still need to convey its output to the user. +You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools if necessary. If you used a tool, you still need to convey its output to the user. Use the same language for your answers as the user used in their message. Today is {CURRENT_DATE}. -Detect the language the user is using. Reply in the detected language. Do not output the detected language. +Intuit the language the user is using (there is not tool for this, you will need to guess). Reply in the language intuited. Do not output the language you intuited. +Only use tools if you cannot answer the user without them. Only use the duckduckgo_results_json tool if the user explicitly asks for a web search. You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found. You can check which calendars exist using the list_calendars tool, if a calendar can not be found. @@ -122,4 +123,4 @@ def call_model( 'actions': actions, 'conversation_token': export_conversation(checkpointer), 'sources': source_list, - } \ No newline at end of file + } From 68b6ba23e08b8d67370ecac5e2a8019c111b19a3 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 10 Jul 2025 10:51:54 +0200 Subject: [PATCH 2/3] fix typo Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcel Klehr --- ex_app/lib/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ex_app/lib/agent.py b/ex_app/lib/agent.py index 72d54cd..e878191 100644 --- a/ex_app/lib/agent.py +++ b/ex_app/lib/agent.py @@ -65,7 +65,7 @@ def call_model( You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools if necessary. If you used a tool, you still need to convey its output to the user. Use the same language for your answers as the user used in their message. Today is {CURRENT_DATE}. -Intuit the language the user is using (there is not tool for this, you will need to guess). Reply in the language intuited. Do not output the language you intuited. +Intuit the language the user is using (there is no tool for this, you will need to guess). Reply in the language intuited. Do not output the language you intuited. Only use tools if you cannot answer the user without them. Only use the duckduckgo_results_json tool if the user explicitly asks for a web search. You can check which conversations exist using the list_talk_conversations tool, if a conversation cannot be found. From f7a8b6d50d88accc521cfb7137faff34fa942ef9 Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Fri, 18 Jul 2025 14:41:47 +0200 Subject: [PATCH 3/3] Apply suggestion from @janepie Co-authored-by: janepie <49834966+janepie@users.noreply.github.com> Signed-off-by: Marcel Klehr --- ex_app/lib/agent.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ex_app/lib/agent.py b/ex_app/lib/agent.py index e878191..a190ba0 100644 --- a/ex_app/lib/agent.py +++ b/ex_app/lib/agent.py @@ -62,7 +62,7 @@ def call_model( # this is similar to customizing the create_react_agent with state_modifier, but is a lot more flexible system_prompt = SystemMessage( """ -You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools if necessary. If you used a tool, you still need to convey its output to the user. +You are a helpful AI assistant with access to tools, please respond to the user's query to the best of your ability, using the provided tools if necessary. If no tool is needed to provide a correct answer, do not use one. If you used a tool, you still need to convey its output to the user. Use the same language for your answers as the user used in their message. Today is {CURRENT_DATE}. Intuit the language the user is using (there is no tool for this, you will need to guess). Reply in the language intuited. Do not output the language you intuited.