2323
2424
2525class Prompt (Dialog ):
26- """ Prompts base class
27- Defines the core behavior of prompt dialogs. Extends `Dialog` base class.
26+ """
27+ Defines the core behavior of prompt dialogs. Extends the :class: `Dialog` base class.
2828
2929 .. remarks::
30- When the prompt ends, it should return an object that represents the
31- value that was prompted for.
32- Use `DialogSet.Add(Dialog)` or `ComponentDialog.AddDialog(Dialog)` to add a prompt
33- to a dialog set or component dialog, respectively.
34- Use `DialogContext.PromptAsync(string, PromptOptions, CancellationToken)` or
35- `DialogContext.BeginDialogAsync(string, object, CancellationToken)` to start the prompt.
36- If you start a prompt from a `WaterfallStep` in a `WaterfallDialog`, then the prompt
37- result will be available in the next step of the waterfall.
30+ When the prompt ends, it returns an object that represents the value it was prompted for.
31+ Use :method:`DialogSet.add()` or :method:`ComponentDialog.add_dialog()` to add a prompt to a dialog set or
32+ component dialog, respectively.
33+ Use :method:`DialogContext.prompt()` or :meth:`DialogContext.begin_dialog()` to start the prompt.
34+ .. note::
35+ If you start a prompt from a :class:`WaterfallStep` in a :class:`WaterfallDialog`, then the prompt result will be
36+ available in the next step of the waterfall.
3837 """
3938 ATTEMPT_COUNT_KEY = "AttemptCount"
4039 persisted_options = "options"
4140 persisted_state = "state"
4241
4342 def __init__ (self , dialog_id : str , validator : object = None ):
44- """Creates a new Prompt instance
45- :param dialog_id: Unique ID of the prompt within its parent :class:DialogSet or
46- :class:ComponentDialog.
43+ """
44+ Creates a new :class:`Prompt` instance.
45+
46+ :param dialog_id: Unique Id of the prompt within its parent :class:`DialogSet` or
47+ :class:`ComponentDialog`.
4748 :type dialog_id: str
4849 :param validator: Optional custom validator used to provide additional validation and re-prompting logic for the prompt.
49- :type validator: object
50+ :type validator: Object
5051 """
5152 super (Prompt , self ).__init__ (dialog_id )
5253
@@ -55,17 +56,17 @@ def __init__(self, dialog_id: str, validator: object = None):
5556 async def begin_dialog (
5657 self , dialog_context : DialogContext , options : object = None
5758 ) -> DialogTurnResult :
58- """ Starts a prompt dialog.
59- Called when a prompt dialog is pushed onto the dialog stack and is being activated.
59+ """
60+ Starts a prompt dialog. Called when a prompt dialog is pushed onto the dialog stack and is being activated.
6061
61- :param dialog_context: The dialog context for the current turn of the conversation.
62- :type dialog_context: :class:DialogContext
63- :param options: Optional, additional information to pass to the prompt being started.
64- :type options: object
65- :return: A :class:Task representing the asynchronous operation.
66- :rtype: :class:Task
62+ :param dialog_context: The dialog context for the current turn of the conversation
63+ :type dialog_context: :class:` DialogContext`
64+ :param options: Optional, additional information to pass to the prompt being started
65+ :type options: Object
66+ :return: The dialog turn result
67+ :rtype: :class:`DialogTurnResult`
6768
68- .. remarks ::
69+ .. note ::
6970 If the task is successful, the result indicates whether the prompt is still active
7071 after the turn has been processed by the prompt.
7172 """
@@ -96,16 +97,15 @@ async def begin_dialog(
9697 return Dialog .end_of_turn
9798
9899 async def continue_dialog (self , dialog_context : DialogContext ):
99- """ Continues a dialog.
100- Called when a prompt dialog is the active dialog and the user replied with a new activity.
101-
102- :param dialog_context: The dialog context for the current turn of the conversation.
103- :type dialog_context: :class:DialogContext
100+ """
101+ Continues a dialog. Called when a prompt dialog is the active dialog and the user replied with a new activity.
104102
105- :return: A :class:Task representing the asynchronous operation.
106- :rtype: :class:Task
103+ :param dialog_context: The dialog context for the current turn of the conversation
104+ :type dialog_context: :class:`DialogContext`
105+ :return: The dialog turn result
106+ :rtype: :class:`DialogTurnResult`
107107
108- .. remarks ::
108+ .. note ::
109109 If the task is successful, the result indicates whether the dialog is still
110110 active after the turn has been processed by the dialog.
111111 The prompt generally continues to receive the user's replies until it accepts the
@@ -148,21 +148,21 @@ async def continue_dialog(self, dialog_context: DialogContext):
148148 async def resume_dialog (
149149 self , dialog_context : DialogContext , reason : DialogReason , result : object
150150 ) -> DialogTurnResult :
151- """ Resumes a dialog.
152- Called when a prompt dialog resumes being the active dialog on the dialog stack, such as
153- when the previous active dialog on the stack completes.
151+ """
152+ Resumes a dialog. Called when a prompt dialog resumes being the active dialog
153+ on the dialog stack, such as when the previous active dialog on the stack completes.
154154
155155 :param dialog_context: The dialog context for the current turn of the conversation.
156156 :type dialog_context: :class:DialogContext
157157 :param reason: An enum indicating why the dialog resumed.
158158 :type reason: :class:DialogReason
159- :param result: Optional, value returned from the previous dialog on the stack.
160- The type of the value returned is dependent on the previous dialog.
159+ :param result: Optional, value returned from the previous dialog on the stack.
160+ The type of the value returned is dependent on the previous dialog.
161161 :type result: object
162- :return: A :class:Task representing the asynchronous operation.
163- :rtype: :class:Task
162+ :return: The dialog turn result
163+ :rtype: :class:`DialogTurnResult`
164164
165- .. remarks ::
165+ .. note ::
166166 If the task is successful, the result indicates whether the dialog is still
167167 active after the turn has been processed by the dialog.
168168 Prompts are typically leaf nodes on the stack but the dev is free to push other dialogs
@@ -174,14 +174,14 @@ async def resume_dialog(
174174 return Dialog .end_of_turn
175175
176176 async def reprompt_dialog (self , context : TurnContext , instance : DialogInstance ):
177- """ Reprompts user for input.
178- Called when a prompt dialog has been requested to reprompt the user for input.
177+ """
178+ Reprompts user for input. Called when a prompt dialog has been requested to re-prompt the user for input.
179179
180- :param context: Context for the current turn of conversation with the user.
180+ :param context: Context for the current turn of conversation with the user
181181 :type context: :class:TurnContext
182- :param instance: The instance of the dialog on the stack.
182+ :param instance: The instance of the dialog on the stack
183183 :type instance: :class:DialogInstance
184- :return: A :class:Task representing the asynchronous operation.
184+ :return: A :class:Task representing the asynchronous operation
185185 :rtype: :class:Task
186186 """
187187 state = instance .state [self .persisted_state ]
@@ -196,18 +196,18 @@ async def on_prompt(
196196 options : PromptOptions ,
197197 is_retry : bool ,
198198 ):
199- """ Prompts user for input.
200- When overridden in a derived class, prompts the user for input.
199+ """
200+ Prompts user for input. When overridden in a derived class, prompts the user for input.
201201
202- :param turn_context: Context for the current turn of conversation with the user.
203- :type turn_context: :class:TurnContext
204- :param state: Contains state for the current instance of the prompt on the dialog stack.
202+ :param turn_context: Context for the current turn of conversation with the user
203+ :type turn_context: :class:` TurnContext`
204+ :param state: Contains state for the current instance of the prompt on the dialog stack
205205 :type state: :class:Dict
206206 :param options: A prompt options object constructed from the options initially provided
207- in the call :meth:DialogContext.PromptAsync(string, PromptOptions, CancellationToken).
208- :type options: :class:PromptOptions
207+ in the call :meth:` DialogContext.prompt(self, dialog_id: str, options)`
208+ :type options: :class:` PromptOptions`
209209 :param is_retry: true if this is the first time this prompt dialog instance on the stack is prompting
210- the user for input; otherwise, false.
210+ the user for input; otherwise, false
211211 :type is_retry: bool
212212
213213 :return: A :class:Task representing the asynchronous operation.
@@ -222,15 +222,15 @@ async def on_recognize(
222222 state : Dict [str , object ],
223223 options : PromptOptions ,
224224 ):
225- """ Recognizes the user's input.
226- When overridden in a derived class, attempts to recognize the user's input.
225+ """
226+ Recognizes the user's input. When overridden in a derived class, attempts to recognize the user's input.
227227
228- :param turn_context: Context for the current turn of conversation with the user.
229- :type turn_context: :class:TurnContext
230- :param state: Contains state for the current instance of the prompt on the dialog stack.
228+ :param turn_context: Context for the current turn of conversation with the user
229+ :type turn_context: :class:` TurnContext`
230+ :param state: Contains state for the current instance of the prompt on the dialog stack
231231 :type state: :class:Dict
232232 :param options: A prompt options object constructed from the options initially provided
233- in the call :meth:DialogContext.PromptAsync(string, PromptOptions, CancellationToken).
233+ in the call :meth:` DialogContext.prompt(self, dialog_id: str, options)`
234234 :type options: :class:PromptOptions
235235
236236 :return: A :class:Task representing the asynchronous operation.
@@ -246,24 +246,25 @@ def append_choices(
246246 style : ListStyle ,
247247 options : ChoiceFactoryOptions = None ,
248248 ) -> Activity :
249- """ Composes an output activity containing a set of choices.
249+ """
250+ Composes an output activity containing a set of choices.
250251 When overridden in a derived class, appends choices to the activity when the user is prompted for input.
251252 Helper function to compose an output activity containing a set of choices.
252253
253- :param prompt: The prompt to append the user's choice to.
254+ :param prompt: The prompt to append the user's choice to
254255 :type prompt:
255- :param channel_id: ID of the channel the prompt is being sent to.
256+ :param channel_id: Id of the channel the prompt is being sent to
256257 :type channel_id: str
257- :param: choices: List of choices to append.
258- :type choices: :class:List
259- :param: style: Configured style for the list of choices.
260- :type style: :class:ListStyle
261- :param: options: Optional formatting options to use when presenting the choices.
262- :type style: :class:ChoiceFactoryOptions
263- :return: A :class:Task representing the asynchronous operation.
258+ :param: choices: List of choices to append
259+ :type choices: :class:` List`
260+ :param: style: Configured style for the list of choices
261+ :type style: :class:` ListStyle`
262+ :param: options: Optional formatting options to use when presenting the choices
263+ :type style: :class:` ChoiceFactoryOptions`
264+ :return: A :class:Task representing the asynchronous operation
264265 :rtype: :class:Task
265266
266- .. remarks ::
267+ .. note ::
267268 If the task is successful, the result contains the updated activity.
268269 """
269270 # Get base prompt text (if any)
0 commit comments