hellostealth / stealth

An open source Ruby framework for text and voice chatbots. 🤖
https://hellostealth.org
MIT License
584 stars 57 forks source link

Send additional context to NLP drivers #382

Open mgomes opened 1 year ago

mgomes commented 1 year ago

Currently NLP drivers receive only the message sent by a user. In more advanced NLP cases, it would be helpful to also have the reply the bot sent to the user for context.

Additionally, there should be a way for NLP drivers to be able to access all potential intent and entity matches. For example, given this handle_message() block:

handle_message(
  :yes => proc {
    step_to state: :say_proceed
  },
  'Remind me later' => proc { step_to state: :say_no_problem },
  :no => proc { step_to state: :say_goodbye },
  :call => proc {
    step_to state: :ask_when_to_call
  }
)

The NLP helper should be able to access all hash keys arguments. That would be [:yes, "Remind me later", :no, :call]