In notebook rasa agent had to be loaded with “await”. But then, at the usage time, it errors out
Your bot is ready to talk! Type your messages here or send 'stop'
Hi
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-4-8da8be804628> in <module>
----> 1 load_assistant()
<ipython-input-3-67306454dd0d> in load_assistant()
25 break
26 responses = agent.handle_text(a)
---> 27 for response in responses:
28 print(response["text"])
TypeError: 'coroutine' object is not iterable
The usage code is
i mport IPython
from IPython.display import clear_output
from rasa_core.agent import Agent
from rasa_core.interpreter import NaturalLanguageInterpreter
# from rasa_core.utils import EndpointConfig
from rasa.utils.endpoints import EndpointConfig
import time
def load_assistant():
messages = ["Hi! you can chat in this window. Type 'stop' to end the conversation."]
model_dir = 'models/nlu/current' # or model_directory defined earlier
interpreter = NaturalLanguageInterpreter.create(model_dir)
endpoint = EndpointConfig('http://localhost:5055/webhook')
agent = Agent.load('models/current/dialogue', interpreter=interpreter, action_endpoint = endpoint)
print("Your bot is ready to talk! Type your messages here or send 'stop'")
while True:
a = input()
if a == 'stop':
break
responses = agent.handle_text(a)
for response in responses:
print(response["text"])
load_assistant()
Hi, I am facing some other issues here.
If I try to load agent model like you did, I get the error ValueError: You are trying to load a MODEL from ‘/home/anika/Desktop/RasaHost-master/src/RasaHost/sample/models/core-20200319-114712/core’, which is not possible.The model path should be a ‘tar.gz’ file or a directory containing the various model files in the sub-directories ‘core’ and ‘nlu’.
If you want to load training data instead of a model, use agent.load_data(...) instead.
And If a load the model as a tar.gz file, the I get the following error: AttributeError: ‘RasaNLUInterpreter’ object has no attribute 'type’
I am not sure whether my problem is at training nlu and core properly or somewhere else.
I am stuck at this for weeks. any help is appreciable. Thanks!