File size: 1,258 Bytes
2d2f883
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Run one request through Sarvam-Prism INT4 (any CUDA GPU with ~10-16 GB, >= 64 GB host RAM).
    python example.py                       # from the Hugging Face Hub
    python example.py /path/to/local/copy   # from a local copy
    python example.py . 12                  # cap GPU memory use at 12 GiB
"""
import json, sys
from prism_int4 import Prism

model = Prism.from_pretrained(sys.argv[1] if len(sys.argv) > 1 else "jc-914/prism-quantized",
                              gpu_memory_gb=float(sys.argv[2]) if len(sys.argv) > 2 else None)
answers = model.decide(
    state={"ticket": "My card was charged twice for the same order and I still haven't got a refund."},
    questions={
        "team": {"type": "choice", "instructions": "Which team should handle this ticket?",
                 "criteria": {"billing": "payments, charges and refunds", "tech": "app or website problems",
                              "delivery": "shipping and order status"}},
        "urgent": {"type": "yes_no", "instructions": "Does this need a reply within the hour?"},
        "anger": {"type": "score", "instructions": "How upset is the customer?",
                  "criteria": ["calm", "annoyed", "angry", "furious"]},
    })
print(json.dumps(answers, indent=2))