forked from phoenix/litellm-mirror
use model access groups for teams
This commit is contained in:
parent
d9c91838ce
commit
08db691dec
3 changed files with 64 additions and 6 deletions
|
@ -421,6 +421,7 @@ class Router:
|
|||
routing_strategy=routing_strategy,
|
||||
routing_strategy_args=routing_strategy_args,
|
||||
)
|
||||
self.access_groups = None
|
||||
## USAGE TRACKING ##
|
||||
if isinstance(litellm._async_success_callback, list):
|
||||
litellm._async_success_callback.append(self.deployment_callback_on_success)
|
||||
|
@ -4116,6 +4117,22 @@ class Router:
|
|||
return self.model_list
|
||||
return None
|
||||
|
||||
def get_model_access_groups(self):
|
||||
from collections import defaultdict
|
||||
|
||||
access_groups = defaultdict(list)
|
||||
if self.access_groups:
|
||||
return self.access_groups
|
||||
|
||||
if self.model_list:
|
||||
for m in self.model_list:
|
||||
for group in m.get("model_info", {}).get("access_groups", []):
|
||||
model_name = m["model_name"]
|
||||
access_groups[group].append(model_name)
|
||||
# set access groups
|
||||
self.access_groups = access_groups
|
||||
return access_groups
|
||||
|
||||
def get_settings(self):
|
||||
"""
|
||||
Get router settings method, returns a dictionary of the settings and their values.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue