vanilla14/openenv-content-moderation
0
๐ก๏ธ OpenEnv Content Moderation Environment
A real-world, production-grade content moderation RL environment built on the OpenEnv framework by Meta & Hugging Face.
   
๐ Overview & Motivation
Content moderation is one of the most critical challenges in modern platforms. This environment simulates real-world moderation where an AI agent must:
- Classify content (
safe,toxic,hate,spam) - Decide moderation action (
approve,warn,remove) - Assess severity (
none,low,medium,high)
๐ก Use Cases
- ๐ง Reinforcement Learning training
- ๐ค LLM benchmarking
- ๐ Safety system research
- โ๏ธ Agent evaluation across difficulty levels
๐๏ธ Project Structure
openenv-content-moderation/
โ
โโโ app.py # FastAPI server (main entrypoint)
โโโ environment.py # Core environment logic
โโโ tasks.py # Task datasets (easy/medium/hard/expert)
โโโ grader.py # Reward / grading logic
โโโ models.py # Pydantic models
โโโ inference.py # Baseline agent script
โ
โโโ openenv.yaml # OpenEnv config
โโโ pyproject.toml # Project metadata
โโโ Dockerfile # Container setup
โโโ requirements.txt # Dependencies
โโโ uv.lock # Locked deps
โ
โโโ server/
โโโ __init__.py
โโโ app.py # Server module entrypoint๐งช Tasks
๐๏ธ Observation Space
{
"content": "user text",
"task": "easy | medium | hard | expert"
}๐ฏ Action Space
label=<label>;decision=<decision>;severity=<severity>๐ Reward Function
- Label โ +0.50
- Decision โ +0.29
- Severity โ +0.19
โ Scores are clamped between 0.01 and 0.98
๐ API Endpoints
โ๏ธ Local Setup
git clone https://github.com/Vanillaaz/openenv-content-moderation.git
cd openenv-content-moderation
pip install -r requirements.txt
uvicorn app:app --host 0.0.0.0 --port 8000 --reload๐ Open: http://localhost:8000/docs
๐ณ Docker
docker build -t openenv-content-moderation .
docker run -p 8000:8000 openenv-content-moderation๐ค Running the Agent
export API_BASE_URL="https://router.huggingface.co/v1"
export MODEL_NAME="Qwen/Qwen2.5-72B-Instruct"
export HF_TOKEN="your_token"
python inference.py๐ Environment Variables
๐ Live Demo
- HF Space: https://huggingface.co/spaces/vanilla14/openenv-content-moderation
- API Docs: https://vanilla14-openenv-content-moderation.hf.space/docs
- Health: https://vanilla14-openenv-content-moderation.hf.space/health
๐ Baseline Scores
Baseline agent: Qwen/Qwen2.5-72B-Instruct
๐ฉโ๐ป Author
Venisha Dsouza Built for OpenEnv Hackathon ๐
