Kav-K / GPTDiscord

A robust, all-in-one GPT interface for Discord. ChatGPT-style conversations, image generation, AI-moderation, custom indexes/knowledgebase, youtube summarizer, and more!
MIT License
1.81k stars 305 forks source link

[FEAT] Adding google perspective for AI Moderation #378

Closed Paillat-dev closed 10 months ago

Paillat-dev commented 11 months ago

I think that it could be interesting to add support for google's perspectiveapi, a machine learning service that works similarly to openai's moderation endpoint, and is also free. It would probably need to have an env variable defining the system to use, and add new moderation values. Here are the ones supported by perspective: .

I migth be able to do it, if I have time, but I'm asking here if it would be appropriate first in order not to work for nothing.

Kav-K commented 11 months ago

Sounds good! I'm open to having it be a switchable system with the env file. I'd appreciate a PR on it-- some notes: you'll have to abstract the moderation system a tiny bit more to allow for a toggle in the underlying moderations call and it might also involve abstracting the different moderation values if the schemas are different between openai and google, like if something is called "hate" in one but called something else in another you have to normalize them, feel free to make a new scheme of your choosing for that. make the default one be the openai one, add a new section to the moderations readme

let me know if you need any help

Kav-K commented 11 months ago

Also, for perspective it seems for free users it's 1 request per second so the moderation requests have to queue up with a gap slightly larger than a second between them, so the moderation task's click will have to be increased I think

Paillat-dev commented 11 months ago

Also, for perspective it seems for free users it's 1 request per second so the moderation requests have to queue up with a gap slightly larger than a second between them, so the moderation task's click will have to be increased I think

I'll dig more into it, but from my previous testing for another project, it was already supported by the google cloud lib, no queue was needed on my side.

Paillat-dev commented 10 months ago

Ill close this