Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lex SLU should add additional values to NluData: messages, sessionState #1283

Closed
1 of 4 tasks
rmtuckerphx opened this issue Apr 16, 2022 · 1 comment
Closed
1 of 4 tasks

Comments

@rmtuckerphx
Copy link
Contributor

I'm submitting a...

  • Bug report
  • Feature request
  • Documentation issue or request
  • Other... Please describe:

Lex can take control of slot filling and uses the following values:

  • messages - defined in Lex to prompt the user for slots or for confirmation
  • intent.state - determines the different states of an intent(ReadyForFulfillment, Failed, InProgress)
  • sessionState - includes dialog managment including the action and slot to elicit

Expected Behavior

I would expect the following values to be available from this.$input.nlu:

nluData.resolved = response.interpretations[0];
nluData.matches = response.interpretations;
nluData.messages = response.messages;
nluData.sessionState = response.sessionState;

That way they can be used in an intent like this:

  BookHotel() {
    const resolved = this.$input.nlu?.resolved as any;
    if (resolved.intent.state === 'ReadyForFulfillment') {

      // make api call

      return this.$send({
        message: "The room has been booked!",
      });
    }

    if (resolved.intent.state === 'Failed') {
      return this.$send({
        message: "No worries. Maybe next time.",
      });
    }

    // intent.state equals 'InProgress'

    const messages = this.$input.nlu?.messages as any[];
    const output: OutputTemplate = {
      message: messages[0].content,
    };

    const quickReplies: {[key: string]: any} = {
      RoomType: ['king', 'queen', 'deluxe']
    };

    const sessionState = this.$input.nlu?.sessionState as any;
    if (sessionState.dialogAction.type === 'ElicitSlot') {
      const slotToElicit:string = sessionState.dialogAction.slotToElicit;
      if (quickReplies[slotToElicit]) {
        output.quickReplies = quickReplies[slotToElicit];
      }
    }

    return this.$send(output);
  }

Current Behavior

There is currently no way to access:

  • messages
  • intent.state
  • sessionState

Error Log

No error

Your Environment

  • Jovo Framework version used: 4.2.8
  • Operating System: Windows 10 10.0.22000
@jankoenig
Copy link
Member

Thank you @rmtuckerphx! Your PR was merged and released today

rubenaeg pushed a commit to die-lautmaler/jovo-framework that referenced this issue Jun 13, 2022
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

No branches or pull requests

2 participants