mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
Merge pull request #25746 from BerriAI/litellm_vector-store-team-byok-model-none
fix(router): restore BYOK key injection for vector store endpoints with team-scoped deployments
This commit is contained in:
commit
654b688c8f
1 changed files with 15 additions and 1 deletions
|
|
@ -8598,7 +8598,9 @@ class Router:
|
|||
# No match found
|
||||
return None
|
||||
|
||||
def map_team_model(self, team_model_name: str, team_id: str) -> Optional[str]:
|
||||
def map_team_model(
|
||||
self, team_model_name: Optional[str], team_id: str
|
||||
) -> Optional[str]:
|
||||
"""
|
||||
Check if team_model_name resolves to team-specific deployments.
|
||||
|
||||
|
|
@ -8606,6 +8608,11 @@ class Router:
|
|||
sibling deployments via team_id filtering, instead of collapsing to a
|
||||
single internal model_name.
|
||||
|
||||
When team_model_name is None (e.g. vector store / file endpoints that
|
||||
don't include a model in their request), returns the first matching
|
||||
team deployment's team_public_model_name so the router can inject BYOK
|
||||
credentials from the team-scoped deployment.
|
||||
|
||||
Returns:
|
||||
- str: the team_model_name if team deployments exist for this team
|
||||
- None: if no team-specific model is found
|
||||
|
|
@ -8615,6 +8622,13 @@ class Router:
|
|||
return None
|
||||
for model in models:
|
||||
if model.get("model_info", {}).get("team_id") == team_id:
|
||||
if team_model_name is None:
|
||||
# No model was specified (e.g. vector store endpoints).
|
||||
# Return the deployment's public model name so the router
|
||||
# can route to it and inject the BYOK API key.
|
||||
return model.get("model_info", {}).get(
|
||||
"team_public_model_name"
|
||||
) or model.get("model_name")
|
||||
return team_model_name
|
||||
|
||||
# No team-scoped deployment found; wildcard/pattern routes are
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue