Characterising the atmospheres of exoplanets is key to understanding their nature and provides hints about their formation and evolution. High resolution measurements of the helium triplet absorption of highly irradiated planets have been recently reported, which provide a new means of studying their atmospheric escape. In this work we study the escape of the upper atmospheres of HD 189733 b and GJ 3470 b by analysing high resolution He I triplet absorption measurements and using a 1D hydrodynamic spherically symmetric model coupled with a non-local thermodynamic model for the He I triplet state. We also use the H density derived from Lyα observations to further constrain their temperatures, mass-loss rates, and H/He ratios. We have significantly improved our knowledge of the upper atmospheres of these planets. While HD 189733 b has a rather compressed atmosphere and small gas radial velocities, GJ 3470 b, on the other hand with a gravitational potential ten times smaller, exhibits a very extended atmosphere and large radial outflow velocities. Hence, although GJ 3470 b is much less irradiated in the X-ray and extreme ultraviolet radiation, and its upper atmosphere is much cooler, it evaporates at a comparable rate. In particular, we find that the upper atmosphere of HD 189733 b is compact and hot, with a maximum temperature of 12 400−300+400 K, with a very low mean molecular mass (H/He = (99.2/0.8) ± 0.1), which is almost fully ionised above 1.1 RP, and with a mass-loss rate of (1.1 ± 0.1) × 1011 g s−1. In contrast, the upper atmosphere of GJ 3470 b is highly extended and relatively cold, with a maximum temperature of 5100 ± 900 K, also with a very low mean molecular mass (H/He = (98.5/1.5)−1.5+1.0), which is not strongly ionised, and with a mass-loss rate of (1.9 ± 1.1) × 1011 g s−1. Furthermore, our results suggest that upper atmospheres of giant planets undergoing hydrodynamic escape tend to have a very low mean molecular mass (H/He ≳ 97/3).