Rasa: Rasa 1.0 ImportError: cannot import name 'EndpointConfig' from 'rasa_core.utils'

Created on 29 May 2019  Â·  9Comments  Â·  Source: RasaHQ/rasa

Rasa version:
rasa 1.0.1

Python version:
Python 3.7.3

Operating system (windows, osx, ...):
OSX

Issue:
ImportError: cannot import name 'EndpointConfig' from 'rasa_core.utils'

After upgrading to rasa version 1.0,
How can we train using python agent

from rasa_core.utils import EndpointConfig
core_endpoint_config = EndpointConfig(url='http://localhost:5055/webhook')

agent = Agent(domain_file, policies=[MemoizationPolicy(), KerasPolicy(), fallback], action_endpoint = core_endpoint_config, interpreter=interpreter)
#agent = Agent.load(current_project_path+"/models")`

Content of configuration file (config.yml):

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: en
pipeline: supervised_embeddings

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
  - name: MemoizationPolicy
  - name: KerasPolicy
  - name: MappingPolicy

Content of domain file (domain.yml) (if used & relevant):

intents:
- greet
- goodbye
- thanks
- deny
- joke
- name


entities:
- name


slots:
  name:
    type: text


actions:
- utter_name
- utter_thanks
- utter_greet
- utter_goodbye
- action_joke
- utter_unclear

templates:
  utter_name:
  - text: "Hey there! Tell me your name."

  utter_greet:
  - text: "Nice to you meet you {name}. How can I help?"

  utter_goodbye:
  - text: "Talk to you later!"

  utter_thanks:
  - text: "My pleasure."

  utter_unclear:
  - text: "Sorry, I dont know"


stale type

Most helpful comment

@karthikbalu please try with
from rasa.utils.endpoints import EndpointConfig

All 9 comments

@karthikbalu please try with
from rasa.utils.endpoints import EndpointConfig

Solved that import endpointconfig error now

But cannot train the agent the same way like before upgrade

    training_data = agent.load_data("/data/stories.md")
    agent.train(training_data)
   agent.train(training_data)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/agent.py", line 668, in train
    self.policy_ensemble.train(training_trackers, self.domain, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/policies/ensemble.py", line 89, in train
    policy.train(training_trackers, domain, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/rasa/core/policies/memoization.py", line 152, in train
    for t in training_trackers
TypeError: 'coroutine' object is not iterable
sys:1: RuntimeWarning: coroutine 'Agent.load_data' was never awaited

You need to wait for the coroutine to finish.

training_data = await agent.load_data("/data/stories.md")
agent.train(training_data)

now im getting this error
training_data = await agent.load_data("/data/stories.md")
^
SyntaxError: 'await' outside async function

so i added async to my traindialogue function and now im getting

RuntimeWarning: coroutine 'train_dialogue' was never awaited
bot.train_dialogue(project)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Please help, Thanks

I went past that hurdle using async and await syntax

but now this is not working

asyncio.run(serve_application(agent,channel='cmdline'))

was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback

have any update? i have the same question

What python version are you using? asyncio.run is only supported in 3.7. If you are using python 3.6 you need to use

    loop = asyncio.get_event_loop()
    result = loop.run_until_complete(<async method>)

link to documentation: https://docs.python.org/3.6/library/asyncio.html

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed due to inactivity. Please create a new issue if you need more help.

Was this page helpful?
0 / 5 - 0 ratings