YamlSyntaxException in Rasa

48 Views Asked by At

I am building a weather chatbot using Rasa version 3. I am referencing this old article by geeksforgeeks on how to build it. Since rasa 3 does not support md, I had to convert the md code into yaml.

The original nlu.md as given by Geeksforgeeks is as follows:

## intent:greet
- hey
- hello
- hi
- good morning
- good evening
- hey there

## intent:goodbye
- bye
- goodbye
- see you around
- see you later

## intent:bot_challenge
- are you a bot?
- are you a human?
- am I talking to a bot?
- am I talking to a human?

## intent:weather
- what's the weather
- what is the temperature today
- what is the temperature
- i want to know the temperature
- i want to know the weather of today
- tell me the weather forecast
- hows the weather today

## intent:weather_for_location
- what is the weather in [Noida](location)
- what is the weather in [New Delhi](location)
- weather of [Mumbai] (location)
- Today's weather in [Bangalore](location)
- [Kolkata](location) weather
- Tell me weather of [Hyderabad](location)
- Can you tell me weather of [London](location)

## intent:city_info
- [New Delhi](location)
- [India](location)
- [Mumbai](location)
- [Noida](location)
- [Kolkata](location)
- [Bangalore](location)
- [London](location)

##intent: thanks
- thanks
- thank you
- OK

Here is what I got from converting it into yaml:

version: "3.1"

nlu:
- intent: greet
  examples: 
    - hey
    - hello
    - hi
    - hello there
    - good morning
    - good evening
    - moin
    - hey there
    - let's go
    - hey dude
    - goodmorning
    - goodevening
    - good afternoon

- intent: goodbye
  examples: |
    - cu
    - good by
    - cee you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later


- intent: bot_challenge
  examples: |
    - are you a bot?
    - are you a human?
    - am I talking to a bot?
    - am I talking to a human?

- intent: weather
  examples: 
    - what's the weather
    - what is the temperature today
    - what is the temperature
    - i want to know the temperature
    - i want to know the weather of today
    - tell me the weather forecast
    - hows the weather today

- intent: weather_for_location
  examples:
    - what is the weather in [Noida](location)
    - what is the weather in [New Delhi](location)
    - weather of [Mumbai] (location)
    - Today's weather in [Bangalore](location)
    - [Kolkata](location) weather
    - Tell me weather of [Hyderabad](location)
    - Can you tell me weather of [London](location)

- intent:city_info
  examples:
    - [New Delhi](location)
    - [India](location)
    - [Mumbai](location)
    - [Noida](location)
    - [Kolkata](location)
    - [Bangalore](location)
    - [London](location)

- intent: thanks
  examples:
    - thanks
    - thank you
    - OK


Here is my domain.yml file

version: "3.1"

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true


intents:
  - greet
  - goodbye
  - bot_challenge
  - weather
  - weather_for_location
  - city_info
  - thanks

entities:
  - location

slots:
  location:
    type: text
    mappings:
      - "London": "London"
      - "Paris": "Paris"
      - "New York": "New York"
    influence_conversation: false
  
responses:
  utter_greet:
  - text: Hey! 
  utter_goodbye:
  - text: Bye
  - text: Good Bye
  utter_ask_location:
  - text: of where?
  - text: In what city?
  utter_getting_weather:
  - text: Ok, getting weather of [location] ...
  utter_welcome:
  - text: Welcome
  utter_iamabot:
  - text: I am a bot, powered by Rasa.
actions:
- action_get_weather

I am getting an error on using rasa train

 UserWarning: Loading domain from 'domain.yml' failed. Using empty domain. Error: 'Your domain uses an invalid slot mapping of type 'None' for slot 'location'. Please see https://rasa.com/docs/rasa/domain#slots for more information.'
YamlSyntaxException: Failed to read 'data\nlu.yml'. while parsing a block collection
  in "data\nlu.yml", line 53, column 5:
        - what is the weather in [Noida] ...
        ^ (line: 53)
expected <block end>, but found '<scalar>'
  in "data\nlu.yml", line 57, column 16:
        - [Kolkata](location) weather
                   ^ (line: 57)

You can use https://yamlchecker.com/ to validate the YAML syntax of your file.
0

There are 0 best solutions below