Ines-1 / examples /quickstart.py
Endikavi's picture
Ines-1 RC1 (private staging; release commit f198669): repository root without resolving symlinks
bc5b068 verified
Raw History Blame Contribute Delete
1.08 kB
"""Ines-1 minimal example, from a local copy of the repository: python examples/quickstart.py
One typed question per model prompt: build the question, read the probability of every option, print the argmax.
"""
import sys
from pathlib import Path
ROOT = Path(__file__).absolute().parent.parent # not resolve(): in the Hugging Face cache files are symlinks to blobs
sys.path.insert(0, str(ROOT))
from mini_v41_jev import Decider # noqa: E402
decider = Decider(ROOT) # CUDA if available (bf16 + autocast, the canonical path), otherwise CPU (fp32)
question = {"type": "choice",
"instructions": "Which department should handle this ticket?",
"criteria": {"billing": "payments and invoices", "tech": "outages and bugs", "legal": "disputes"}}
state = "The invoice was charged twice and the customer wants the money back today."
answer = decider.decide(state, {"dept": question}, lang="en")["dept"]
print("argmax:", answer["choice"])
for option, p in sorted(answer["probabilities"].items(), key=lambda kv: -kv[1]):
print(" %-8s %.3f" % (option, p))