Apple has written instructions for its AI software to prevent hallucinations and controversial replies.