@@ -26,11 +26,6 @@ def router_types_list(self) -> list[str]:
2626 ]
2727 )
2828
29- @rx .var
30- def router_load_balancing_strategies_list (self ) -> list [str ]:
31- """Get list of router load balancing strategies."""
32- return ["Shuffle" , "Least busy" ]
33-
3429 ############################################################
3530 # Load entities
3631 ############################################################
@@ -40,17 +35,13 @@ def router_load_balancing_strategies_list(self) -> list[str]:
4035 def _format_router (self , router : dict ) -> Router :
4136 """Format router."""
4237
43- _load_balancing_strategy_converter = {
44- "shuffle" : "Shuffle" ,
45- "least_busy" : "Least busy" ,
46- }
4738 return Router (
4839 id = router ["id" ],
4940 name = router ["name" ],
5041 user = self .router_owners [router ["user_id" ]],
5142 type = router ["type" ],
5243 aliases = "," .join (router ["aliases" ]) if router ["aliases" ] else "" ,
53- load_balancing_strategy = _load_balancing_strategy_converter . get ( router ["load_balancing_strategy" ]) ,
44+ load_balancing_strategy = router ["load_balancing_strategy" ],
5445 max_context_length = router ["max_context_length" ],
5546 vector_size = router ["vector_size" ],
5647 cost_prompt_tokens = router ["cost_prompt_tokens" ],
@@ -182,7 +173,7 @@ async def delete_entity(self):
182173 ############################################################
183174 entity_to_create : Router = Router (
184175 type = "text-generation" ,
185- load_balancing_strategy = "Shuffle " ,
176+ load_balancing_strategy = "shuffle " ,
186177 cost_prompt_tokens = 0.0 ,
187178 cost_completion_tokens = 0.0 ,
188179 )
@@ -205,12 +196,10 @@ async def create_entity(self):
205196 self .create_entity_loading = True
206197 yield
207198
208- new_router_load_balancing_strategy = self .entity_to_create .load_balancing_strategy .lower ().replace (" " , "_" )
209-
210199 payload = {
211200 "name" : self .entity_to_create .name ,
212201 "type" : self .entity_to_create .type ,
213- "load_balancing_strategy" : new_router_load_balancing_strategy ,
202+ "load_balancing_strategy" : self . entity_to_create . load_balancing_strategy ,
214203 "cost_prompt_tokens" : self .entity_to_create .cost_prompt_tokens ,
215204 "cost_completion_tokens" : self .entity_to_create .cost_completion_tokens ,
216205 }
@@ -276,13 +265,12 @@ async def edit_entity(self):
276265 yield
277266
278267 router_aliases = [alias .strip () for alias in self .entity .aliases .split ("," ) if alias .strip ()]
279- router_load_balancing_strategy = self .entity .load_balancing_strategy .lower ().replace (" " , "_" )
280268
281269 payload = {
282270 "name" : self .entity .name ,
283271 "type" : self .entity .type ,
284272 "aliases" : router_aliases ,
285- "load_balancing_strategy" : router_load_balancing_strategy ,
273+ "load_balancing_strategy" : self . entity . load_balancing_strategy ,
286274 "cost_prompt_tokens" : self .entity .cost_prompt_tokens ,
287275 "cost_completion_tokens" : self .entity .cost_completion_tokens ,
288276 }
0 commit comments