import json, sys, time import numpy as np, coremltools as ct from transformers import AutoModel, AutoTokenizer import pack state = ("Subject: URGENT - payment failed for order #88213\n\nHi, I tried to pay for my annual Pro plan renewal " "with my Visa ending 4421 but the charge was declined twice, and now my team of 12 is locked out of the dashboard. " "We have a board demo tomorrow at 9am PST. I already contacted my bank and they say the card is fine. Can you " "please extend access for 48 hours and send me an invoice I can pay by wire instead? Also, the export to CSV " "feature has been timing out since last week. Thanks, Dana (Head of Ops, Brightline Logistics)") yn = ["Is this about a failed payment?", "Is the customer locked out?", "Is there a deadline mentioned?", "Does the customer ask for an invoice?", "Is a bug reported?", "Is the customer angry?", "Is this spam?", "Is this a phishing attempt?", "Is the sender an existing customer?", "Does the message mention a team size?", "Does the customer request a refund?", "Does the customer want to cancel?", "Is wire transfer mentioned?", "Is a credit card mentioned?", "Is personal data shared?", "Does it need a reply today?"] Q = {} for i in range(64): k = i % 4 if k == 0: Q[f"q{i}"] = {"type": "noul", "instructions": yn[(i // 4) % 16] + ("" if i < 32 else " (strict)")} elif k == 1: Q[f"q{i}"] = {"type": "choice", "instructions": f"Which team should own item {i}?", "criteria": {"billing": "Payments and invoices", "support": "Product bugs", "sales": "Plans and upgrades", "security": "Fraud and access"}} elif k == 2: Q[f"q{i}"] = {"type": "score", "instructions": f"Urgency rating {i}?", "criteria": ["None", "Low", "Medium", "High", "Critical"]} else: Q[f"q{i}"] = {"type": "choice", "instructions": f"Overall sentiment {i}?", "criteria": {"pos": "Positive", "neu": "Neutral", "neg": "Negative"}}