Defending against prompt injection with structured queries (StruQ) and preference optimization (SecAlign)