Skip to content

Twitch Chat Filter Cookbook

A live chat filter that asks three questions per message — category, toxicity, and spoilers — then turns the answers into show, highlight, dim, hide, or blur in plain code. The 29-message example hides seven, blurs two, and highlights six.

Format
Docs
Published by
TypeSafe AI
Last verified
Oct 2026

Highlights

  • One request per message holds three questions: a five-way category Choice, a toxic Noul, and a spoiler Noul, judged against the stream title and game.
  • decide() maps answers to show, highlight, dim, hide, or blur; changing a rule re-runs only decide() with no new request, as 14 changed messages in the example show.
  • On 29 hand-written Elden Ring messages the filter hid 7, blurred 2 spoilers, and highlighted 6 questions; requests took a median of about 0.4 seconds.
  • The demo is a Jev-powered Chrome extension filtering a live Twitch chat, and messages run eight at a time with ThreadPoolExecutor.

Quickstart

python
RULES = {"question": "highlight", "hype": "show", "conversation": "show",
         "backseat": "hide", "spam": "hide"}
TOXIC_AT, SPOILER_AT = 0.7, 0.7

def decide(result: dict, rules: dict = RULES) -> str:
    if result["toxic"] >= TOXIC_AT:
        return "hide (toxic)"
    action = rules[result["category"]]
    if action == "hide":
        return f"hide ({result['category']})"
    if result["spoiler"] >= SPOILER_AT:
        return "blur (spoiler)"
    return action

Watch out

A message waits about 0.4 seconds for its answer, so a toxic line is visible until then, and the page says one request at a time cannot keep up with a busy chat. Jev was trained mainly on English at publication, and the spoiler check has no record of the streamer's progress. Numbers come from jev-1.13.0 on 2026-09-25.

Questions about this entry

Short answers drawn from the linked project or page.

Reactions & coverage

Posts, threads, and videos about this entry from around the web.

YouTube: Building a contextual brand-safety scorer on Jev from scratch.

X: A website slop detector that checks 35 tells in 243 ms

X: Breaking, golden nugget, or slop

X: A filter for reply-guy comments

Related terms

Glossary definitions related to this entry.

More Jev resources like this

A support-ticket cookbook that lets Jev decide which requests are worth remembering, then wraps each call so saved tickets ride along in the state. Six later messages route correctly with memory against two without.
Jev CookbooksDocs#official#cookbook#memory
Official
Screen every message going into and out of an LLM app: a Noul describes possible hazards, a Score rates severity, and code thresholds the probabilities.
Jev CookbooksDocs#official#cookbook#guardrails
Official
A contextual brand-suitability scorer that judges each feed item against an advertiser's own versioned policy, returning a category, an exclusion flag, and a confidence for routing borderline items to review.
Jev Integrations & Adapters#community#typescript#advertising
Community
Decide which of 450 candidate product pairs from two beer catalogues describe the same entity: one three-level Score per pair splits 40 merges, 50 curator reviews, and 360 non-matches.
Jev CookbooksDocs#official#cookbook#entity-matching
Official
A repeatability study: an 8-question moderation rubric run 15 times per condition shows a mean probability standard deviation of 0.0098, and a 0.60 uncertainty gate lifts agreement to 99.2%.
Jev CookbooksDocs#official#cookbook#consistency
Official
Classify documents through deep patent, retail product, biomedical, and source-code hierarchies using parallel beam search over Choice probabilities.
Jev CookbooksDocs#official#cookbook#classification
Official

From the Jev guides

Original write-ups on what this entry is for.

Retrieval is a sequence of bounded judgments. How a decision model slots into passage filtering, semantic find, reranking, and citation checks, and what stays in deterministic code.
Jev Cookbooks#retrieval#reranking#rag
Read article
Jev bills input tokens and gives output away, and questions in one request run in parallel. The design consequence is simple: ask more per call, then decide in code.
Jev Cookbooks#batching#patterns#search
Read article
Back to all resources

From the Jev community

Posts from builders shipping with Jev right now.

Follow @typesafeai