Content Moderation
Independent checks (toxicity, spam, off-topic) run in parallel, then a deterministic code block combines the scores into a verdict.
Run several independent checks on user-generated content in parallel, then combine into a single moderation verdict.
Tree
Blocks
toxicity-check (llm)
spam-check (llm)
off-topic-check (llm)
final-verdict (code) — Python
Why this shape?
- Three checks, three parallel blocks. Each check is independent — toxicity doesn't depend on spam likelihood. Sequential would multiply latency for no gain.
- The final verdict is a
codeblock, not anllmblock. Threshold logic is deterministic and cheap. Asking an LLM to combine three numeric scores wastes tokens and introduces variance you don't want in moderation decisions. - Each LLM block returns a structured score, not free-form prose. The
codeblock needs numbers — schemas keep the contract honest. - Code blocks run Python. Earlier drafts of this recipe used a JavaScript snippet; that was a doc bug — the platform's code runtime is Python, and prompts that say otherwise will mislead authors and LLM clients.
- No prompt engineering on the aggregator. When the combination logic is "if X > threshold, do Y," that's not an LLM job.