π DefaultΒΆ
templates.selection.by_attribute.default
MultipleChoiceTemplate(
instruction="Which of the {choices_text_type} is the most {required_attribute}, please respond with: {numerals}.",
input_format="{choices_text_type}:
{choices_texts}",
target_prefix="Most {required_attribute}:
",
target_field="choice",
choices_field="choices_texts",
choices_separator="
",
postprocessors=[
"processors.to_string_stripped",
"processors.first_character",
],
shuffle_choices=True,
title_fields=[
"choices_text_type",
],
)
[source]Explanation about MultipleChoiceTemplateΒΆ
Formats the input that specifies a multiple-choice question, with a list of possible answers to choose from, and identifies the correct answer.
- Args:
- target_prefix (str): Optional prefix that can be added before the target label in
generated prompts or outputs.
- choices_field (str): The key under which the multiple choices are stored in the
input and reference dictionaries.
- target_field (str): The key under which the correct choice is stored in the
reference dictionary (can be integer index or textual label).
- choices_separator (str): A string used to join formatted
choices (e.g. β, β).
- source_choice_format (str): A Python format string used for displaying each choice
in the input fields (e.g. β{choice_numeral}. {choice_text}β).
- target_choice_format (str): A Python format string used for displaying each choice
in the target or final output (e.g. β{choice_numeral}β).
- enumerator (str): Determines how choice numerals are enumerated. Possible values
include βcapitalsβ, βlowercaseβ, βnumbersβ, or βromanβ.
- shuffle_choices (bool): If True, shuffle the choices. The shuffling seed can be
set with shuffle_choices_seed.
- shuffle_choices_seed (int, optional): If provided, the choices are shuffled with
this fixed integer seed for reproducibility.
- sort_choices_by_length (bool): If True, sorts choices
by their length (ascending).
- sort_choices_alphabetically (bool): If True, sorts choices
in alphabetical order.
- reverse_choices (bool): If True, reverses the order of the choices after any
sorting has been applied. Defaults to False to preserve backward compatibility.
References: processors.to_string_stripped, processors.first_character
Read more about catalog usage here.