Fix : prevent asking for clarification multiple time + readme update

This commit is contained in:
martin legrand
2025-04-14 11:58:02 +02:00
parent 8da3d2b3f8
commit 454e68033c
3 changed files with 13 additions and 7 deletions
+1 -1
View File
@@ -341,7 +341,7 @@ class BrowserAgent(Agent):
complete = True
break
if link == None or Action.GO_BACK.value in answer or link in self.search_history:
if (link == None and not len(extracted_form)) or Action.GO_BACK.value in answer or link in self.search_history:
pretty_print(f"Going back to results. Still {len(unvisited)}", color="status")
unvisited = self.select_unvisited(search_result)
prompt = self.make_newsearch_prompt(user_prompt, unvisited)
+4 -1
View File
@@ -29,6 +29,7 @@ class AgentRouter:
self.complexity_classifier = self.load_llm_router()
self.learn_few_shots_tasks()
self.learn_few_shots_complexity()
self.asked_clarify = False
def load_pipelines(self) -> Dict[str, Type[pipeline]]:
"""
@@ -439,9 +440,11 @@ class AgentRouter:
text = self.lang_analysis.translate(text, lang)
labels = [agent.role for agent in self.agents]
complexity = self.estimate_complexity(text)
if complexity == None:
if complexity == None and self.asked_clarify == False:
self.asked_clarify = True
pretty_print(f"Humm, the task seem complex but you gave very little information. can you clarify?", color="info")
return None
self.asked_clarify = False
if complexity == "HIGH":
pretty_print(f"Complex task detected, routing to planner agent.", color="info")
return self.find_planner_agent()