/openedai-moderations

An OpenAI API compatible moderations server for checking whether text is potentially harmful.

Primary LanguagePythonGNU Affero General Public License v3.0AGPL-3.0

OpenedAI Moderations

An OpenAI API compatible moderations server for checking whether text is potentially harmful.

This server is built using moderation by embeddings by ifmain (Mike Afton) and FastAPI.

This is not affiliated with OpenAI in any way, and no OpenAI API key is required.

Quickstart

Docker (recommended):

docker compose up

or:

apt install git git-lfs
git clone https://huggingface.co/ifmain/moderation_by_embeddings repos/moderation_by_embeddings
pip install -r requirements.txt
python moderations.py --host 127.0.0.1 --port 5002

You can use the OpenAI client to interact with the API.

from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:5002/v1", api_key='skip')
moderation = client.moderations.create(input="I want to kill them.")
print(moderation.results[0])

Links & Documentation