From fc0ced48c1a3c695186b1d433bb2d99234d6c67e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Est=C3=A9vez?= Date: Fri, 3 May 2024 23:38:54 -0400 Subject: [PATCH] add_function_to_prompt bug fix This blows up when there's no "functions" in the dictionary even when tools is present because the inner function executes regardless (does not short circuit). --- litellm/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/litellm/utils.py b/litellm/utils.py index ac8ec35d4..75d6f8b7f 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -4956,7 +4956,7 @@ def get_optional_params( litellm.add_function_to_prompt ): # if user opts to add it to prompt instead optional_params["functions_unsupported_model"] = non_default_params.pop( - "tools", non_default_params.pop("functions") + "tools", non_default_params.pop("functions", None) ) else: raise UnsupportedParamsError(