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 7d2aa2f645
commit fc0ced48c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4956,7 +4956,7 @@ def get_optional_params(
litellm.add_function_to_prompt litellm.add_function_to_prompt
): # if user opts to add it to prompt instead ): # if user opts to add it to prompt instead
optional_params["functions_unsupported_model"] = non_default_params.pop( optional_params["functions_unsupported_model"] = non_default_params.pop(
"tools", non_default_params.pop("functions") "tools", non_default_params.pop("functions", None)
) )
else: else:
raise UnsupportedParamsError( raise UnsupportedParamsError(