I see that you do sanitize prompt with only prompt.strip() for basic cleaning -- I believe this is due to time constraint. But in your opinion, what is the best practice to sanitize a prompt?
Youβre right, prompt.strip() is a basic step mainly for removing extra spaces. Best practice for prompt sanitization involves more thorough measures like validating and filtering inputs to block sensitive or malicious content, masking any sensitive data, limiting prompt length, and using moderation tools or APIs to automatically detect harmful inputs.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I see that you do sanitize prompt with only prompt.strip() for basic cleaning -- I believe this is due to time constraint. But in your opinion, what is the best practice to sanitize a prompt?
Youβre right, prompt.strip() is a basic step mainly for removing extra spaces. Best practice for prompt sanitization involves more thorough measures like validating and filtering inputs to block sensitive or malicious content, masking any sensitive data, limiting prompt length, and using moderation tools or APIs to automatically detect harmful inputs.