문서

신뢰도 게이팅 라우팅

신뢰도를 두 번째 축으로 사용합니다. 답변은 무엇인지 알려주고, 신뢰도는 행동해야 할지 알려줍니다.

TypeSafe의 가장 강력한 기능 중 하나는 신뢰도입니다. 신뢰도를 기준으로 결정을 게이팅하는 방식을 의도적으로 설계하면, 신뢰할 수 있으면서도 안전한 시스템을 구축할 수 있습니다.

예: 음성 뱅킹 명령

사용자가 음성으로 계좌를 다룰 수 있는 음성 뱅킹 인터페이스를 구축한다고 상상해 봅시다. 사용자의 의도를 해석하는 데는 항상 합리적인 신뢰도가 필요하지만, 어떤 동작은 다른 동작보다 위험하므로 더 높은 신뢰도 임계값을 요구합니다.

%%{init: {"fontFamily": "Inter, sans-serif", "flowchart": {"rankSpacing": 35, "wrappingWidth": 300, "subGraphTitleMargin": {"top": 12, "bottom": 36}}}}%%
flowchart LR
    command["voice banking command"]

    subgraph req["TypeSafe evaluates<br/>the question"]
        intent["<b>Choice:</b> intent"]
    end

    command -- "one request<br/>command + intent<br/>question" --> req
    req -- "one response<br/>intent answer +<br/>confidence" --> gate{"<b>confidence high enough?</b><br/>your code"}
    gate -- "below 0.6<br/>or other intent" --> human["send to a support agent"]
    gate -- "check_balance<br/>at least 0.6" --> balance["show the balance"]
    gate -- "approve_transfer<br/>0.6 to 0.85" --> confirm["ask the user to confirm"]
    gate -- "approve_transfer<br/>above 0.85" --> approve["approve the transfer"]

1단계: 사용자의 의도 파악하기

questions
{
  "intent": {
    "type": "choice",
    "instructions": "What action is the user requesting?",
    "criteria": {
      "check_balance": "Check the balance of an account",
      "approve_transfer": "Approve the pending transfer request",
      "other": "Something else"
    }
  }
}

2단계: 신뢰도 게이팅 라우팅

action = response.answers["intent"]

# Below 0.6 confidence on any action, route to a human
if action.confidence < 0.6:
    route_to_support_agent(account_id)

elif action.choice == "check_balance":
    # Low stakes. 0.6 confidence is sufficient.
    show_balance(account_id)

elif action.choice == "approve_transfer":
    if action.confidence > 0.85:
        # High stakes, but high confidence. Safe to act automatically.
        approve_transfer(account_id)
    else:
        # High stakes, moderate confidence. Verify intent first.
        ask_user_to_confirm("Just to confirm: you would like to approve this transfer, is that correct?")

else:
    route_to_support_agent(account_id)

0.6 하한은 모델이 진짜 불확실해하는 모든 것을 잡아냅니다. 그 하한 위에서는, 각 동작 유형이 잘못 분류된 답변에 행동했을 때의 결과에 따라 고유한 임계값을 가집니다. 0.6에서 잔액을 조회하는 것은 최악의 경우가 사용자가 잔액 낭독을 듣는 것뿐이므로 괜찮습니다. 하지만 송금을 승인하려면 매우 높은 신뢰도(>0.85)가 필요하며, 그렇지 않으면 시스템이 사용자에게 확인을 요청해야 합니다.

신뢰도를 시스템에서 어떻게 생각해야 하는지 더 자세히는 신뢰도를 참조하십시오.