Combine noul, choice, and score
Description
Liquid’s combined usage example: classify, route, and prioritize one ticket in a single call.
Copy
import os
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
client = TypeSafeClient(
api_key=os.environ["LIQUID_API_KEY"],
base_url="https://api.liquid.ai",
)
result = client.system_one(
model="d1-ultra",
state={
"message": "The checkout page crashes with a white screen whenever I try to apply a promo code. I've tried three different browsers. This is blocking a $4,200 order for our team and we need to place it before our procurement window closes on Friday.",
"account": {
"plan": "enterprise",
"arr": 52000,
"customer_since": "2022-03-15"
}
},
questions={
"is_bug": Noul(
instructions="Is the customer reporting a software bug (as opposed to a usage question, feature request, or account issue)?",
),
"team": Choice(
instructions="Which team should handle this ticket?",
criteria={
"billing": "Billing, invoicing, charges, and payment method issues",
"engineering": "Software bugs, crashes, and technical malfunctions",
"frontend": "UI/UX issues, display problems, and browser-specific bugs",
"account": "Account setup, permissions, plan changes, and access issues"
},
),
"urgency": Score(
instructions="How urgent is this ticket? Consider business impact, time sensitivity, and customer tier.",
criteria=[
"Low: no immediate impact, standard queue",
"Medium: some business impact, handle within 24 hours",
"High: significant business impact or time-sensitive, handle within 4 hours"
],
)
},
)
Worked example
Illustrative for this sample state, not a live run
Sample state
{
"message": "The checkout page crashes with a white screen whenever I try to apply a promo code. I've tried three different browsers. This is blocking a $4,200 order for our team and we need to place it before our procurement window closes on Friday.",
"account": {
"plan": "enterprise",
"arr": 52000,
"customer_since": "2022-03-15"
}
} is_bugIs the customer reporting a software bug (as opposed to a usage question, feature request, or account issue)?
teamWhich team should handle this ticket?
- billing 2%
Billing, invoicing, charges, and payment method issues
- engineering · selected 80%
Software bugs, crashes, and technical malfunctions
- frontend 18%
UI/UX issues, display problems, and browser-specific bugs
- account 0.1%
Account setup, permissions, plan changes, and access issues
Confidence 74%
urgencyHow urgent is this ticket? Consider business impact, time sensitivity, and customer tier.
Score 2.00 on 0–2
- 0. Low: no immediate impact, standard queue 0%
- 1. Medium: some business impact, handle within 24 hours 0.4%
- 2. High: significant business impact or time-sensitive, handle within 4 hours 99.6%
Confidence 99.5%
What you might do next
If `is_bug` is above 0.7 and `urgency` is above 1.5, escalate to that team’s on-call (4h SLA). If `urgency` is above 1.0, prioritize in that team’s queue (24h SLA). Otherwise use the standard backlog. If team confidence is below 0.5, note the runner-up.