Respond API is providing an empty JSON after immediate calling of Tracker API

Hi,

We are getting an empty response in respond API after immediate calling tracker API.

We are using below API’s

Respond API: http://localhost:5005/conversations/sessionId/respond?query=i want to book a room

Tracker API: http://localhost:5005/conversations/sessionId/tracker/events

Can you please help us how can we solve this issue?

Hey,

based on this information alone I cannot help you unfortunately. Can you post more details of your config and some logs?

Also check out the docs :slight_smile:

@imLew

Thanks for the reply.

please find the below debug logs, we are getting an empty response after calling tracker API…

http://52.44.20.120:5005/conversations/test1/respond?query=hello
 replies: 
 [
    {
        "recipient_id": "test1",
        "text": "Hi there, how can i help you?"
    }
]
 Slots:-
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: None
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: None
        email: None
http://52.44.20.120:5005/conversations/test1/respond?query=i would like to suggest something
replies:
[
    {
        "recipient_id": "test1",
        "text": "what would you like to suggest"
    }
]


Slots:- 
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: None
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: defect
        email: None

As you can see the slot "flowType" is filled

http://52.44.20.120:5005/conversations/test1/respond?query=The UI of this chat should be better
replies:
[
    {
        "recipient_id": "test1",
        "text": "please provide customer id"
    }
]

Slots:- 
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: i want to improve th UI
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: defect
        email: None
here the slot "enhancementsummarydetails" is filled.

Now if i call the tracker api i.e http://52.44.20.120:5005/conversations/test1/tracker/events
That will give me the data and then get back to the normal chat i.e

http://52.44.20.120:5005/conversations/test1/respond?query=my id is 12345
replies:
[]

There response here gets empty.


 http://52.44.20.120:5005/conversations/test1/respond?query=hello
 replies: 
 [
    {
        "recipient_id": "test1",
        "text": "Hi there, how can i help you?"
    }
]
 Slots:-
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: None
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: None
        email: None
http://52.44.20.120:5005/conversations/test1/respond?query=i would like to suggest something
replies:
[
    {
        "recipient_id": "test1",
        "text": "what would you like to suggest"
    }
]


Slots:- 
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: None
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: defect
        email: None

As you can see the slot "flowType" is filled

http://52.44.20.120:5005/conversations/test1/respond?query=The UI of this chat should be better
replies:
[
    {
        "recipient_id": "test1",
        "text": "please provide customer id"
    }
]

Slots:- 
severity: None
        workaround: None
        cId: None
        isActiveUser: None
        enhancementsummarydetails: i want to improve th UI
        cName: None
        isAllSlotsFilled: None
        mNo: None
        flowType: defect
        email: None
here the slot "enhancementsummarydetails" is filled.

Now if i call the tracker api i.e http://52.44.20.120:5005/conversations/test1/tracker/events
That will give me the data and then get back to the normal chat i.e

http://52.44.20.120:5005/conversations/test1/respond?query=my id is 12345
replies:
[]

There response here gets empty.

below is nlu_model_config.yml

language: "en"

pipeline:
- name: "nlp_spacy"
- name: "tokenizer_spacy"
- name: "intent_entity_featurizer_regex"
- name: "intent_featurizer_spacy"
- name: "ner_crf"
- name: "ner_synonyms"
- name: "intent_classifier_sklearn"
- name: "intent_featurizer_count_vectors"
- name: "intent_classifier_tensorflow_embedding"
  intent_tokenization_flag: true
  intent_split_symbol: "+"

default_config.yml

policies:
  - name: KerasPolicy
    epochs: 100
    max_history: 5
  - name: FallbackPolicy
    fallback_action_name: 'action_default_fallback'
  - name: MemoizationPolicy
    max_history: 5
  - name: FormPolicy

in bot.py

import argparse
import logging

from policy import RestaurantPolicy
from rasa_core import utils
from rasa_core.agent import Agent
from rasa_core.policies.fallback import FallbackPolicy
from rasa_core.policies.memoization import MemoizationPolicy

logger = logging.getLogger(__name__)


class RestaurantAPI(object):
    def search(self, info):
        return "papi's pizza place"


def train_dialogue(domain_file="restaurant_domain.yml",
                   model_path="models/dialogue",
                   training_data_file="data/babi_stories.md"):
    fallback = FallbackPolicy(fallback_action_name="action_default_fallback",core_threshold=0.3, nlu_threshold=0.3)
    agent = Agent(domain_file,
                  policies=[MemoizationPolicy(max_history=3),
                            RestaurantPolicy(batch_size=100, epochs=400,
                                             validation_split=0.2),fallback])

    training_data = agent.load_data(training_data_file)
    agent.train(
        training_data
    )

    agent.persist(model_path)
    return agent


def train_nlu():
    from rasa_nlu.training_data import load_data
    from rasa_nlu import config
    from rasa_nlu.model import Trainer

    training_data = load_data('data/nlu_data.md')
    trainer = Trainer(config.load("nlu_model_config.yml"))
    trainer.train(training_data)
    model_directory = trainer.persist('models/nlu/',
                                      fixed_model_name="current")

    return model_directory


if __name__ == '__main__':
    utils.configure_colored_logging(loglevel="INFO")

    parser = argparse.ArgumentParser(
        description='starts the bot')

    parser.add_argument(
        'task',
        choices=["train-nlu", "train-dialogue", "run"],
        help="what the bot should do - e.g. run or train?")
    task = parser.parse_args().task

    # decide what to do based on first parameter of the script
    if task == "train-nlu":
        train_nlu()
    elif task == "train-dialogue":
        train_dialogue()

we are running rasa core service using below command.

sudo  python -m rasa_core.run --enable_api --nlu models/nlu/default/current --core models/dialogue --endpoints endpoints.yml

Let me know if you need any additional information

@akelad Can you please help to solve this issue? we are still facing this issue.

@Narasimha are you sending a POST request to /tracker/events? Could you paste the request you send here, and also the response?

Hi @akelad,

Yes, we are sending POST request to /tracker/events?

Here is the Tracker API request and Response.

POST http://52.44.20.120:5005/conversations/session123/tracker/events

Request Body:

{
  "event" : "action",
  "name": "utter_greet"        
}

Response:

{"active_form":{},"events":[{"confidence":null,"event":"action","name":"action_listen","policy":null,"timestamp":1551694528.541727},{"confidence":null,"event":"action","name":"utter_greet","policy":null,"timestamp":1551694528.541343},{"event":"user","input_channel":null,"parse_data":{"entities":[],"intent":{"confidence":0.9657105207443237,"name":"greet"},"intent_ranking":[{"confidence":0.9657105207443237,"name":"greet"},{"confidence":0.17142252624034882,"name":"inform_cName"},{"confidence":0.06829041242599487,"name":"priority"},{"confidence":0.06601697951555252,"name":"defect+priority"},{"confidence":0.0,"name":"inform_mNo"},{"confidence":0.0,"name":"inform_email"},{"confidence":0.0,"name":"workaroundIntent"},{"confidence":0.0,"name":"thankyou"},{"confidence":0.0,"name":"defect+inform_cId"},{"confidence":0.0,"name":"inform_cId"}],"text":"Hi"},"text":"Hi","timestamp":1551694547.318849},{"confidence":0.998457676846836,"event":"action","name":"action_listen","policy":"policy_1_RestaurantPolicy","timestamp":1551694547.321923},{"event":"user","input_channel":null,"parse_data":{"entities":[],"intent":{"confidence":0.9657105207443237,"name":"greet"},"intent_ranking":[{"confidence":0.9657105207443237,"name":"greet"},{"confidence":0.17142252624034882,"name":"inform_cName"},{"confidence":0.06829041242599487,"name":"priority"},{"confidence":0.06601697951555252,"name":"defect+priority"},{"confidence":0.0,"name":"inform_mNo"},{"confidence":0.0,"name":"inform_email"},{"confidence":0.0,"name":"workaroundIntent"},{"confidence":0.0,"name":"thankyou"},{"confidence":0.0,"name":"defect+inform_cId"},{"confidence":0.0,"name":"inform_cId"}],"text":"Hi"},"text":"Hi","timestamp":1551694554.857049},{"confidence":0.9966457943112632,"event":"action","name":"utter_greet","policy":"policy_1_RestaurantPolicy","timestamp":1551694554.860485},{"data":{"attachment":null,"buttons":null,"elements":null},"event":"bot","text":"hey there! How can i help you ?","timestamp":1551694554.8605},{"confidence":1.0,"event":"action","name":"action_listen","policy":"policy_0_MemoizationPolicy","timestamp":1551694554.863301},{"event":"user","input_channel":null,"parse_data":{"entities":[{"confidence":0.9595408180809794,"end":14,"entity":"flowType","extractor":"ner_crf","processors":["ner_synonyms"],"start":10,"value":"enhancement"}],"intent":{"confidence":0.7698735594749451,"name":"suggestion"},"intent_ranking":[{"confidence":0.7698735594749451,"name":"suggestion"},{"confidence":0.5035653710365295,"name":"defect_flow"},{"confidence":0.20577292144298553,"name":"thankyou"},{"confidence":0.15834227204322815,"name":"suggestion+inform_cId"},{"confidence":0.13533815741539001,"name":"inform_mNo"},{"confidence":0.12024432420730591,"name":"suggestion+priority"},{"confidence":0.1071394681930542,"name":"inform_cName"},{"confidence":0.03407015651464462,"name":"defect+inform_cId"},{"confidence":0.0,"name":"inform_isActiveUser"},{"confidence":0.0,"name":"inform_email"}],"text":"I have an idea"},"text":"I have an idea","timestamp":1551694568.17089},{"event":"slot","name":"flowType","timestamp":1551694568.170914,"value":"enhancement"},{"confidence":0.9984697470113186,"event":"action","name":"utter_suggestion","policy":"policy_1_RestaurantPolicy","timestamp":1551694568.174644},{"data":{"attachment":null,"buttons":null,"elements":null},"event":"bot","text":"what would you like to suggest?","timestamp":1551694568.174657},{"confidence":0.9998159697471023,"event":"action","name":"action_listen","policy":"policy_1_RestaurantPolicy","timestamp":1551694568.177651},{"confidence":null,"event":"action","name":"utter_greet","policy":null,"timestamp":1551694574.671061}],"followup_action":null,"latest_action_name":"utter_greet","latest_event_time":1551694574.671061,"latest_input_channel":null,"latest_message":{"entities":[{"confidence":0.9595408180809794,"end":14,"entity":"flowType","extractor":"ner_crf","processors":["ner_synonyms"],"start":10,"value":"enhancement"}],"intent":{"confidence":0.7698735594749451,"name":"suggestion"},"intent_ranking":[{"confidence":0.7698735594749451,"name":"suggestion"},{"confidence":0.5035653710365295,"name":"defect_flow"},{"confidence":0.20577292144298553,"name":"thankyou"},{"confidence":0.15834227204322815,"name":"suggestion+inform_cId"},{"confidence":0.13533815741539001,"name":"inform_mNo"},{"confidence":0.12024432420730591,"name":"suggestion+priority"},{"confidence":0.1071394681930542,"name":"inform_cName"},{"confidence":0.03407015651464462,"name":"defect+inform_cId"},{"confidence":0.0,"name":"inform_isActiveUser"},{"confidence":0.0,"name":"inform_email"}],"text":"I have an idea"},"paused":false,"sender_id":"session123","slots":{"cId":null,"cName":null,"email":null,"enhancementsummarydetails":null,"flowType":"enhancement","isActiveUser":null,"isAllSlotsFilled":null,"mNo":null,"severity":null,"workaround":null}}

But in Respond API still getting an empty JSON Response. Here is the Request and Response for Respond API.

Request:

GET http://52.44.20.120:5005/conversations/session123/respond?query=something good

Response : []

i’m not sure why you’re sending a post request to the tracker first and then trying the respond endpoint? The respond endpoint should work on it’s own, have you tried that yet?

Hi @akelad,

I am not sending tracker post request on the first call, I was sending in between Respond API, to get the slots information. Using slots information we are writing the business logic.

Example: RespondAPI

1. Request: Hello,  Response: How can I help you?
2. Request: low, Response: what is the issue? (here priority slot filled)

Now we are calling Tracker API: got the response from tracker API, it contains slot information like ( Priority: low)

Again now I’m calling Respond API

Request: Issue with Printer, Response : []

Here is the response, comes with empty, But it should ask about workaround question

In the next request of Respond API if I give

Request: there is no workaround, Response: Thank you we logged a ticket.

Whenever we are calling tracker API, the next call of respond API is giving an empty response.

And have you tried testing this in the command line? It may be that some of your stories are written wrong

Hi @Narasimha, I have faced the similar issue.It is due to stories.Often it used to prompt to action_listen as a result bot used to return an empty response [].Once I corrected my stories and retrained my model,it starting giving me the correct response. Hope this helps…

The API tracker issue is happening while doing the process of the setup and issue has to be fixed. The issue is also affecting many modules as it is creating a problem on drivers of my printer. It is giving Epson printer error code e-01 as well.