feat : task complexity routing

This commit is contained in:
martin legrand
2025-03-26 10:54:25 +01:00
parent 32bc096d9a
commit 757a9b1e3e
3 changed files with 136 additions and 20 deletions
+4
View File
@@ -210,6 +210,7 @@ class BrowserAgent(Agent):
You: "search: Recent space missions news, {self.date}"
Do not explain, do not write anything beside the search query.
If the query does not make any sense for a web search explain why and say REQUEST_EXIT
"""
def process(self, user_prompt, speech_module) -> str:
@@ -218,6 +219,9 @@ class BrowserAgent(Agent):
animate_thinking(f"Thinking...", color="status")
self.memory.push('user', self.search_prompt(user_prompt))
ai_prompt, _ = self.llm_request()
if "REQUEST_EXIT" in ai_prompt:
# request make no sense, maybe wrong agent was allocated?
return ai_prompt, ""
animate_thinking(f"Searching...", color="status")
search_result_raw = self.tools["web_search"].execute([ai_prompt], False)
search_result = self.jsonify_search_results(search_result_raw)[:7] # until futher improvement