Fix : prevent asking for clarification multiple time + readme update
This commit is contained in:
@@ -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
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user