Rasa core http api to get the next action name by passing a conversation

Here is my stories file

Generated Story -1896663359942579296

  • Positive
    • utter_intro
  • Existing_customer
    • utter_already_customer
    • export

Generated Story -1896663359972579296

  • Positive
    • utter_intro
  • Negative
    • utter_line
  • Negative
    • utter_four
  • Pay
    • utter_pay
    • export

Generated Story -1895663359972579296

  • Positive
    • utter_intro
  • Negative
    • utter_line
  • Query
    • utter_from_where
    • export

Generated Story -1895663359072509296

  • Positive
    • utter_intro
  • Voicemail
    • utter_voicemail
    • export

As you can see my stories is an alternate flow of an intent and utterance. How do I use api to get the next utterance only for a corresponding intent. Lets say I post Positive->utter_intro->Existing_customer . The api should return me just the next utterance that is utter_alredy_customer . Or may be the api keeps a track of the conversation and I just keep posting intents and getting response actions, fallback if flow not possible. I had a look at the docs but could not understand well. @souvikg10 help will be really appreciated.

If you are using Rasa core version 0.11 , the /parse and /continue endpoint has been deprecated and hence there are webhooks

/webhooks/your-chanel/webhook - so in teh case of rest , it will be /webhooks/rest/webhook This will directly respond with the utterance you can check my example code on version 0.11

If you to get the latest tracker information, use GET /tracker API - more information here

1 Like

yeah got that, but I am still confused as to how do I get the next utterance action given a certain story path. I could get the tracker information, but instead getting the utterance it self, I want the next utterance name eg given Positive->utter_intro->Negative->utter_ibtor->Query I want the next state as utter_from_where

You want the next prediction? It is similar to the webhook i mentioned above, if you post your message or simply intent like “/hello”, it will provide you the next utterance. You won’t have that information in the tracker before the event has occured, if you just want the next action load the Agent and try

agent.predict_next(sender_id)
1 Like

Thanks for giving me a direction, I know a way by using utterance=agent.handle_text() , I can get the next utterance for the story. The way i’ll do it is, i’ll name action and the text of the utterance the same. Eg. utter_intro=“utter_intro” and parse it my program to do complicated operations on utterance. One last question I have is what is the api endpoint/webhood for the function agent.handle_text() ?

Not sure the difference between agent.handle_text() or agent.handle_message() but /webhooks/rest/webhook will give you the next utterance.

If you want to execute some custom action why not use the custom action server by making Rasa your middle layer between your functions and UI. You can check my code above on how i did that

If you simply want the next action with prediction score (predict_next is the function to use - you can add an endpoint around it as well