Botframework-solutions: how to pass data from virtual assistant to a skill and vice versa

Created on 10 Dec 2020  路  6Comments  路  Source: microsoft/botframework-solutions

Project: MS BOT
Language:: Typescript

Modules: At both Skill & VA level

   "bot-solutions": "^1.0.0",
    "botbuilder": "^4.11.0",
    "botbuilder-ai": "^4.11.0",
    "botbuilder-applicationinsights": "^4.11.0",
    "botbuilder-azure": "^4.11.0",
    "botbuilder-dialogs": "^4.11.0",
    "botbuilder-lg": "^4.11.0",
    "botframework-config": "^4.11.0",
    "botframework-connector": "^4.11.0",

What happens?:

  • We are actually migrating from botbuilder 4.6.0 to 4.11.0, and as part of that, we created a brand new VA and Skill as per this and see the latest framework is trying to pass data from VA to a Skill like this in mainDialog.ts. But we are not able to get the same data in Skill level what we are updated in context at VA level.

We would like to get the userState data into Skill context from VA context to use the data in flows at Skill level.

We used to share the existing user data like user profile b/w VA and Skill. We maintain which parameter should pass to Skill in manifest.json file like below.

{
  "id": "l_test",
  "name": "testskill",
  "description": "This is the description of the test skill",
  "iconUrl": "",
  "authenticationConnections": [],
  "actions": [
    {
      "id": "test_skill_Sample",
      "definition": {
        "description": "Trigger test skill",
        "slots": [{
          "name": "userState",
          "types": ["IUserState"]
        }],
        "triggers": {
          "utteranceSources": [
            {
              "locale": "en",
              "source": [
                "testskill#Sample"
              ]
            }
          ]
        }
      }
    }
  ]
}

In VA maindialog.ts file

if (this.isSkillIntent(dispatchIntent)) {
                            const dispatchIntentSkill: string = dispatchIntent;
                            const skillDialogArgs: BeginSkillDialogOptions = {
                                activity: activity as Activity
                            };

                            console.log(`skillDialogArgs ---> ${JSON.stringify(skillDialogArgs)}`);
                            // Save active skill in the state.
                            const selectedSkill: IEnhancedBotFrameworkSkill | undefined = this.skillsConfig.skills.get(dispatchIntentSkill);
                            if (selectedSkill){
                                await this.activeSkillProperty.set(stepContext.context, selectedSkill);
                            }
                            // Start the skill dialog.
                            return await stepContext.beginDialog(dispatchIntentSkill, skillDialogArgs);      
                        }

How do I send the state data from VA and read the same state in Skill?

Thanks,
Sreekanth (Ecolab)

Bot Services Needs Triage Kobuk Bug customer-replied-to customer-reported

All 6 comments

@Batta32 can you please take a look at this?

Sure @tonyanziano, we will review this issue with the team!

@SreekanthOAuth, we will start reviewing all the information you provided. As soon as we have any update, we will back to you here 馃槉.

@Batta32 , do you have any updates on this issue?

Yes @taicchoumsft, we were finishing some validations on our side. This week we will have an update!

Hi @SreekanthOAuth, sorry for the delay. The current method to implement this functionality is described in /virtual-assistant/handbook/exchanging-data-with-skills/ document.

We were able to exchange information between a TypeScript Virtual Assistant and a TypeScript Skill following that guide. We created the branch feature/southworks/exchange-data-with-skill so you can see the implementation.

SDK 4.11 is only compatible with 1.0 TypeScript bots, which have not been offically released yet, so use SDK 4.9 as contains the samples of the attached branch.

In the branch you will find:

  1. Implement va-skill exchange

    • Replaces the usual waterfall dialogs in the Virtual Assistant with the implementation for the Exchange with the Skill

    • Implements the logic of the Exchange on the Skill side

    • Updates the SampleResponses.lg so it can be used with the new Skill example logic

  2. Anchor SDK version

    • Updates the package.json and package-lock.json to use the SDK 4.9

We will be attentive to your response 馃檪.

exchanging information

@Batta32 , Thank you so much for the update.

We will try out this resolution and come back.

Thanks,
Sreekanth.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VladPapacostea-SM picture VladPapacostea-SM  路  3Comments

jbonet07 picture jbonet07  路  4Comments

ericmaino picture ericmaino  路  3Comments

hansmbakker picture hansmbakker  路  3Comments

darrenj picture darrenj  路  3Comments