INNER CODE UNIT · Python
map_choice
hyperonym/basaran · basaran/choice.py:6
def map_choice(
text,
index,
token=None,
token_logprob=None,
top_logprobs=None,
text_offset=None,
finish_reason=None,
):
"""Create a choice object from model outputs."""
choice = {
"text": text,
"index": index,
"logprobs": None,
"finish_reason": finish_reason,
}
# Include log probabilities of the selected and most likely tokens.