fix(utils.py): handle 'os.environ/' being passed in as kwargs

This commit is contained in:
Krrish Dholakia 2023-12-22 11:08:44 +05:30
parent d87e59db25
commit 278f61f3ed
5 changed files with 68 additions and 4 deletions

View file

@ -1627,6 +1627,10 @@ def client(original_function):
logging_obj = function_setup(start_time, *args, **kwargs)
kwargs["litellm_logging_obj"] = logging_obj
# CHECK FOR 'os.environ/' in kwargs
for k,v in kwargs.items():
if v is not None and isinstance(v, str) and v.startswith("os.environ/"):
kwargs[k] = litellm.get_secret(v)
# [OPTIONAL] CHECK BUDGET
if litellm.max_budget:
if litellm._current_cost > litellm.max_budget: