From 6cb48dd4d388d36c82e4090e6a203bbce3eeafa4 Mon Sep 17 00:00:00 2001 From: Siraj R Aizlewood <siraj@aurelio.ai> Date: Sun, 29 Sep 2024 22:22:00 +0400 Subject: [PATCH] Update layer.py After a discussion with James we decided to just alter the existing update function. --- semantic_router/layer.py | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/semantic_router/layer.py b/semantic_router/layer.py index 6c9950ff..4512207f 100644 --- a/semantic_router/layer.py +++ b/semantic_router/layer.py @@ -177,7 +177,7 @@ class RouteLayer: index: BaseIndex def __init__( - self, + self encoder: Optional[BaseEncoder] = None, llm: Optional[BaseLLM] = None, routes: Optional[List[Route]] = None, @@ -832,22 +832,6 @@ class RouteLayer: def _get_route_names(self) -> List[str]: return [route.name for route in self.routes] - - def update_route_thresholds(self, threshold_dict: Dict[str, float]): - """ - Update thresholds for specified routes. - - :param threshold_dict: A dictionary mapping route names to new threshold values. - :type threshold_dict: Dict[str, float] - """ - for route_name, new_threshold in threshold_dict.items(): - route = self.get(route_name) - if route: - old_threshold = route.score_threshold - route.score_threshold = new_threshold - logger.info(f"Updated threshold for route '{route_name}' from {old_threshold} to {new_threshold}") - else: - logger.warning(f"Route '{route_name}' not found. Skipping threshold update.") def threshold_random_search( -- GitLab