In one embodiment, a system includes a generator configured to receive a flow of an organic working fluid. The generator includes a stator and a permanent magnet rotor configured to rotate within the stator to generate electricity. The generator further includes one or more components disposed within the generator and configured to be exposed to the flow of the organic working fluid. The one or more components each include an underlying component, and an encapsulant configured to withstand exposure to the organic working fluid to inhibit contact between the underlying component and the organic working fluid.