fix: liteLLM test failures

Fix liteLLM test failures for function call responses.

PiperOrigin-RevId: 772212629
This commit is contained in:
Google Team Member
2025-06-16 16:20:23 -07:00
committed by Copybara-Service
parent fe1d5aa439
commit fef8778429
+6 -6
View File
@@ -1194,11 +1194,11 @@ async def test_generate_content_async_stream(
assert responses[2].content.role == "model"
assert responses[2].content.parts[0].text == "two:"
assert responses[3].content.role == "model"
assert responses[3].content.parts[0].function_call.name == "test_function"
assert responses[3].content.parts[0].function_call.args == {
assert responses[3].content.parts[-1].function_call.name == "test_function"
assert responses[3].content.parts[-1].function_call.args == {
"test_arg": "test_value"
}
assert responses[3].content.parts[0].function_call.id == "test_tool_call_id"
assert responses[3].content.parts[-1].function_call.id == "test_tool_call_id"
mock_completion.assert_called_once()
_, kwargs = mock_completion.call_args
@@ -1257,11 +1257,11 @@ async def test_generate_content_async_stream_with_usage_metadata(
assert responses[2].content.role == "model"
assert responses[2].content.parts[0].text == "two:"
assert responses[3].content.role == "model"
assert responses[3].content.parts[0].function_call.name == "test_function"
assert responses[3].content.parts[0].function_call.args == {
assert responses[3].content.parts[-1].function_call.name == "test_function"
assert responses[3].content.parts[-1].function_call.args == {
"test_arg": "test_value"
}
assert responses[3].content.parts[0].function_call.id == "test_tool_call_id"
assert responses[3].content.parts[-1].function_call.id == "test_tool_call_id"
assert responses[3].usage_metadata.prompt_token_count == 10
assert responses[3].usage_metadata.candidates_token_count == 5