From 2a1a6a98a5c0fb2903acc5e91ec71988c7090601 Mon Sep 17 00:00:00 2001 From: martin legrand Date: Sat, 15 Mar 2025 21:35:46 +0100 Subject: [PATCH 1/2] Fix : browser agent not giving search summary at the end --- sources/agents/browser_agent.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/sources/agents/browser_agent.py b/sources/agents/browser_agent.py index ebd50ba..f073ff8 100644 --- a/sources/agents/browser_agent.py +++ b/sources/agents/browser_agent.py @@ -68,12 +68,12 @@ class BrowserAgent(Agent): If no link seem appropriate, please say "GO_BACK". Remember, you seek the information the user want. The user query was : {user_prompt} - You must choose a link (write it down) to navigate to, go go back. - For exemple you can say: i want to go to www.events.org/events - Always end with a sentence that summarize useful information if any for exemple: + You must choose a link (write it down) to navigate to, or go back. + For exemple you can say: i want to go to www.wikipedia.org/cats + Always end with a sentence that summarize when useful information is found for exemple: Summary: According to https://karpathy.github.io/ LeCun net is the earliest real-world application of a neural net" - Another exemple: - Summary: the BBC website does not provide useful informations. + If a website does not have usefull information say Error, for exemple: + Error: This forum does not discus anything that can answer the user query Do not explain your choice, be short, concise. """ @@ -118,8 +118,17 @@ class BrowserAgent(Agent): def save_notes(self, text): lines = text.split('\n') for line in lines: - if "summary:" in line: + if "summary:" in line.lower(): self.notes.append(line) + + def conclude_prompt(self, user_query): + search_note = '\n -'.join(self.notes) + return f""" + Following a web search about: + {user_query} + Write a conclusion based on these notes: + {search_note} + """ def process(self, user_prompt, speech_module) -> str: complete = False @@ -155,7 +164,9 @@ class BrowserAgent(Agent): speech_module.speak(answer) self.browser.close() - print("Final notes:", notes) + prompt = self.conclude_prompt(user_prompt) + answer, reasoning = self.llm_request(prompt) + pretty_print(answer, color="output") return answer, reasoning if __name__ == "__main__": From 2fa57604174a3e74aa28f8c32e9d156f288fefbf Mon Sep 17 00:00:00 2001 From: martin legrand Date: Sat, 15 Mar 2025 21:43:16 +0100 Subject: [PATCH 2/2] navigation prompt small change --- sources/agents/browser_agent.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/agents/browser_agent.py b/sources/agents/browser_agent.py index f073ff8..710157c 100644 --- a/sources/agents/browser_agent.py +++ b/sources/agents/browser_agent.py @@ -72,6 +72,7 @@ class BrowserAgent(Agent): For exemple you can say: i want to go to www.wikipedia.org/cats Always end with a sentence that summarize when useful information is found for exemple: Summary: According to https://karpathy.github.io/ LeCun net is the earliest real-world application of a neural net" + Do not say "according to this page", always write down the whole link. If a website does not have usefull information say Error, for exemple: Error: This forum does not discus anything that can answer the user query Do not explain your choice, be short, concise.