I am facing the same with Rasa 1.4.3 version.
My normal pre defined actions like “utter_greet” etc are getting replied quickly. But its taking approx 2-3 seconds when a custom action is called.
It has nothing to do with the content of the Actions.py .For me even a small custom action like this- class ActionCheckContract(Action): def name(self): return “contract_action”
def run(self, dispatcher, tracker, domain):
intent = tracker.latest_message["intent"].get("name")
if intent == "inform_contract_owner":
dispatcher.utter_template("utter_change_mind", tracker)
return []
**Takes the equal amount of time to response in compared to this Action.py (5% of Actions,py) class ActionCheckContract(Action): def name(self): return “contract_action”
def run(self, dispatcher, tracker, domain):
client = pymongo.MongoClient("localhost", 27017)
db = client.in_dev
collection = db.Contract
entity = tracker.get_latest_entity_values("contract_name")
entity_DB = next((j for j in collection.find({"_id": ObjectId(entity)})), None)
print(entity_DB)
intent = tracker.latest_message["intent"].get("name")
intents_check_dict = {"inform_contract_owner": 'contractOwner', "inform_contract_number": "contractNumber",
"inform_contract_risk_rating": "contractRisk",
"inform_contract_annual_spend": "annualSpend",
"inform_business_risk_rating": "riskRating", "inform_contract_value": "value",
"inform_contract_renewal_period": "renewalPeriodId",
"inform_contract_liquidation_damages": "liquidationDamage",
"inform_contract_minimum_spend": "minimumSpend",
"inform_contract_addressable_spend": "addressableSpend",
"inform_contract_policy_number": "policyNumber"}
def intent_lookup(intent):
return intents_check_dict.get(intent)
c = intent_lookup(intent)
if c is not None:
print(intents_check_dict)
dispatcher.utter_message(str(entity_DB[c]))
return []
It takes the same time ,even if I alter the interface file to change a function and get my entity through text search API locally. So could u please suggest a solution to this? How much time it generally takes for rasa bots to get response from custom actions.??