File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,17 @@ def test_glm_streaming_tool_call(row: EvaluationRow) -> EvaluationRow:
257257 return row
258258
259259 tool_calls = assistant_msg .tool_calls or []
260+ tool_calls_for_metrics : list [Any ] = []
261+ for tc in tool_calls :
262+ if hasattr (tc , "model_dump" ):
263+ try :
264+ tool_calls_for_metrics .append (tc .model_dump (exclude_none = True ))
265+ except Exception :
266+ tool_calls_for_metrics .append (str (tc ))
267+ elif isinstance (tc , dict ):
268+ tool_calls_for_metrics .append (tc )
269+ else :
270+ tool_calls_for_metrics .append (str (tc ))
260271 finish_reason = row .execution_metadata .finish_reason
261272 tool_call_count = row .execution_metadata .tool_call_count
262273
@@ -298,7 +309,7 @@ def test_glm_streaming_tool_call(row: EvaluationRow) -> EvaluationRow:
298309 score = 1.0 if exactly_one_tool_call else 0.0 ,
299310 is_score_valid = has_tool_call ,
300311 reason = ("Exactly one tool call" if exactly_one_tool_call else "Unexpected number of tool calls" ),
301- data = {"tool_calls" : tool_calls },
312+ data = {"tool_calls" : tool_calls_for_metrics },
302313 ),
303314 "finish_reason_tool_calls" : MetricResult (
304315 score = 1.0 if finish_reason_tool_calls else 0.0 ,
You can’t perform that action at this time.
0 commit comments