C++ · Choices

Choices

#include <uform/encode.hpp> 4.0.0-rc.1 · c58749fe

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/uform/cpp/choices.md' | claude -p "How would this fit my code?"

text_choose(texts, choices, ..) scores each item’s legal choices, one byte each, through one forward, and answers a tape_view<float> of one probability per choice that sums to one per item:

std::uint32_t const groups[] = {0, 1};
auto [probabilities, status] = model.text_choose(states, choices, {.temperature_groups = groups}, arena);
std::span<float const> const expand = probabilities.entry(1); // the probabilities of 'A' through 'D'

Each group is a question type below the model’s choice_temperature_groups, and a model without the byte decoder answers status_code_t::unsupported_k.

API

Types

text_choose_config_tThe knobs of text_choose.
encode.hpp:111 ↗
struct text_choose_config_t

Fields

temperature_groupsstd::span<std::uint32_t const>The question type of each item, below the model's choice_temperature_groups; empty puts every item in group zero.
progressprogress_tHears the items scored, and may cancel the call.
statsuform_text_encode_stats_t *The report the call overwrites; nullptr skips it.