File tree Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Expand file tree Collapse file tree 2 files changed +9
-9
lines changed Original file line number Diff line number Diff line change 30
30
from google .genai import types
31
31
from litellm import acompletion
32
32
from litellm import ChatCompletionAssistantMessage
33
+ from litellm import ChatCompletionAssistantToolCall
33
34
from litellm import ChatCompletionDeveloperMessage
34
35
from litellm import ChatCompletionImageUrlObject
35
36
from litellm import ChatCompletionMessageToolCall
@@ -180,12 +181,12 @@ def _content_to_message_param(
180
181
for part in content .parts :
181
182
if part .function_call :
182
183
tool_calls .append (
183
- ChatCompletionMessageToolCall (
184
+ ChatCompletionAssistantToolCall (
184
185
type = "function" ,
185
186
id = part .function_call .id ,
186
187
function = Function (
187
188
name = part .function_call .name ,
188
- arguments = part .function_call .args ,
189
+ arguments = json . dumps ( part .function_call .args ) ,
189
190
),
190
191
)
191
192
)
Original file line number Diff line number Diff line change @@ -700,13 +700,12 @@ def test_content_to_message_param_function_call():
700
700
message = _content_to_message_param (content )
701
701
assert message ["role" ] == "assistant"
702
702
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"}'
710
709
711
710
712
711
def test_message_to_generate_content_response_text ():
You can’t perform that action at this time.
0 commit comments