def sample
import bend-ml-llama@0.2.1.0/main.bend as BendMlLlamaimport Base
1260# a token drawn from the logits xs (its id and logit) with temperature temp > 0, the k > 0 largest logits and top-p
1261# p, by the uniform draw u
1262def sample(+xs: List<&2, F32>, +temp: F32, +k: Nat, +p: F32, +u: F32) -> Cand:
1263 +cs = topk(k, xs)
1264 sample.cs(cs, temp, top_of(cs), p, u)