# Choosing from your own objects

> chooseFrom().seenAs().by().orNone(), and the difference between "none" and "uncertain".

`given(x).chooseFrom(candidates)` asks the model to pick one of the objects you pass in, by a criterion in prose. The answer is the object itself, not a label you then have to map back.

```ts
import { given } from "jevlish";
import { engineers, ticket } from "./support.js";


const owner = await given({ ticket: { subject: ticket.subject, body: ticket.body } })
  .chooseFrom(engineers)
  .seenAs((e) => ({ expertise: e.expertise, recentWork: e.recentWork }))
  .by("whose experience best matches the problem described in ticket")
  .orNone("none of the engineers has relevant experience for this ticket");


// Three different things, kept apart:
if (owner.status === "uncertain") {
  // the model's confidence missed the policy
} else if (owner.value === null) {
  // the model chose "none of these" — a legitimate answer, not an abstention
} else {
  owner.value.name; // one of your own Engineer objects, returned whole
}
```

* `given(...)` is the subject the choice is about. Here it is a projection of the ticket, wrapped in an object so the criterion can refer to it by name.
* `.chooseFrom(candidates)` are your objects. Up to 255 of them (254 with `orNone`); narrow the list in code first if it is bigger.
* `.seenAs(fn)` is what the model sees of each candidate. The chosen candidate comes back whole.
* `.by(criterion)` states the Choice criterion. It compiles to a Jev Choice question with one option per candidate.
* `.orNone(description)` adds a “none of these” option, described so the model knows what it means.

## Three outcomes, kept apart

A choice resolves to `Judgment<C>` or, with `orNone`, `Judgment<C | null>`:

* `status: "decided"` with `value` one of your candidates: the model chose, and its confidence met `policy.choice.minConfidence`.
* `status: "decided"` with `value: null`: the model chose “none of these”. That is a legitimate answer with high confidence, not an abstention.
* `status: "uncertain"`: confidence missed the policy. Nothing was chosen.

Conflating the last two is the mistake this API is shaped to prevent. “No engineer fits” and “I could not tell” call for different code.

## Inside `ask`

`chooseFrom(candidates).by(criterion)` without a `given` in front is a Choice value. Put it in `given(x).ask({ ... })` to ask it alongside other questions in the same request. See [Asking several questions](/Jevlish/guides/ask/).

## Evidence

The `choice` record in `judgment.evidence.judgments` has the internal option id (`option_1`, `option_2`, and so on), the confidence, and the full probability distribution over those options, so a close call is visible after the fact. The returned judgment still contains your original object. See [Evidence and tracing](/Jevlish/guides/evidence/).