# Few-shot examples and explain

> Improve Curva answers with up to 10 labeled few-shot examples per question, and use explain to see which parts of the state drove an answer.

Source: https://docs.tarkova.com/curva/guides/explain/

## Few-shot examples

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

```python
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](/curva/guides/feedback/): an option key, a level index, or `True`/`False`. Over HTTP:

```json
"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](/curva/concepts/trust/#order-debiasing) reverses the options.

## Explain

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

```python
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}`.
