0d3cb498a3
CI / Shell Format Check (push) Has been cancelled
CI / Check Ruby (3.4) (push) Has been cancelled
CI / CI Config (push) Has been cancelled
CI / Test on Node ${{ matrix.node }} and ${{ matrix.os }}${{ matrix.shard && format(' (shard {0}/3)', matrix.shard) || '' }} (push) Has been cancelled
CI / Build on Node ${{ matrix.node }} (push) Has been cancelled
CI / Style Check (push) Has been cancelled
CI / Generate Assets (push) Has been cancelled
CI / Check Python (3.14) (push) Has been cancelled
CI / Check Python (3.9) (push) Has been cancelled
CI / Build Docs (push) Has been cancelled
CI / Code Scan Action (push) Has been cancelled
CI / Site tests (push) Has been cancelled
CI / webui tests (push) Has been cancelled
CI / Run Integration Tests (push) Has been cancelled
CI / Run Smoke Tests (push) Has been cancelled
CI / Go Tests (push) Has been cancelled
CI / Share Test (push) Has been cancelled
CI / Redteam (Production API) (push) Has been cancelled
CI / Redteam (Staging API) (push) Has been cancelled
CI / GitHub Actions Lint (push) Has been cancelled
CI / Check Ruby (3.0) (push) Has been cancelled
release-please / release-please (push) Has been cancelled
release-please / build (push) Has been cancelled
release-please / publish-npm (push) Has been cancelled
release-please / publish-npm-backfill (push) Has been cancelled
release-please / docker (push) Has been cancelled
release-please / publish-code-scan-action (push) Has been cancelled
release-please / attest-code-scan-action (push) Has been cancelled
Deploy local.promptfoo.app / Deploy to Cloudflare Pages (push) Has been cancelled
Test and Publish Multi-arch Docker Image / test (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-amd64 platform:linux/amd64 runner:ubuntu-latest]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / build-docker-and-push-digests (map[digest-suffix:linux-arm64 platform:linux/arm64 runner:ubuntu-24.04-arm]) (push) Has been cancelled
Test and Publish Multi-arch Docker Image / merge-docker-digests (push) Has been cancelled
Test and Publish Multi-arch Docker Image / Attest Multi-arch Image (push) Has been cancelled
Validate Renovate Config / Validate Renovate Configuration (push) Has been cancelled
provider-replicate/llama-guard-moderation (LlamaGuard Content Moderation)
You can run this example with:
npx promptfoo@latest init --example provider-replicate/llama-guard-moderation
cd provider-replicate/llama-guard-moderation
This example demonstrates how to use Meta's LlamaGuard models for content moderation in promptfoo.
Features
This example shows:
- Using LlamaGuard 3 for content moderation
- Checking for specific safety categories
- Examples of content that might trigger different categories
- Placeholder for LlamaGuard 4 (when available on Replicate)
LlamaGuard Categories
LlamaGuard monitors these safety categories:
| Code | Category | Description |
|---|---|---|
| S1 | Violent Crimes | Content enabling violent crimes |
| S2 | Non-Violent Crimes | Content enabling non-violent crimes |
| S3 | Sex Crimes | Content enabling sex-related crimes |
| S4 | Child Exploitation | Content depicting child abuse |
| S5 | Defamation | Defamatory statements |
| S6 | Specialized Advice | Dangerous financial, medical, or legal advice |
| S7 | Privacy | Sensitive personal information |
| S8 | Intellectual Property | IP violations |
| S9 | Indiscriminate Weapons | WMD creation |
| S10 | Hate | Hateful content |
| S11 | Self-Harm | Content enabling self-harm |
| S12 | Sexual Content | Adult content |
| S13 | Elections | Election misinformation |
| S14 | Code Interpreter Abuse | Code exploitation (LlamaGuard 4 only) |
Setup
-
Get a Replicate API token from https://replicate.com/account/api-tokens
-
Set the environment variable:
export REPLICATE_API_TOKEN=r8_your_token_here -
Run the evaluation:
promptfoo eval
LlamaGuard 4
LlamaGuard 4 is a 12B parameter model that adds the S14 category for code interpreter abuse detection. It's the default moderation provider for promptfoo on Replicate.
Using LlamaGuard 4:
- It's automatically used as the default moderation provider
- You can explicitly specify it with:
replicate:moderation:meta/llama-guard-4-12b - The example in the configuration file demonstrates S14 category detection
For compatibility, you can still use LlamaGuard 3:
- Specify:
replicate:moderation:meta/llama-guard-3-8b:146d1220d447cdcc639bc17c5f6137416042abee6ae153a2615e6ef5749205c8 - Provides coverage for categories S1-S13