File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3030from google .genai import types
3131from litellm import acompletion
3232from litellm import ChatCompletionAssistantMessage
33+ from litellm import ChatCompletionAssistantToolCall
3334from litellm import ChatCompletionDeveloperMessage
3435from litellm import ChatCompletionImageUrlObject
3536from litellm import ChatCompletionMessageToolCall
@@ -180,12 +181,12 @@ def _content_to_message_param(
180181 for part in content .parts :
181182 if part .function_call :
182183 tool_calls .append (
183- ChatCompletionMessageToolCall (
184+ ChatCompletionAssistantToolCall (
184185 type = "function" ,
185186 id = part .function_call .id ,
186187 function = Function (
187188 name = part .function_call .name ,
188- arguments = part .function_call .args ,
189+ arguments = json . dumps ( part .function_call .args ) ,
189190 ),
190191 )
191192 )
Original file line number Diff line number Diff line change @@ -700,13 +700,12 @@ def test_content_to_message_param_function_call():
700700 message = _content_to_message_param (content )
701701 assert message ["role" ] == "assistant"
702702 assert message ["content" ] == None
703- assert message ["tool_calls" ][0 ].type == "function"
704- assert message ["tool_calls" ][0 ].id == "test_tool_call_id"
705- assert message ["tool_calls" ][0 ].function .name == "test_function"
706- assert (
707- message ["tool_calls" ][0 ].function .arguments
708- == '{"test_arg": "test_value"}'
709- )
703+
704+ tool_call = message ["tool_calls" ][0 ]
705+ assert tool_call ["type" ] == "function"
706+ assert tool_call ["id" ] == "test_tool_call_id"
707+ assert tool_call ["function" ]["name" ] == "test_function"
708+ assert tool_call ["function" ]["arguments" ] == '{"test_arg": "test_value"}'
710709
711710
712711def test_message_to_generate_content_response_text ():
You can’t perform that action at this time.
0 commit comments