AttributeError: 'str' object has no attribute 'get'

Getting attribute error on running rasa train command.

I think there is some problem in slot declaration. Please post your domain file. Also, are you using custom slot? If so, please post that file as well.

slots:
     id:
      type:text
      initail_value:"xyz"

This is how I declared slots under intents in domain file and here is the code of custom actions.py:

from typing import Any, Text, Dict, List, Union, Optional

from rasa_sdk import Action, Tracker

from rasa_sdk.executor import CollectingDispatcher

from rasa_sdk.events import SlotSet

from dbConnect import getData

class ActionCheckClients(Action):

def name(self) -> Text:

return “action_check_clients”

def run(self, dispatcher: CollectingDispatcher,tracker: Tracker,domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

client = tracker.get_slot(‘id’)

query=“select * from client where client_id=’{0}’ limit 1”.format(client)

data = getData(query)

print("data: ",data)

dispatcher.utter_message(text=“Here are the information you asked for”,json_message=data)

return[]

Hey @Prskriti, there were some problems like indentation and spelling mistake for initial value, try this:

slots:
  id:
    type: text
    initial_value: "xyz"

“declared slots under intents”?

As @JiteshGaikwad said, there is a spelling mistake (initail_value). Please try declaring slots as he has mentioned in his answer. Also, (just incase :sweat_smile:) slots are not declared under intents. See this example domain file.

Yeah my bad :smile: I didn’t realize I did such a silly spelling mistake. :smile: Anyways thanks for ur help.

1 Like

Sry my bad I did such a silly mistake. :smile: Thanks for your help.

Nope after intents I declared slot value.

1 Like

Oh, okay, hope that solved your problem. :slightly_smiling_face:

Yep It did thanks