Skip to main content

get_vote

Function get_vote 

Source
pub fn get_vote(
    pfx_tree: PfxTree,
    with_ticks_pattern: &str,
    without_ticks_pattern: &str,
    responses_len: usize,
    choice: &Choice,
) -> Option<Vec<Decimal>>
Expand description

Extracts a vote from an LLM choice.

Parses the response to find selected response keys and converts them into a probability distribution. When logprobs are available, uses them to capture the model’s preference distribution (probabilistic voting). Otherwise, falls back to discrete voting based on the final sampled token.

Returns None if no response key is found in the content.