fix(vertex_httpx.py): Fix tool calling with empty param list

Fixes https://github.com/BerriAI/litellm/issues/5055
This commit is contained in:
Krrish Dholakia 2024-08-21 09:02:24 -07:00
parent 7d0196191f
commit 8812da04e3
3 changed files with 38 additions and 1 deletions

View file

@ -337,3 +337,27 @@ def test_groq_parallel_function_call():
print("second response\n", second_response)
except Exception as e:
pytest.fail(f"Error occurred: {e}")
@pytest.mark.parametrize("model", ["gemini/gemini-1.5-pro"])
def test_simple_function_call_function_param(model):
try:
litellm.set_verbose = True
messages = [{"role": "user", "content": "What is the weather like in Boston?"}]
response = completion(
model=model,
messages=messages,
tools=[
{
"type": "function",
"function": {
"name": "plot",
"description": "Generate plots",
},
}
],
tool_choice="auto",
)
print(f"response: {response}")
except Exception as e:
raise e