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).
This commit is contained in:
Sebastián Estévez 2024-05-03 23:38:54 -04:00 committed by GitHub
parent 0d3aa8d323
commit 78890e2f33

View file

@ -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(