mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-08 22:21:35 +00:00
fix(proxy): add defensive type check in add_team_based_callbacks_from_config
load_team_config() should always return a dict, but when proxy_config is mocked in tests without configuring load_team_config.return_value, calling .keys() on a Mock object raises TypeError. Adding isinstance check makes this robust against unexpected return types. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
b41f770197
commit
de4caed83e
1 changed files with 1 additions and 1 deletions
|
|
@ -799,7 +799,7 @@ class LiteLLMProxyRequestSetup:
|
|||
Add team-based callbacks from the config
|
||||
"""
|
||||
team_config = proxy_config.load_team_config(team_id=team_id)
|
||||
if len(team_config.keys()) == 0:
|
||||
if not isinstance(team_config, dict) or len(team_config.keys()) == 0:
|
||||
return None
|
||||
|
||||
callback_vars_dict = {**team_config.get("callback_vars", team_config)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue