Skip to content

Few-shot examples and explain

Choice, Score and Noul questions accept up to 10 labeled examples. They usually raise accuracy and make the answer less sensitive to exact wording.

from curva import Noul, Choice
urgent = Noul("Is this urgent?", examples=[
({"ticket": "The production server is down"}, True),
({"ticket": "Typo on the pricing page"}, False),
])
team = Choice("Which team?", ["billing", "technical"], examples=[
({"ticket": "Refund my last invoice"}, "billing"),
])

Each example is a (state, label) pair, with the label written as in feedback: an option key, a level index, or True/False. Over HTTP:

"examples": [{"state": {"ticket": "The production server is down"}, "label": true}]

Examples are fenced as data in the prompt, and their labels are remapped when debiasing reverses the options.

explain=True shows which parts of the state drove each answer:

d = client.decide(
{"subject": "Invoice", "body": "I was charged twice", "signature": "Sent from my phone"},
{"refund": Noul("The customer asks for money back")},
explain=True,
)
print(d["refund"].explain)
# e.g. {"subject": 0.05, "body": 0.62, "signature": 0.0}

Curva re-asks the question with each top-level field of the state left out, concurrently, and reports how much the answer’s probability drops without it. A large number means the field mattered; 0 means it didn’t.

  • The state must be a JSON object. At most 12 top-level fields are explained.
  • It costs one extra model call per field, so use it for audits and debugging rather than on every request.

HTTP: "explain": true. Each answer gets "explain": {"field": drop}.

© 2026 Tarkova Private Limited.