test(test_function_calling.py): handle for when model returns a text response

This commit is contained in:
Krrish Dholakia 2024-04-17 18:32:34 -07:00
parent caa46ca905
commit 10d65f0676

View file

@ -266,9 +266,12 @@ def test_groq_parallel_function_call():
) )
print("Response\n", response) print("Response\n", response)
response_message = response.choices[0].message response_message = response.choices[0].message
if hasattr(response_message, "tool_calls"):
tool_calls = response_message.tool_calls tool_calls = response_message.tool_calls
assert isinstance(response.choices[0].message.tool_calls[0].function.name, str) assert isinstance(
response.choices[0].message.tool_calls[0].function.name, str
)
assert isinstance( assert isinstance(
response.choices[0].message.tool_calls[0].function.arguments, str response.choices[0].message.tool_calls[0].function.arguments, str
) )