Bearprompt logo Bearprompt
Back to d1-ultra
d1-ultra Choice
How to run d1-ultra

Classify a customer inquiry

Description

A Choice from Liquid’s usage examples: closed labels, a distribution, and a confidence value.

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="Hi, I was charged twice for my subscription last month. The amounts are $29.99 on March 3rd and again on March 5th. Can you refund the duplicate charge?",
    questions={
        "intent": Choice(
            instructions="What is the primary topic of this customer inquiry?",
            criteria={
            "billing": "Questions about charges, invoices, refunds, or payment methods",
            "technical": "Bug reports, feature requests, or how-to questions about the product",
            "shipping": "Order status, delivery tracking, or shipping address changes",
            "returns": "Return requests, exchanges, or product condition issues",
            "account": "Login issues, profile updates, or subscription management"
        },
        )
    },
)

Worked example

Illustrative for this sample state, not a live run

Sample state

Hi, I was charged twice for my subscription last month. The amounts are $29.99 on March 3rd and again on March 5th. Can you refund the duplicate charge?
Choice intent

What is the primary topic of this customer inquiry?

  • billing · selected 100%

    Questions about charges, invoices, refunds, or payment methods

  • technical 0%

    Bug reports, feature requests, or how-to questions about the product

  • shipping 0%

    Order status, delivery tracking, or shipping address changes

  • returns 0%

    Return requests, exchanges, or product condition issues

  • account 0%

    Login issues, profile updates, or subscription management

Confidence 100%

What you might do next

Map `intent` onto a queue (`billing-team`, `engineering-support`, `logistics`, `returns-desk`, `account-management`) and log the confidence.

Tags

choicesupport
Loading...