KeyError: 'confidence' I'm trying to create a chatbot with RASA and opsdroid

intents.yml file content:

version: "2.0"

intents:
  - greetings
  - bye
  - price:
      use_entities:
        - ticker
  - add stock

entities:
  - location
  - stock
  - ticker

actions:
  - action_current_price

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

- intent: add
  examples: |
    - add stock AAPL for 9 days
    - add stock MSFT 12 to monitor list
    - add my stock GOOG 19
    - add TSLA 14  days
    
- intent: Bye
  examples: |
    - Bye
    - bie
    - by
    - see you
    - see ya

- intent: buy
  examples: |
    - buy [AAPL](stock)
    - please buy [MSFT](stock)
    - buy me [tsla](stock)

- intent: this_is_funny
  examples: |
    - This is funny
    - That's a funny one
    - Hahaha
    - That's a good one

- intent: price
  examples: |
    - current price of [TSLA]{"entity":"ticker"}
    - tell me current price of [AMZN]{"entity":"ticker"}
    - I want to know the current price of [NSRGY]{"entity":"ticker"}
    - tell me about the current price of [AAPL]{"entity":"ticker"}
    - Can you tell me the current price of [HDB]{"entity":"ticker"}
    - current price of [KOTAKBANK.NS]{"entity":"ticker"}
    - Please tell me the current price of [ZM]{"entity":"ticker"}
    - current price of [RELIANCE.NS]{"entity":"ticker"}
    - price of [NFLX]{"entity":"ticker"}
    - Get me the current price of [PNB.NS]{"entity":"ticker"}
    - [UVSL.NS]{"entity":"ticker"}
    - [IDEA.NS]{"entity":"ticker"}
    - [LAKSHVILAS.NS]{"entity":"ticker"}
    - [ADANIPOWER.NS]{"entity":"ticker"}
    - [RTNINFRA.BO]{"entity":"ticker"}
    - [RPOWER.NS]{"entity":"ticker"}
    - [TVSMOTOR-BL.NS]{"entity":"ticker"}
    - [SUZLON.NS]{"entity":"ticker"}
    - [YESBANK.NS]{"entity":"ticker"}
    - [MAHABANK.NS]{"entity":"ticker"}
    - [IDEA.BO]{"entity":"ticker"}
    - [RCOM.BO]{"entity":"ticker"}
    - [CENTRALBK.NS]{"entity":"ticker"}
    - [IOB.NS]{"entity":"ticker"}
    - [RTNPOWER.NS]{"entity":"ticker"}
    - [RENUKA.BO]{"entity":"ticker"}
    - [TATAMOTORS.NS]{"entity":"ticker"}
    - [AAPL]{"entity":"ticker"}
    - [TATAMOTORS-BL.NS]{"entity":"ticker"}
    - [BANKBARODA.NS]{"entity":"ticker"}
    - [BHEL.NS]{"entity":"ticker"}
    - [ITC.NS]{"entity":"ticker"}
    - [ONGC.NS]{"entity":"ticker"}
    - [HFCL.NS]{"entity":"ticker"}
    - [ASHOKLEY.NS]{"entity":"ticker"}
    - [IMUN]{"entity":"ticker"}
    - [KGET]{"entity":"ticker"}
    - [GOOG]{"entity":"ticker"}
    - [MSFT]{"entity":"ticker"}
    - [GOOGL]{"entity":"ticker"}
    - [FB]{"entity":"ticker"}
    - [TSM]{"entity":"ticker"}
    - [BABA]{"entity":"ticker"}
    - [JPM]{"entity":"ticker"}
    - [V]{"entity":"ticker"}
    - [NVDA]{"entity":"ticker"}
    - [JNJ]{"entity":"ticker"}
    - [WMT]{"entity":"ticker"}
    - [UNH]{"entity":"ticker"}
    - [BAC]{"entity":"ticker"}
    - [MA]{"entity":"ticker"}
    - [PG]{"entity":"ticker"}
    - [HD]{"entity":"ticker"}
    - [DIS]{"entity":"ticker"}
    - [PYPL]{"entity":"ticker"}
    - [ASML]{"entity":"ticker"}
    - [CMCSA]{"entity":"ticker"}
    - [XOM]{"entity":"ticker"}
    - [TM]{"entity":"ticker"}
    - [KO]{"entity":"ticker"}
    - [PEP]{"entity":"ticker"}
    - [PFE]{"entity":"ticker"}
    - [CSCO]{"entity":"ticker"}
    - [INTC]{"entity":"ticker"}
    - [NKE]{"entity":"ticker"}
    - [ORCL]{"entity":"ticker"}
    - [ADBE]{"entity":"ticker"}
    - [CVX]{"entity":"ticker"}
    - [T]{"entity":"ticker"}
    - [NVS]{"entity":"ticker"}
    - [ABT]{"entity":"ticker"}
    - [ACN]{"entity":"ticker"}
    - [HON]{"entity":"ticker"}
    - [MCD]{"entity":"ticker"}
    - [UL]{"entity":"ticker"}
    - [PM]{"entity":"ticker"}
    - [QCOM]{"entity":"ticker"}
    - [JPM]{"entity":"ticker"}


- lookup: stock
  examples: |
    - \nasdaq_screener_1642495838667.txt

stories:
- story: c_price
  steps:
    - intent: price
    - action: action_current_price

- story: happy path
  steps:
  - intent: greet
  - action: utter_greet
  - intent: mood_great
  - action: utter_happy

I am getting following error:

Traceback (most recent call last):
  File "/usr/local/bin/opsdroid", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/opsdroid/cli/start.py", line 43, in start
    opsdroid.run()
  File "/usr/local/lib/python3.9/site-packages/opsdroid/core.py", line 172, in run
    self.eventloop.run_until_complete(self.start())
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.9/site-packages/opsdroid/core.py", line 195, in start
    await self._run_tasks()
  File "/usr/local/lib/python3.9/site-packages/opsdroid/core.py", line 206, in _run_tasks
    await asyncio.gather(*self.tasks)
  File "/usr/local/lib/python3.9/site-packages/opsdroid/connector/matrix/connector.py", line 345, in listen
    await self.opsdroid.parse(event)
  File "/usr/local/lib/python3.9/site-packages/opsdroid/core.py", line 627, in parse
    ranked_skills = await self.get_ranked_skills(unconstrained_skills, event)
  File "/usr/local/lib/python3.9/site-packages/opsdroid/core.py", line 526, in get_ranked_skills
    ranked_skills += await parse_rasanlu(self, skills, message, rasanlu)
  File "/usr/local/lib/python3.9/site-packages/opsdroid/parsers/rasanlu.py", line 280, in parse_rasanlu
    entity["entity"], entity["value"], entity["confidence"]
KeyError: 'confidence'

Welcome to the forum!

@gauravsanas88 are you sure you need to use python 3.9 for rasa open source? can you share your rasa --version, please.

@gauravsanas88 Rasa 2. x only works on Python 3.6, 3.7, and 3.8 and Rasa 3.x only works on Python 3.7 and 3.8 please change the python version first, may be issue solved. Thanks.

1 Like

Yes, Rasa version : 2.8.1 Python version : 3.8.12

@gauravsanas88 not get you? have you updated the env with python 3.8 as above error related to python 3.9.

yes, I did that mistake. Thank you for help. But after resolving this problem Iā€™m not able to get entities. {'text': 'Get google current price', 'intent': {'id': -7522231481017289405, 'name': 'price', 'confidence': 0.9999994039535522}, 'entities': [], 'intent_ranking': [{'id': -7522231481017289405, 'name': 'price', 'confidence': 0.9999994039535522}} can you help me with that?

@gauravsanas88 you need to close this thread first with the solution and need to open a new thread with more details as this issue is not related to this thread.

okay, Sure.

@gauravsanas88 Thanks Gaurav!