How to infer the context from the current conversation or story in the custom action?

I added two stories. The first story/conversation is for getting the current weather The second story is for finding out the current gdp of india

This is only a sample scenario and I know we can achieve it by adding two custom actions for generating response for the above conversations.

Now, I have another requirement is that, I need to raise a jira ticket if the end user is not satisfied with the bot response. In that case, I may need to identify the user’s query from the current context and raise the ticket with the details recieved from that context. Is there any way to do it?

Sure why not – I would suggest something like

##user satisfied
<earlier dialogue state here>
    - utter_ask_satisfied
* affirm 
    - utter_great

##user not satisfied
<earlier dialogue state here>
    - utter_ask_satisfied
* deny
    - utter_ask_feedback
* inform
    - action_raise_ticket

The tracker has access to the last user utterance, so you can use that in your ticket action.

Thank you @erohmensing for your reply.

Well, I can see that the tracker has access to the latest user utterance. But my requirement is a little more complex. I have to create a scenario like, create the ticket immediately after receiving a negative feedback from user. I don’t want to define a separate intent for asking the bot to raise a ticket.

In that case, I need all the messages starting from the intent (the question asked by the user) till end of that conversation (only that story). So that I can raise the ticket with all those details.

For example, I have two intents and two different stories for handling each intent like,

Intents:

#intent:request_current_time

  • What is the current time?

#intent:request_current_weather

  • What is the current weather?

So, the stories would be like.,

story 1

  • request_current_time
    • utter_answer_time
    • utter_ask_satisfied
  • affirm
    • utter_greet

story 2

  • request_current_weather
    • utter_answer_weather
    • utter_ask_satisfied
  • deny
    • action_raise_ticket

In this case, the user has initially started with the first intent and completed a conversation scenario for checking the current time. Then the user again started another conversation for checking the current weather and the user is not satisfied with the answer provided by the bot. Hence, the bot need to raise a ticket for that particular context (conversation scenario). So, the description of the ticket should be somewhat like this.

Ticket Description:

User: What is the current weather? Bot: The current time is blah blah blah Bot: Are you satisfied with this solution? User: No

Kindly note that the ticket should NOT contain the content of the previous conversation (checking time), since the user was happy with that solution provided by the bot. Hence, only the second conversation details should be added as the description for the ticket.

Is there anyway to do it?

thank you, Anoop Mohan (anoop2503)

Hi @erohmensing / anyone,

Any idea, if we can do it or not?

Thank you, Anoop Mohan

What if you only have a story like:

* request_current_weather
   - utter_answer_weather
   - utter_ask_satisfied
* deny OR affirm
   - action_handle_ticket

and then the logic of the action_handle_ticket would handle the logic of whether to make a ticket or not, depending on the most recent intent?

As for

Kindly note that the ticket should NOT contain the content of the previous conversation (checking time), since the user was happy with that solution provided by the bot. Hence, only the second conversation details should be added as the description for the ticket.

I think you could do this by only creating a ticket from the events in the tracker that occurred after the most recent ActionExecuted event where the name of the action was action_handle_ticket. Take a look at the DialogueStateTracker class for more info on all of the information stored in your tracker that you can use for your custom action logic and to create your ticket.

Thank you @erohmensing for your response.

Still my confusion is not about the logic for creating the ticket. But all about the contents that need to be added as description for the ticket.

If we check the most recent intent, that will be only a deny or affirm intent. But I need the initial user input (actual user query), which was being used for starting the conversation, for creating the ticket. Is there anyway to achieve it?

Also, please tell me if there are any example implemented using DialogueStateTracker class. So that I can try with same.

Thank you, Anoop Mohan

@erohmensing, please let me know if you have any idea about how to do it?

Have you looked at storing the entire tracker? It should have your conversation history as well as the slots.

Sorry for making confusion. Yes, I can see that the tracker.events will provide the whole conversation history and that is enough for creating the ticket. Thank you for all your help.