toolCalls property
Get tool calls from the response
Implementation
@override
List<ToolCall>? get toolCalls {
final message = _rawResponse['message'] as Map<String, dynamic>?;
if (message == null) return null;
final toolCalls = message['tool_calls'] as List?;
if (toolCalls == null || toolCalls.isEmpty) return null;
return toolCalls.map((tc) {
final function = tc['function'] as Map<String, dynamic>;
return ToolCall(
id: 'call_${function['name']}',
callType: 'function',
function: FunctionCall(
name: function['name'] as String,
arguments: jsonEncode(function['arguments']),
),
);
}).toList();
}