文档导航

简单记忆系统

让 Jev 判断哪些请求和答案值得记住,再用一个小函数把 Jev 调用包起来,往后续调用里加入记忆。

每一次 Jev 请求,只能看到你发给它的那份 state。客户上个月告诉过你应用的什么信息 —— 比如用的是哪个版本、哪个套餐 —— 除非你的代码把它放进去,否则不会出现在下一次请求里。这里的记忆系统用一次额外的 Jev 请求加一个 Python dict 来做这件事。

我们的例子给支持工单做路由。8 月,一个客户说他们自托管在 Windows Server 上。9 月,他们写道“仪表盘从今早开始一直很慢”。没有记忆时,Jev 会把这张工单发给云团队,而不是自托管团队。在下面的例子里,加上记忆后,后面六张工单全部被送到预期的团队。单独给每张工单做路由,只能对两张。

这个简单记忆系统有两部分:

  • 每次调用之后,Jev 会同时看到原始请求和它的答案。一个 Noul 问题 —— 我们叫它门控 —— 问的是:这个请求是否陈述了一条关于该客户、值得记住的重要事实。如果 P(yes) 至少为 0.5,就把这张工单和 Jev 的答案存为该客户的一条记忆。
  • 一个包装函数 ask_with_memory(),接收与 ask() 相同的 state 和 questions 参数(它本身就是固定了模型、并缓存了调用的 TypeSafe Python SDK client.system_one 方法),返回 Jev 的响应。每次调用之前,它会把该客户已保存的工单以及 Jev 对它们的答案加入 state。

这个包装函数就是一个基础的 agent harness。harness 指的是包在模型外面、给它加上额外能力(比如工具调用、循环运行)的那层代码。这个基础的小玩具只给了它记忆,存在一个普通的 Python dict 里,每个客户 ID 一个列表。

  %%{init: {"fontFamily": "Inter, sans-serif", "flowchart": {"rankSpacing": 25, "wrappingWidth": 300, "subGraphTitleMargin": {"top": 8, "bottom": 20}}}}%%
flowchart TB
    IN["ask_with_memory(state, questions)"]
    subgraph R["Jev: answer the question"]
        Q1["<b>Choice:</b> which support team?"]
    end
    subgraph G["Jev: judge the routed ticket"]
        Q2["<b>Noul:</b> does the request state<br/>an important fact about the customer?"]
    end
    DEC{"P(yes) ≥ 0.5?<br/>your code"}
    SAVE["save the memory<br/>under this customer's ID"]
    OUT["handle the support ticket response in your code"]
    MEM[("MEMORIES<br/>saved memories per customer")]
    IN -- "state with memories<br/>+ routing question" --> R
    R -- "original request + answer<br/>+ memory question" --> G
    G -- "P(yes)" --> DEC
    DEC -- "yes: save" --> SAVE
    DEC -- "no: don't save" --> OUT
    SAVE --> OUT
    SAVE --> MEM
    IN -. "added to the state<br/>on this customer's<br/>next support tickets" .- MEM

这个包装函数会先后发起两次 Jev 请求:先是路由请求,然后是门控 —— 门控把工单和 Jev 的答案放在一起判断。无论有没有东西被保存,包装函数返回的都是路由响应。

因为 ask_with_memory() 接收与 ask() 相同的参数、返回相同的响应,你可以在不改动其它代码的情况下把两者互换。包装函数自己负责找出客户的记忆、把它们加入 state,并保存新的记忆。

这个例子把两个客户的五张早期工单送进包装函数,然后对每个客户的三条后续消息各做两次路由:一次带上存下来的记忆,一次不带。最后用一张表把全部六条消息的两种答案并排列出。

Setup

pip install ipython 'cooksafe>=0.2.0,<0.3.0'

设置 TYPESAFE_API_KEY。每次 API 调用都缓存在 json_cache.json 里。把它下载到你运行这段代码的文件夹,就能复现这里给出的数字,而不用真的调用 API;不下载它则会全部实时运行。

下面的数字来自 2026-09-28 的 jev-1.13.0。0.5 这个记忆阈值只是一个起点,你应该拿自己的例子来评估它。

import json
import os
from pathlib import Path

from cooksafe import JsonCache, make_playground_link
from IPython.display import Markdown, display
from typesafe_sdk import Choice, Noul, NoulCriteria, SystemOneResponse, TypeSafeClient

TYPESAFE_MODEL = "jev-1.13.0"
REMEMBER_AT = 0.5  # save when P(lasting customer fact) reaches this starting threshold
MEMORY_KEY = "earlier_tickets_from_this_customer"  # where saved tickets go in the state

client = TypeSafeClient(
    api_key=os.environ.get("TYPESAFE_API_KEY", "cache-only"),  # keyless kernels replay the cache
    base_url=os.environ.get("TYPESAFE_ENDPOINT"),
    timeout=120.0,
)
json_cache = JsonCache(Path("json_cache.json"))

Define the tickets

两个客户、五张早期工单和三条后续消息,都是为这个 cookbook 写的。C-1042(Harbor Logistics)在 Enterprise 合同下把自托管版本跑在 Windows Server 上。C-2210(Fernwood Studio)用的是云版本的自助 Team 套餐。五张早期工单里有三张陈述了一条长期事实:一个版本、一个套餐、一份合同。另外两张没有:在机场用手机发的、一个公共假日。后面的消息没有一条提到客户的配置,所以没有记忆的话,Jev 只能猜。

每张工单都会变成一个包含两部分的 state:customer(客户是谁)和 ticket(工单会话)。ticket_state() 函数会构造一张简化过的工单,就像工单系统发出来的那样。在你的应用里,state 就是工单系统发来的每张工单,ask_with_memory() 会把该客户已保存的工单加进去。分成早期工单和后续消息只是为了这个例子。

DATA = {
    "customers": {
        "C-1042": {"id": "C-1042", "company": "Harbor Logistics"},
        "C-2210": {"id": "C-2210", "company": "Fernwood Studio"},
    },
    "earlier_tickets": [
        {"id": "T-101", "customer_id": "C-1042", "received_on": "2026-08-04",
         "subject": "Adding an admin",
         "text": "Hi, we run your self-hosted edition on Windows Server 2022 in our own data "
                 "centre. How do I add a new admin user?"},
        {"id": "T-102", "customer_id": "C-2210", "received_on": "2026-08-11",
         "subject": "Exporting to PDF",
         "text": "We're a small design studio on your cloud edition, paying monthly on the "
                 "self-serve Team plan. How do I export a dashboard as a PDF?"},
        {"id": "T-103", "customer_id": "C-1042", "received_on": "2026-08-19",
         "subject": "Invoice download",
         "text": "Sorry for the typos, typing this on my phone at the airport. Where can I "
                 "download last month's invoice?"},
        {"id": "T-104", "customer_id": "C-2210", "received_on": "2026-09-02",
         "subject": "Dark mode?",
         "text": "Our whole team is out on Friday for a public holiday, so no rush on this "
                 "one. Is there a dark mode?"},
        {"id": "T-105", "customer_id": "C-1042", "received_on": "2026-09-10",
         "subject": "Sandbox environment",
         "text": "For context, we signed an Enterprise contract with you in March. Can we get "
                 "a sandbox environment for testing?"},
    ],
    "later_messages": [
        {"subject": "Slow dashboards",
         "text": "Dashboards have been really slow since this morning."},
        {"subject": "Upgrade failing",
         "text": "The upgrade to version 5.2 keeps failing halfway through."},
        {"subject": "More seats",
         "text": "We'd like to add 20 more seats before next quarter."},
    ],
    "later_received_on": "2026-09-28",
    # Labelled by hand from what each customer said in the earlier tickets.
    "expected_team": {
        "C-1042": {"Slow dashboards": "selfhosted_windows",
                   "Upgrade failing": "selfhosted_windows", "More seats": "enterprise_desk"},
        "C-2210": {"Slow dashboards": "cloud_ops", "Upgrade failing": "cloud_ops",
                   "More seats": "billing"},
    },
}
CUSTOMERS = DATA["customers"]

def ticket_state(customer_id: str, ticket_id: str, received_on: str, subject: str,
                 text: str) -> dict:
    """The state Jev sees for one ticket: a simplified ticket, like one from a helpdesk."""
    return {
        "customer": CUSTOMERS[customer_id],
        "ticket": {
            "id": ticket_id,
            "received_on": received_on,
            "subject": subject,
            "messages": [{"from": "customer", "text": text}],
        },
    }

EARLIER = [
    ticket_state(t["customer_id"], t["id"], t["received_on"], t["subject"], t["text"])
    for t in DATA["earlier_tickets"]
]
print(f"{len(CUSTOMERS)} customers, {len(EARLIER)} earlier tickets, "
      f"{len(DATA['later_messages'])} later messages. The first ticket as Jev sees it:\n")
print(json.dumps(EARLIER[0], indent=2))
2 customers, 5 earlier tickets, 3 later messages. The first ticket as Jev sees it:

{
  "customer": {
    "id": "C-1042",
    "company": "Harbor Logistics"
  },
  "ticket": {
    "id": "T-101",
    "received_on": "2026-08-04",
    "subject": "Adding an admin",
    "messages": [
      {
        "from": "customer",
        "text": "Hi, we run your self-hosted edition on Windows Server 2022 in our own data centre. How do I add a new admin user?"
      }
    ]
  }
}

Route a ticket

一个 Choice 问题负责挑出支持团队。none_suitable 这个选项给 Jev 留了一个“没有团队合适”的答案,上下文太少的工单就可能落到那里。

辅助函数 ask() 就是固定了模型版本、并缓存了每次调用的 client.system_one。它接收一个 state 和一份问题 dict,返回 SDK 自己的响应对象,所以已经在读 client.system_one 响应的代码可以直接配合它,不用改。

ROUTE = {
    "team": Choice(
        instructions="Which support team should handle `ticket`?",
        criteria={
            "cloud_ops": "Cloud team: problems with the hosted cloud edition, run by us",
            "selfhosted_linux": "Self-hosted team, Linux: installs, upgrades and "
            "performance of the self-hosted edition on Linux servers",
            "selfhosted_windows": "Self-hosted team, Windows: installs, upgrades and "
            "performance of the self-hosted edition on Windows Server",
            "billing": "Billing: invoices, payments, seats and plan changes for "
            "self-serve plans",
            "enterprise_desk": "Enterprise desk: seats, contracts and account changes for "
            "customers on an Enterprise contract (their technical problems go to the "
            "technical teams)",
            "general": "General product questions: features, how-to, settings",
            "none_suitable": "None of these teams fits the ticket",
        },
    ),
}

@json_cache
def _system_one(model: str, state: str, questions: str) -> dict:
    response = client.system_one(
        state=json.loads(state), questions=json.loads(questions), model=model
    )
    return response.model_dump(mode="json")

def ask(state: dict, questions: dict) -> SystemOneResponse:
    """client.system_one, with the model pinned and the call cached."""
    as_json = {qid: q.model_dump(mode="json", exclude_none=True) for qid, q in questions.items()}
    raw = _system_one(TYPESAFE_MODEL, json.dumps(state), json.dumps(as_json))
    return SystemOneResponse.model_validate(raw)

def later_state(customer_id: str, message_index: int) -> dict:
    """One of the later messages, sent by this customer, with a fixed ticket ID."""
    n = 201 + 3 * list(CUSTOMERS).index(customer_id) + message_index
    message = DATA["later_messages"][message_index]
    return ticket_state(customer_id, f"T-{n}", DATA["later_received_on"], message["subject"],
                        message["text"])

slow = later_state("C-1042", 0)
team = ask(slow, ROUTE).answers["team"]
print(f"C-1042: {slow['ticket']['messages'][0]['text']!r}")
print(f"  plain Jev -> {team.choice} {team.probabilities[team.choice]:.2f}")
C-1042: 'Dashboards have been really slow since this morning.'
  plain Jev -> cloud_ops 0.80

光靠 Jev 会把 C-1042 的慢仪表盘发给云团队。仅有这一张工单,它没有理由做出别的判断。

Ask Jev whether the ticket is worth remembering

首先,as_memory() 把原始 state 和 Jev 的答案配成一对:这就是包装函数可能会保存的记忆。request 键保存的是记忆注入之前的 state,jev_answered 把每个问题映射到它的答案。这样就能避免旧记忆被嵌套进每一条新记忆里。

第二次 Jev 调用会读这一对。门控问的是:这个请求是否陈述了一条关于该客户的重要事实,比如他们的版本、操作系统、套餐或合同。Jev 的答案作为上下文也在那里,但只出现在答案里的事实不算数。没有这条规则的话,像“一般产品问题”这种笼统的答案会压过请求里真正的事实,而一个依赖了更早记忆的答案也会被当成新的再次保存。

GATE = {
    "remember": Noul(
        instructions=(
            "In `request.ticket`, does the thread state a lasting fact about the customer that "
            "should change how their future, unrelated tickets are handled? Count what the "
            "customer or our support staff wrote in `request.ticket`. `jev_answered` shows how "
            "the ticket was routed, which may rely on things learned earlier: do not count "
            "anything it says or implies."
        ),
        criteria=NoulCriteria(
            true=(
                "Yes: in `request.ticket` the customer or our support staff state something "
                "about the customer that stays true after this ticket, such as the product "
                "edition or operating system they run, their plan or contract, or a standing "
                "preference."
            ),
            false=(
                "No: `request.ticket` only contains things specific to this one ticket or "
                "moment, such as a one-off request, today's schedule, or the device they "
                "happen to be typing on; or the lasting fact appears only in `jev_answered`."
            ),
        ),
    ),
}

def answer_text(question, answer):
    """The readable part of an answer: the chosen option's description, or the number."""
    if answer.type == "choice":
        return question.criteria[answer.choice]
    return answer.noul if answer.type == "noul" else answer.score

def as_memory(state: dict, questions: dict, response: SystemOneResponse) -> dict:
    return {
        "request": state,
        "jev_answered": {
            q.instructions: answer_text(q, response.answers[qid])
            for qid, q in questions.items()
        },
    }

def remember_probability(memory: dict) -> float:
    """P(the request states an important fact about the customer), with the answer as context."""
    return ask(memory, GATE).answers["remember"].noul

Wrap the call so it remembers

包装函数 ask_with_memory() 的参数和返回值都和 ask() 一样。记忆存储就是一个普通的 dict,每个客户 ID 一个列表。包装函数用 state 里的 ID 来选取该客户的记忆。

MEMORIES: dict[str, list[dict]] = {}  # customer ID -> that customer's saved memories

def customer_id(state: dict) -> str:
    return state["customer"]["id"]

def ask_with_memory(state: dict, questions: dict) -> SystemOneResponse:
    """ask(), plus memory: same arguments, same return value."""
    # 1. Answer the call with this customer's existing memories.
    saved = MEMORIES.get(customer_id(state), [])
    response = ask({**state, MEMORY_KEY: saved} if saved else state, questions)

    # 2. Ask Jev whether the original request states an important fact worth keeping.
    memory = as_memory(state, questions, response)
    if remember_probability(memory) >= REMEMBER_AT:
        MEMORIES.setdefault(customer_id(state), []).append(memory)
    return response

这样加入记忆,会给你的应用带来四个后果:

  • 每次调用都会发出两次顺序请求 —— 你的调用,然后是记忆门控。门控把工单和 Jev 的答案放在一起判断,所以它要跑在路由请求之后。如果你的门控不看答案,那它也可以改成路由请求里的第二个问题(见扇出)。
  • 记忆只增不减。 每一条保存下来的记忆都会进入该客户之后的每一次调用。这里没有大小限制、没有相关性检查、也没有过期时间。“下一步”一节给每一项都留了思路。
  • 你的问题从不提及记忆。 记忆以 earlier_tickets_from_this_customer 为键放进 state,Jev 会读整个 state。ROUTE 里什么都不用改。
  • state 里需要 customer.id。 光靠 Jev 也接受用字符串作为 state,但这个包装函数需要 ID 才能找到该客户的列表。

Send the earlier tickets and watch the answers change

把这五张早期工单按到达顺序送进 ask_with_memory()。同一个客户会再发两条后续消息:慢仪表盘和加 20 个席位。这能看出每一条保存下来的记忆如何改变 Jev 的答案。这些重复的消息也走包装函数,所以门控同样会判断它们。

PROBES = {"Slow dashboards": 0, "More seats": 2}  # later messages to send after each ticket

def memory_ids(cid: str) -> str:
    return ", ".join(m["request"]["ticket"]["id"] for m in MEMORIES.get(cid, [])) or "none"

def send_probes(cid: str) -> None:
    for subject, i in PROBES.items():
        team = ask_with_memory(later_state(cid, i), ROUTE).answers["team"]
        print(f"      {subject:<16} -> {team.choice:<19} {team.probabilities[team.choice]:.2f}")

for cid in CUSTOMERS:
    print(f"{cid}, memories: {memory_ids(cid)}")
    send_probes(cid)

for state in EARLIER:
    cid = customer_id(state)
    response = ask_with_memory(state, ROUTE)
    p = remember_probability(as_memory(state, ROUTE, response))  # cached: the wrapper's call
    verdict = "saved" if p >= REMEMBER_AT else "not saved"
    text = state["ticket"]["messages"][0]["text"]
    print(f"\n{cid} {state['ticket']['id']}  {response.answers['team'].choice:<19} "
          f"P(remember) {p:.2f}  {verdict}")
    print(f"    {text[:84]}")
    print(f"{cid}, memories: {memory_ids(cid)}")
    send_probes(cid)
C-1042, memories: none
      Slow dashboards  -> cloud_ops           0.80
      More seats       -> enterprise_desk     0.62
C-2210, memories: none
      Slow dashboards  -> cloud_ops           0.75
      More seats       -> enterprise_desk     0.52

C-1042 T-101  selfhosted_windows  P(remember) 0.91  saved
    Hi, we run your self-hosted edition on Windows Server 2022 in our own data centre. H
C-1042, memories: T-101
      Slow dashboards  -> selfhosted_windows  0.99
      More seats       -> enterprise_desk     0.44

C-2210 T-102  general             P(remember) 0.91  saved
    We're a small design studio on your cloud edition, paying monthly on the self-serve
C-2210, memories: T-102
      Slow dashboards  -> cloud_ops           0.91
      More seats       -> billing             0.98

C-1042 T-103  billing             P(remember) 0.07  not saved
    Sorry for the typos, typing this on my phone at the airport. Where can I download la
C-1042, memories: T-101
      Slow dashboards  -> selfhosted_windows  0.99
      More seats       -> enterprise_desk     0.44

C-2210 T-104  general             P(remember) 0.10  not saved
    Our whole team is out on Friday for a public holiday, so no rush on this one. Is the
C-2210, memories: T-102
      Slow dashboards  -> cloud_ops           0.91
      More seats       -> billing             0.98

C-1042 T-105  enterprise_desk     P(remember) 0.92  saved
    For context, we signed an Enterprise contract with you in March. Can we get a sandbo
C-1042, memories: T-101, T-105
      Slow dashboards  -> selfhosted_windows  0.94
      More seats       -> enterprise_desk     0.99

那三张陈述了版本、套餐或合同的工单以 0.91 到 0.92 被保存。T-102 虽然被 Jev 路由到了通用团队,还是被保存了 —— 因为门控数的是客户的话,不是答案。机场和公共假日那两张工单得分 0.07 和 0.10,没有被保存,所以它们之后的答案没有变化。

每一条保存下来的记忆,都会改变与它相关的答案。对 C-1042 来说,Windows 那张工单把慢仪表盘从云团队(0.80)挪到了 Windows 团队(0.99)。Enterprise 合同随后把席位定在 0.99。对 C-2210 来说,Team 套餐那张工单把云团队从 0.75 提到 0.91,并把席位从 Enterprise 桌台(0.52)挪到 billing(0.98)。加入 Enterprise 记忆后,C-1042 的慢仪表盘略微下降,从 0.99 到 0.94 —— 这也正是要挑选用哪些记忆的一个原因(见“下一步”)。门控没有保存任何一条重复消息。

Route the same messages for both customers

现在每个客户都发送这三条后续消息。每条消息都分别进了不带记忆的 ask() 和 ask_with_memory(),用的是同一个 state 和同一个问题。

EXPECTED = DATA["expected_team"]
plain_correct = memory_correct = total = 0
example_state = None

def cell(answer, expected: str) -> str:
    mark = "✓" if answer.choice == expected else "✗"
    return f"{mark} {answer.choice} {answer.probabilities[answer.choice]:.2f}"

print(f"{'customer':<9}{'message':<17}{'expected':<20}{'plain Jev':<27}{'with memory':<27}")
for cid in CUSTOMERS:
    for i, message in enumerate(DATA["later_messages"]):
        state = later_state(cid, i)
        expected = EXPECTED[cid][message["subject"]]
        plain = ask(state, ROUTE).answers["team"]
        if example_state is None:
            # Keep the exact state used for this call for the playground link.
            saved = MEMORIES.get(cid, [])
            example_state = json.loads(json.dumps({**state, MEMORY_KEY: saved} if saved else state))
        response = ask_with_memory(state, ROUTE)
        remembered = response.answers["team"]
        plain_correct += plain.choice == expected
        memory_correct += remembered.choice == expected
        total += 1
        print(f"{cid:<9}{message['subject']:<17}{expected:<20}{cell(plain, expected):<27}"
              f"{cell(remembered, expected):<27}")

print(f"\nExpected routes: {plain_correct}/{total} without memory, "
      f"{memory_correct}/{total} with memory.")
customer message          expected            plain Jev                  with memory
C-1042   Slow dashboards  selfhosted_windows  ✗ cloud_ops 0.80           ✓ selfhosted_windows 0.94
C-1042   Upgrade failing  selfhosted_windows  ✗ none_suitable 0.60       ✓ selfhosted_windows 1.00
C-1042   More seats       enterprise_desk     ✓ enterprise_desk 0.62     ✓ enterprise_desk 0.99
C-2210   Slow dashboards  cloud_ops           ✓ cloud_ops 0.75           ✓ cloud_ops 0.91
C-2210   Upgrade failing  cloud_ops           ✗ none_suitable 0.63       ✓ cloud_ops 0.86
C-2210   More seats       billing             ✗ enterprise_desk 0.52     ✓ billing 0.98

Expected routes: 2/6 without memory, 6/6 with memory.

有了记忆,六条消息全部到达预期的团队,而没有记忆时只有两条。同一条消息现在对不同客户去了不同的团队:慢仪表盘对 C-1042 去了 Windows 团队,对 C-2210 留在云团队;加 20 个席位对 C-1042 去了 Enterprise 桌台,对 C-2210 去了 billing。在光靠 Jev 本来就答对的地方,记忆把概率提高了,比如 C-1042 的席位从 0.62 升到 0.99。包装函数也判断了这六条后续消息,一条都没保存:它们没有陈述任何重要事实。

每一行的预期团队,都来自客户在早期工单里透露的配置:C-1042 是自托管版本加 Enterprise 合同,C-2210 是云版本 Team 套餐。

Open it in the playground

这个链接保存了 C-1042 第一次慢仪表盘调用所用的那份路由 state,包括它那个时点的记忆,外加路由问题。

playground_link = make_playground_link(example_state, ROUTE, models=[TYPESAFE_MODEL])
display(Markdown(
    f"🔗 [Open C-1042's ticket with its memories in the TypeSafe playground]({playground_link})"
))
在 TypeSafe playground 里打开带记忆的 C-1042 工单 →

Next steps

  • 选择你的应用该记住什么。 改写 GATE 来描述你自己的任务里什么值得记住,并拿你标注过的例子来测 REMEMBER_AT。
  • 选择加入哪些记忆。 包装函数会把每一条保存下来的记忆都加进去。当列表变长之后,可以用一个相关性判断来挑出更小的一组。
  • 替换过时的记忆。 判断一条新记忆是否取代旧的一条,合适的时候在代码里删掉旧的条目。
  • 让记忆跨运行保留。 把 MEMORIES 换成一个以客户 ID 为键的数据库。进程退出时,内存里的 dict 就没了。
  • 对路由结果采取行动。 在代码里把每个团队映射到一个处理器,比如为 Enterprise 客户约一通电话,或者发一篇针对其配置的文章。见意图路由和基于置信度的路由。把你的回复作为一条支持消息加入工单会话,门控就能记住你做了什么。

Appendix

Can a saved answer reinforce a mistake?

会。门控忽略只出现在 Jev 答案里的内容,所以一个答案本身没法让工单被保存。不过一旦工单被保存,它的答案也会一起被保存 —— 连同错误的推断一起 —— 而该客户之后的每次调用都会读到它。之后的一个答案就可能重复这个错误。

How should I choose the threshold?

这个包装函数里的 0.5 是一个起始值。要挑你自己的值,可以把你流量里的“请求-答案”对标注成值得记住或不必记住,然后找出最能分开这两组的那个概率。再拿你没有用来挑选的那些对来验证它。如果一条误导性的记忆比漏掉一条代价更大,就把它调高;反过来就调低。如何选阈值、以及如何把阈值跟每类动作的风险对应起来,见置信度和置信度门控路由。