Jev 案例:多语言评论审核(完整代码)

更新于 适用版本 Jev 1.13 示例数据(example fixture)

TL;DR: 本案例用两次 Jev 1.13 调用审核任意语言的商品评论:先一道判断题(“这条评论是否违规?”),只有回答 yes 时才发第二道选择题,归类为 spamabusepolicy-violation。完整代码见下文。

场景

我们运营一个买家给卖家写评价的电商平台。评论以十几种语言进来——西班牙语、日语、波兰语、葡萄牙语——过去审核意味着要么按语种各招一批审核员,要么放任队列烂掉。但审核规则本身与语言无关:禁止垃圾广告、禁止辱骂、禁止政策违规(引导站外交易、虚构折扣、假货相关)。

所以我们按 Jev 题型的天然边界拆分了工作:

  1. 一道判断题:这条评论是否违反平台规则?yes / no / unclear
  2. 仅当答案是 yes 时:一道选择题——违规类型是哪类?spam / abuse / policy-violation

两个值得抄走的设计点:

Jev 是 TypeSafe AI 发布的 System One 判断模型(2026 年 9 月);两次调用都走 OpenRouter 的 OpenAI 兼容端点。

请求

第一次调用——违规检查(判断题):

{
  "model": "typesafe/jev-1.13",
  "messages": [
    {
      "role": "system",
      "content": "Judgment question. Does this product review violate the marketplace rules (spam, abuse, or policy violation)? Answer yes, no, or unclear. Reply with JSON only: {\"answer\": <yes|no|unclear>, \"confidence\": <0-1>, \"rationale\": <one sentence>}"
    },
    {
      "role": "user",
      "content": "Review: \"El reloj llegó rápido, pero es una réplica obvia. Si quieres el Original más barato, escríbeme por WhatsApp al +34 600 000 000.\""
    }
  ]
}

第二次调用——违规分类(选择题),仅当第一次回答 yes 时发送:

{
  "model": "typesafe/jev-1.13",
  "messages": [
    {
      "role": "system",
      "content": "Choice question. Classify the violation as exactly one of: spam, abuse, policy-violation. Reply with JSON only: {\"answer\": <spam|abuse|policy-violation>, \"confidence\": <0-1>, \"rationale\": <one sentence>}"
    },
    {
      "role": "user",
      "content": "Review: \"El reloj llegó rápido, pero es una réplica obvia. Si quieres el Original más barato, escríbeme por WhatsApp al +34 600 000 000.\""
    }
  ]
}

响应

均为示例数据(example fixture)——用于说明格式,不是线上实测抓包。

第一次调用:

{
  "answer": "yes",
  "confidence": 0.97,
  "rationale": "The review pivots from a product complaint to an off-platform solicitation offering a cheaper 'original', which violates the counterfeit and off-platform-contact rules."
}

第二次调用:

{
  "answer": "policy-violation",
  "confidence": 0.94,
  "rationale": "The message solicits off-platform contact to sell a counterfeit item, matching the policy-violation category rather than generic spam or abuse."
}

复现脚本

保存为 moderate.py,设置环境变量 OPENROUTER_API_KEY 后运行 python3 moderate.py

import json, os, urllib.request

URL = "https://openrouter.ai/api/v1/chat/completions"
MODEL = "typesafe/jev-1.13"  # confirm exact slug on the OpenRouter model page

JUDGE = ('Judgment question. Does this product review violate the marketplace '
         'rules (spam, abuse, or policy violation)? Answer yes, no, or unclear. '
         'Reply with JSON only: {"answer": <yes|no|unclear>, "confidence": <0-1>, '
         '"rationale": <one sentence>}')

CLASSIFY = ('Choice question. Classify the violation as exactly one of: spam, '
            'abuse, policy-violation. Reply with JSON only: '
            '{"answer": <spam|abuse|policy-violation>, "confidence": <0-1>, '
            '"rationale": <one sentence>}')

def call(system, user):
    body = {"model": MODEL, "messages": [
        {"role": "system", "content": system},
        {"role": "user", "content": user}]}
    req = urllib.request.Request(URL, data=json.dumps(body).encode(),
        headers={"Authorization": "Bearer " + os.environ["OPENROUTER_API_KEY"],
                 "Content-Type": "application/json"})
    with urllib.request.urlopen(req) as res:
        payload = json.load(res)
    return json.loads(payload["choices"][0]["message"]["content"])

review = ('"El reloj llegó rápido, pero es una réplica obvia. Si quieres el '
          'Original más barato, escríbeme por WhatsApp al +34 600 000 000."')

verdict = call(JUDGE, review)
print(verdict)
if verdict["answer"] == "yes":
    print(call(CLASSIFY, review))

关键参数

字段取值说明
modeltypesafe/jev-1.13固定版本。准确 slug 请以 OpenRouter 模型页为准。
第一次调用 messages[0]判断题 + 规则摘要 + JSON 结构规则摘要定义了什么叫”违规”,必须与平台公示政策保持一致。
第二次调用 messages[0]选择题 + 三个类别 + JSON 结构只在判 yes 后触发,选项列表才能保持短而明确。
messages[1](user)未翻译的评论原文原文进、结论出,中间没有会漂移的翻译环节。
answer 序列yespolicy-violation工作流本身:判断题给选择题把门。
confidence 取值0.97 / 0.94(示例数据)任何一步的低置信度结论都应转人工队列。
价格$0.0462 / 1M input tokens大多数正常评论只花一次调用;预算前请在 OpenRouter 核对当前价格。

注意事项

继续阅读