-
Notifications
You must be signed in to change notification settings - Fork 0
Added code for lexical slur validator #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
its a nitpick, but filenames are named inconsistently. Some have capital letters in their name (Curated_Slurlist_Hindi_English.csv), some don't break the words correctly (pdfanonymizer.py). Lets be consistent with the rest of the code and make it all snake case? so curated_slurlist_hi_en.csv and pdf_anonymizer |
|
makes sense, btw should we store the csv in the safety folder or should it be someplace else? What do you suggest? Storing it in someplace like blob storage seems overkill. |
Its ok to keep it in a csv here for the 0.1. Makes for easy demo too. We can discuss remote storage eventually when they might need more customization over slur list per request or client. |
Summary
This PR adds functionality to detect lexical slurs by creating custom validators using guardrails-ai.
How to Test / Review
For testing, use something like this, add this in the Guardrails.py file -
Sample input
About hub_loader.py
Guardrail AI's recommended method to install validators from its hub is via their cli using the install command.
eg
guardrails hub install hub://guardrails/regex_match.In the initial stages, we are keeping a tight check on the validators we are adding, so we COULD add the commands to install the validators we support in our dockerfile or a startup script.
But we've created hub_loader.py as a possible way to control the install process via the python process itself.
If it feels over engineered at the moment, happy to keep it out for now.
Checklist
Before submitting a pull request, please ensure that you mark these task.
fastapi run --reload app/main.pyordocker compose upin the repository root and test.Notes
Please add here if any other information is required for the reviewer.