Choice#
Gives the assistant the ability to present multiple-choice options to the user for selection.
Instructions
The options can be provided as a question on the first line and each option on a separate line.
When using the ``options`` keyword argument, options may also be comma-separated.
The tool will present an interactive menu allowing the user to select an option using arrow keys and Enter, or by typing the number of the option.
### When to use choice
Use when you need to present the user with a discrete set of named alternatives and free-text input would be ambiguous. Don't use for simple yes/no confirmations; don't use when the next step is already clear from context.
Examples
Basic usage with options
| User |
What should we do next? |
| Assistant |
Let me present you with some options: |
| System |
User selected: Add new features |
| User |
What should we do next? |
| Assistant |
Let me present you with some options: |
| System |
User selected: Option two |
- gptme.tools.choice.execute_choice(code: str | None, args: list[str] | None, kwargs: dict[str, str] | None) Generator[Message, None, None]
Present multiple-choice options to the user and return their selection.