fix(utils.py): check if tools is iterable before indexing into it

Fixes https://github.com/BerriAI/litellm/issues/4933
This commit is contained in:
Krrish Dholakia 2024-07-29 09:01:09 -07:00
parent a2939c2f08
commit 52b1ca292c

View file

@ -2772,7 +2772,9 @@ def get_optional_params(
message=f"Function calling is not supported by {custom_llm_provider}.",
)
if "tools" in non_default_params:
if "tools" in non_default_params and isinstance(
non_default_params, list
): # fixes https://github.com/BerriAI/litellm/issues/4933
tools = non_default_params["tools"]
for (
tool