not a cop
how to respond to the lady being raped scenario may vary from jurisdiction to jurisdiction...many states say a person intervening acts at their own peril and if you kill the suspect you may not have any legal grounds as the defense of others may be limited to family or other definite clases of persons...as always, I'd recommend the use of force or even display of firearm be avoided if possible and not utilized unless necessary right then to avoid immediate serious injury to self or other...
keep a reasonable distance from the assailant (you can't help if you a victim too with a knife in your gut).., assess the scene for risks (other potential threats out there?)...and do the yelling and 911 calling recommended by others...get the guy's attention on you and away from her...but avoid engaging with force unless compelled to do so...you may end up the goat and being arrested, prosecuted, etc...(you may beat the rap, but you certainly won't beat the ride!)..don't think like a wyatt earp out there...move with caution and deliberation not with emotion and super hero thoughts in your head.