Files
sysone/smoke_test.py
zzgandClaude Sonnet 5 2f141fd1e4 Rename project to sysone; rewrite README as current-state docs
Renamed the repo (git.z.gd/zzg/localjev -> git.z.gd/zzg/sysone) and the
Python package (jev_local -> sysone) now that this only depends on laya,
not kev. README rewritten from scratch as a description of what this is
today rather than a narrative of how it got here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-19 14:19:19 -07:00

41 lines
1.8 KiB
Python

from sysone import Choice, Classifier, Noul, Score
classifier = Classifier()
urgent = classifier.invoke(
state="Hi, I've been trying to connect my Stripe account for 3 days and it keeps failing. I'm losing sales. Please help ASAP.",
questions={"is_urgent": Noul(instructions="The message conveys urgency or time-sensitivity")},
)
calm = classifier.invoke(
state="Hey, whenever you get a chance, could you point me to the docs for webhooks? No rush at all.",
questions={"is_urgent": Noul(instructions="The message conveys urgency or time-sensitivity")},
)
urgent_p = urgent.nouls["is_urgent"].noul
calm_p = calm.nouls["is_urgent"].noul
print(f"urgent message -> P(urgent) = {urgent_p:.3f}")
print(f"calm message -> P(urgent) = {calm_p:.3f}")
assert urgent_p > calm_p, "expected the urgent message to score higher than the calm one"
routing = classifier.invoke(
state="Our production database is down and customers can't check out.",
questions={"team": Choice(instructions="Which team should handle this?", options=["billing", "technical", "sales"])},
)
result = routing.choices["team"]
print(f"routing -> {result.probs} (best={result.best}, confidence={result.confidence:.3f})")
assert result.best == "technical"
anger = classifier.invoke(
state="This is the third time I've had to contact you about the same issue. Completely unacceptable.",
questions={
"frustration": Score(
instructions="How frustrated does the customer appear?",
levels=["calm", "mildly annoyed", "frustrated", "very frustrated", "furious"],
)
},
)
score_result = anger.scores["frustration"]
print(f"frustration -> score={score_result.score:.2f}, confidence={score_result.confidence:.3f}")
assert score_result.score >= 2.0 # index into levels: 2 == "frustrated"
print("all smoke checks passed")