class ComplexityRouter: def __init__(self, tools: list[FunctionTool]): self.tools = tools def route(self, query: str) -> list[FunctionTool]: # Heuristique simple : route selon mots-clés if any(word in query.lower() for word in ["moyenne", "écart", "tendance"]): return [t for t in self.tools if getattr(t, "complexity", None) == "tool"] elif any(word in query.lower() for word in ["tva", "prix", "ht", "ttc"]): return [t for t in self.tools if getattr(t, "complexity", None) == "simple"] elif any(word in query.lower() for word in ["croiser", "relier", "jointure"]): return [t for t in self.tools if getattr(t, "complexity", None) == "react"] else: # Fallback : tout proposer return self.tools