Session Ready
Exercise

Pending actions II

Having defined your policy() function, it's now time to write a send_message() function which takes both a pending action and a message as its arguments and leverages the policy() function to determine the bot's response.

Your policy(intent) function from the previous exercise has been pre-loaded.

Instructions
100 XP
  • Define a function called send_message() which takes in two arguments: pending and message.
  • Pass in the interpretation of message as an argument to policy() and unpack the result into the variables action and pending_action.
  • If the action is "do_pending" and pending is not None, print the pending response. Else, print the action.
  • Inside the definition of the send_messages() function, call your send_message() function with pending and msg as arguments. Then, hit 'Submit Answer' to send the messages and see the results.