modos.prompt#
Classes#
Auto-suggestions for terminology codes. |
|
Introspects the schema to prompt the user for values based on input class/slot. |
Functions#
|
Given a pre-configured matcher, prompt the user with live auto-suggestions. |
Module Contents#
- class modos.prompt.SlotCodeCompleter(matcher)[source]#
Bases:
prompt_toolkit.completion.Completer
Auto-suggestions for terminology codes.
- Parameters:
matcher (modos.codes.CodeMatcher)
- get_completions(document, complete_event)[source]#
This should be a generator that yields
Completion
instances.If the generation of completions is something expensive (that takes a lot of time), consider wrapping this Completer class in a ThreadedCompleter. In that case, the completer algorithm runs in a background thread and completions will be displayed as soon as they arrive.
- Parameters:
document –
Document
instance.complete_event –
CompleteEvent
instance.
- modos.prompt.fuzzy_complete(prompt_txt, matcher)[source]#
Given a pre-configured matcher, prompt the user with live auto-suggestions.
- Parameters:
prompt_txt (str)
matcher (modos.codes.CodeMatcher)
- class modos.prompt.SlotPrompter(endpoint=None, suggest=True, prompt=None)[source]#
Introspects the schema to prompt the user for values based on input class/slot.
- Parameters:
endpoint (Optional[modos.remote.EndpointManager]) – Endpoint running a fuzon server for code matching.
suggest – Whether to generate auto-suggestion dynamically.
prompt (Optional[str]) – Override the default prompt messages.
- prompt_for_slots(target_class, exclude=None)[source]#
Prompt the user to provide values for the slots of input class. values of required fields can be excluded to repeat the prompt.
- Parameters
- target_class
Class to build
- exclude
Mapping with the name of a slot as key and list of invalid entries as values.