Ways to tell interviewers you want some time to think about your decision (Employment in Academia)
Usually, no one expects you to respond to an offer on the spot.

An important distinction to make is that the PI may offer you a verbal offer on the spot but generally it takes some time to get the formal offer. Accepting the verbal offer does not necessarily mean you have the job.

If the PI gives you a verbal offer, then just respond with a compliment (e.g., "Thank you, I am very impressed with your lab") and then ask when to expect the formal offer and when you should respond by.