Hello everyone, I use an agent in my bot, but with the new version of rasa (rasa 1.0) I am getting a wired message. My basic implementation is like this:
and the agent handles the messages using the handle_text function as in:
reply = agent.handle_text(userMsg)
so, right now I when I use this method I am getting the following message:
<coroutine object Agent.handle_text at 0x133236af0>
This is not an error message, it is just the output of the function and this is not what it used to be in the older version of Rasa that Iāve used. Iād really appreciate any help from you guys.
I am getting None from this call as well. Can you please help with this?? In Rasa X the bot is working, when I am trying to invoke it through the agent programmatically it returns None.
Thanks for the sample code. For me when I run the code if agent.is_ready(): is not getting true because in below code I see empty self.policy_ensemble. Seems like I have to pass policy while creating agent instance.
def is_ready(self):
"""Check if all necessary components are instantiated to use agent."""
return (
self.tracker_store is not None
and self.policy_ensemble is not None
and self.interpreter is not None
)
But my question is why it worked for you? AND why do we need to pass policy while doing inference?
I tried doing this way also but still, it failed because self.is_ready() is false.
Hi @kothiyayogesh, Iām glad my sample code helped. As for the if agent.is_ready():, I thought that using it might help, but Iām not entirely sure. My logic behind it is that I donāt want the agent to parse the message if it is not ready but this has never actually happened before. I assume that you can safely remove it and it will still work normally.
i am facing a similar error to yours. The response returns a NoneType.
import logging
from rasa.core import config
from rasa.core import utils
from rasa.utils import io
from rasa.core.agent import Agent
from rasa.core.interpreter import RasaNLUInterpreter
from rasa.utils.endpoints import EndpointConfig
import asyncio
print("Your bot is ready to talk!!")
while True:
a = input('You: ')
if a == 'stop':
break
loop = asyncio.get_event_loop()
responses = loop.run_until_complete(agent.handle_text(a))
print(responses) #returns None
for response in responses:
print(f'Bot : {response["text"]}')
return agent
if name == āmainā:
actionConfig = io.read_yaml_file(āendpoints.ymlā)
print(actionConfig)
run_core(āmodels/coreā, āmodels/nluā,
actionConfig[āaction_endpointā][āurlā])
Pleae help me how u solved it. I tried with asyncio method tooā¦ Still same issue