It's a combination of line pressure, rpm and throttle position via the kickdown cable. If you take the cover off of the throttle arm on the engine, you'll see the bottom cable goes to the transmission. This cable should be just relaxed with the throttle in idle position. It's adjustable to adjust shift points and downshift sensitivity. Mine was too relaxed and therefore shifted to O/D too soon. I adjusted it a little and will check the results next time out. I'll probably have to adjust it a couple of times until I find a setting I like.
If you want to adjust yours, remove the two plastic screws and screw inserts on the cover, remove the cover, pull forward on the black cable end to remove it from the throttle arm ball, squeeze the two retaining clips top and bottom of the bracket retainer and slide the cable out the back of the bracket. Move the white locking clip out and adjust the cable housing out for more sensitivity to throttle or in for less sensitivity. Note the visible notches on the cable so you know how much you've moved it or if you want to put it back where it was. Snap the locking clip back in and put the cable and cover back on. Give it a try and see if you went too far or not far enough.