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
+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()