Train_core() return error AttributeError: 'str' object has no attribute 'get'

Hello everyone, absolute newb in rasa and I keep getting an error when trying to train rasa.

this is the error message I am getting when running train_core() and I don’t know where it is coming from:

AttributeError Traceback (most recent call last) in ----> 1 train_core()

in train_core() 6 7 def train_core(): ----> 8 agent = Agent(example_domain_path, policies=[MemoizationPolicy(), KerasPolicy(), MappingPolicy()]) 9 10 loop = asyncio.get_event_loop()

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\agent.py in init(self, domain, policies, interpreter, generator, tracker_store, lock_store, action_endpoint, fingerprint, model_directory, model_server, remote_storage) 294 ): 295 # Initializing variables with the passed parameters. –> 296 self.domain = self._create_domain(domain) 297 self.policy_ensemble = self._create_ensemble(policies) 298

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\agent.py in _create_domain(domain) 832 833 if isinstance(domain, str): –> 834 domain = Domain.load(domain) 835 domain.check_missing_templates() 836 return domain

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in load(cls, paths) 68 domain = Domain.empty() 69 for path in paths: —> 70 other = cls.from_path(path) 71 domain = domain.merge(other) 72

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in from_path(cls, path) 78 79 if os.path.isfile(path): —> 80 domain = cls.from_file(path) 81 elif os.path.isdir(path): 82 domain = cls.from_directory(path)

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in from_file(cls, path) 91 @classmethod 92 def from_file(cls, path: Text) -> “Domain”: —> 93 return cls.from_yaml(rasa.utils.io.read_file(path)) 94 95 @classmethod

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in from_yaml(cls, yaml) 101 102 data = rasa.utils.io.read_yaml(yaml) –> 103 return cls.from_dict(data) 104 105 @classmethod

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in from_dict(cls, data) 106 def from_dict(cls, data: Dict) -> “Domain”: 107 utter_templates = cls.collect_templates(data.get(“templates”, {})) –> 108 slots = cls.collect_slots(data.get(“slots”, {})) 109 additional_arguments = data.get(“config”, {}) 110 intents = data.get(“intents”, {})

C:\ProgramData\Anaconda3\lib\site-packages\rasa\core\domain.py in collect_slots(slot_dict) 193 slots = [] 194 for slot_name in sorted(slot_dict): –> 195 slot_class = Slot.resolve_by_type(slot_dict[slot_name].get(“type”)) 196 if “type” in slot_dict[slot_name]: 197 del slot_dict[slot_name][“type”]

AttributeError: ‘str’ object has no attribute ‘get’

Any help would be greatly appreciated, thank you for your time.

hi @sousablde ! using train_core directly is pretty advanced. Is there a reason you don’t simply use rasa train on the command line?

hi @amn41 I tired quite a few times to use it but I never got it to work (even followed a bit of the weatherbot tutorial) so I ended up continuing through what worked further in the process.

I was able to fix it in the meantime, now just working on getting integration with a data set for it to actually work.

1 Like

hey, could you please provide how you solved the problem?

1 Like

Same problem occurs while running “rasa train” command in command line

I had the same error , i found that of slots in the domain file was wrong indentation. Fix the indentation in domain file