File size: 1,115 Bytes
127ebd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"""Score two questions about one state with BunGPT-DeepEdu-Decision-4B-Open.

    python examples/quickstart.py --model <path or hub id>
"""
import argparse
import json

from deepedu_decision import DecisionModel

parser = argparse.ArgumentParser()
parser.add_argument("--model", required=True, help="local checkpoint directory or Hugging Face Hub repo id")
parser.add_argument("--device", default="cuda:0")
args = parser.parse_args()

model = DecisionModel.from_pretrained(args.model, device=args.device)

state = "Customer message: 'I was charged twice for my March invoice and need one of the charges reversed.'"
questions = {
    "route": {
        "type": "choice",
        "instructions": "Which team should handle this message?",
        "criteria": {
            "billing": "Charges, invoices, refunds",
            "technical": "Bugs, outages, how-to questions",
            "sales": "New purchases, pricing, upgrades",
        },
    },
    "urgent": {"type": "noul", "instructions": "Does the customer ask for immediate action?"},
}

out = model.decide(state, questions)
print(json.dumps(out, indent=2))