Skip to content

Conversation

@Zerryth
Copy link
Contributor

@Zerryth Zerryth commented Nov 18, 2020

Fixes #670

Description

In WaterfallDialog.get_step_name method, it uses __qualname__ dunder method to get a unique name for the waterfall step

    def get_step_name(self, index: int) -> str:
        """
        Give the waterfall step a unique name
        """
        step_name = self._steps[index].__qualname__

        if not step_name or ">" in step_name:
            step_name = f"Step{index + 1}of{len(self._steps)}"

        return step_name

The method's intention is to only create and assign a name if the waterfall step is anonymous, which commonplace in C# and JS SDKs.

However, because the full qualname is given, ">" is present, even if waterfall steps defined with a name (i.e. no anonymous methods used to define steps). This results in an overapplication of renaming waterfall step names, even if the step already has a name to begin with.

Click to see more detailed example

Create a waterfall dialog that has one step, which is defined by a function named get_user_name.

async def get_user_name(step):
   # do stuff
   return Dialog.end_of_turn

dialog = WaterfallDialog("my_dialog", steps=[get_user_name])

Expected Step Name from get_step_name

<full_qualname_prefix>+ .get_user_name

Actual Name from get_step_name

Step1of1

  • It's been reassigned a name, even though the step already had a name

Specific Changes

  • Will only create and assign a step name if waterfall step_name is not present or if ends with <lambda>

Testing

  • Test unit test added to verify telemetry works properly in waterfall dialogs

@tracyboehrer tracyboehrer merged commit 1ce420b into main Dec 2, 2020
@tracyboehrer tracyboehrer deleted the Zerryth/correct-dialog-step-name branch December 2, 2020 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[PORT] Create test for waterfall cancellation telemetry

3 participants