Prompts
Here is a detailed reference of all of the available user prompts available in Graphbook for enabling human-in-the-loop and user feedback.
Tip
Applies to graphbook.prompt()
and graphbook.steps.PromptStep
.
- graphbook.prompts.bool_prompt(note: Note, *, msg: str = 'Continue?', style: str = 'yes/no', default: bool = False, show_images: bool = False)
Prompt the user with a yes/no for binary questions.
- Parameters:
note (Note) – The current note that triggered the prompt.
msg (str) – An informative message or inquiry to display to the user.
style (str) – The style of the bool prompt. Can be “yes/no” or “switch”.
default (bool) – The default bool value.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.
- graphbook.prompts.dict_prompt(note: Note, *, msg: str = 'Enter a dictionary:', default: dict = {}, show_images: bool = False)
Prompt the user to enter a dictionary.
- Parameters:
note (Note) – The current note that triggered the prompt.
msg (str) – An informative message or inquiry to display to the user.
default (dict) – The default dictionary value.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.
- graphbook.prompts.list_prompt(note: Note, type: str = 'string', *, msg: str = 'Enter a list:', default: list = [], show_images: bool = False)
Prompt the user to enter a list.
- Parameters:
note (Note) – The current note that triggered the prompt.
type (str) – The type of the list elements. Can be “string”, “number”, “dict”, or “bool”.
msg (str) – An informative message or inquiry to display to the user.
default (list) – The default list value.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.
- graphbook.prompts.number_prompt(note: Note, *, msg: str = 'Enter a number:', default: float = 0.0, show_images: bool = False)
Prompt the user to enter a number.
- Parameters:
note (Note) – The current note that triggered the prompt.
msg (str) – An informative message or inquiry to display to the user.
default (float) – The default number value.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.
- graphbook.prompts.selection_prompt(note: Note, choices: List[str], *, msg: str = 'Select an option:', default: List[str] | str | None = None, show_images: bool = False, multiple_allowed: bool = False)
Prompt the user to select an option from a list of choices.
- Parameters:
note (Note) – The current note that triggered the prompt.
choices (List[str]) – A list of strings representing the options the user can select.
msg (str) – An informative message or inquiry to display to the user.
default (List[str] | str) – The default value. If multiple_allowed is True, this should be a list of strings.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.
multiple_allowed (bool) – Whether the user can select multiple options from the list of given choices.
- graphbook.prompts.text_prompt(note: Note, *, msg: str = 'Enter text:', default: str = '', show_images: bool = False)
Prompt the user to enter text.
- Parameters:
note (Note) – The current note that triggered the prompt.
msg (str) – An informative message or inquiry to display to the user.
default (str) – The default text value.
show_images (bool) – Whether to present the images (instead of the Note object) to the user.