Hi everyone,
I’m new to Rasa and I’m trying to make it work with Haystack. I followed the tutorial Haystack has published on their website for integrating with Rasa. Everything works well, except I get this error:
Failed to execute custom action 'call_haystack' because no endpoint is configured to run this custom action. Please take a look at the docs and set an endpoint configuration via the --endpoints flag.
I looked at the custom action documentation and can’t find a clear solution.
At the bottom of my domain.yml I defined the custom action:
actions:
- call_haystack
In endpoints.yml I have this uncommented:
action_endpoint:
url: "http://localhost:5055/webhook"
And this is a custom action code in actions.py:
from typing import Any, Text, Dict, List
from rasa_sdk import Action, Tracker
from rasa_sdk.executor import CollectingDispatcher
class ActionHaystack(Action):
def name(self) -> Text:
return "call_haystack"
def run(self, dispatcher: CollectingDispatcher,
tracker: Tracker,
domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:
url = "http://localhost:8000/query"
payload = {"query": str(tracker.latest_message["text"])}
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, json=payload).json()
if response["answers"]:
answer = response["answers"][0]["answer"]
else:
answer = "No Answer Found!"
dispatcher.utter_message(text=answer)
return []
I also defined a rule in the rules.yml and the intents in the nlu.yml
After I’ve done this, I ran:
rasa train
rasa run actions
I have Haystack running in another container.
I use rasa shell
to talk to the bot, everything is fine, but when I ask something that should be delegated to Haystack I get the error I mentioned.
Can someone please tell me what am I missing?
Thanks