QSIV / examples /quickstart.py
djinn-san's picture
Super-squash branch 'main' using huggingface_hub
ba99bd4
Raw History Blame Contribute Delete
1.07 kB
"""QSIV quick start: calibrated typed decisions in one forward pass (run from the repository root)."""
from qsiv.runtime.service import QSIVService
svc = QSIVService("qsiv_fp8.safetensors", "calibration.json", tokenizer_dir="tokenizer")
request = {
"state": ("Refund policy: customers may return items within 30 days of delivery for a full refund. Items marked FINAL SALE "
"cannot be returned.\nCase: order 5521 was delivered on March 2; the customer asked for a refund on March 20 for "
"an unopened blender that was not marked FINAL SALE."),
"questions": [
{"type": "noul", "text": "Is the customer entitled to a full refund?"},
{"type": "choice", "text": "Which rule decides this case?", "options": ["30-day window", "FINAL SALE exclusion", "none"]},
{"type": "score", "text": "How confident can an agent be in approving?", "levels": ["low", "medium", "high"]},
],
}
for d in svc.decide(request):
print({k: (round(v, 3) if isinstance(v, float) else v) for k, v in d.items() if k != "probs"})