Download example.py from sarvamai/prism: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/sarvamai/prism/resolve/main/example.py
- Command line
-
hf download hf://sarvamai/prism/example.py
-
curl -L -o example.py https://huggingface.co/sarvamai/prism/resolve/main/example.py
1.09 kB
| """Run one request through Sarvam-Prism. Downloads the model (~106 GB) on first use when given the repo id. | |
| python example.py # from the Hugging Face Hub | |
| python example.py /path/to/sarvam-prism # from a local copy | |
| """ | |
| import json, sys | |
| from prism import Prism | |
| model = Prism.from_pretrained(sys.argv[1] if len(sys.argv) > 1 else "sarvamai/prism") | |
| 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)) | |