Getting error after migrating rasa version

i migrated my rasa bot from version 1.10.0 to 2.2.8. after migrating the bot i tried to run it. but while running the bot ui I am getting the following error. “ERROR rasa.server - An unexpected error occurred. Error: ‘>’ not supported between instances of ‘str’ and 'float”, can someone please help me to resolve this error

Where does the error occur? You probably try to utter or print something in one of your actions scripts where you combine a string with a float variable. You have to cast the float variable with str(<yourvariable>)

This happend to me some times if I forgot to cast the variable. If this is not the problem please provide us more information where the error occurs. Code snippets are usefull too.

error is showing in the terminal where I gave command to up the rasa server. from the ui side I tried to inspect the issue part but their showing as error is undefined. I am adding the screen shots also here

Can you please send your action server code?

following is my action file code

This files contains your custom actions which can be used to run

custom Python code.

See this guide on how to implement these action:

https://rasa.com/docs/rasa/core/actions/#custom-actions/

This is a simple example for a custom action which utters “Hello World!”

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

from rasa_sdk import Action, Tracker

from rasa_sdk.executor import CollectingDispatcher

from rasa_sdk.events import SlotSet

from rasa_sdk.forms import FormAction

import requests

import json

import pymongo

from flask import Flask, render_template,request

import pymysql

pymysql.install_as_MySQLdb()

import mysql

import mysql.connector

import sshtunnel

import pandas as pd

class ActionEmployeeUserName(Action):

def name(self) -> Text:

    return "action_RT_UserName"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    

    HRDep = tracker.get_slot("HR")

    words = tracker.get_slot("HR")

    

    Dep_Name = ""

    if HRDep == words: 

        Dep_Name = "HR"

    

    return [SlotSet("Department", Dep_Name)]

class ActionUserName(Action):

def name(self) -> Text:

    return "action_RT_UserName1"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    

    SMGDep = tracker.get_slot("SMG")

    words = tracker.get_slot("SMG")

        
    

    if SMGDep == words: 

        Dep_Name = "SMG"

   

    return [SlotSet("Department", Dep_Name)]

class ActionUserName1(Action):

def name(self) -> Text:

    return "action_RT_UserName2"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

   

    DevOpsDep = tracker.get_slot("DevOps")

    words = tracker.get_slot("DevOps")

       
   

    if DevOpsDep == words: 

        Dep_Name = "DevOps"

    

    return [SlotSet("Department", Dep_Name)]    

class ActionUserName7(Action):

def name(self) -> Text:

    return "action_RT_UserName7"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    

    AH = tracker.get_slot("AdminHelpdesk")

    words = tracker.get_slot("AdminHelpdesk")

        
    

    if AH == words: 

        Dep_Name = "Admin Helpdesk"

   

    return [SlotSet("Department", Dep_Name)]          

class ActionEmployeeUserName1(Action):

def name(self) -> Text:

    return "action_RT_UserName3"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    

    HR = tracker.get_slot("HR")

    #print('HR',HR)

    Department = tracker.get_slot("Department")

   # print('Department',Department)

    #Email = tracker.get_slot("Email")

    #print('Email',Email)

    username=tracker.current_state()["sender_id"] 

   # print('username',username)

    user = username.split(",")[0]

   # print('user',user)

    password = username.split(",")[1]

  #  print('password',password)

    

    #sshtunnel.SSH_TIMEOUT = 5.0

    #sshtunnel.TUNNEL_TIMEOUT = 5.0

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        #username='ashishc'

        mycursor = connection.cursor()

        mycursor.execute("SELECT * FROM Users WHERE Name=%s", (user,))

        myresult = mycursor.fetchall()

        #print(myresult)

        for x in myresult:

            y=x[6]

            print('y',y)

        

    dispatcher.utter_message(text="Your ticket is raised with following Details:<br> Requestor:" +user+ "<br>  Email: "+y+"<br>  Subject: {0}<br>  Queue: {1}<br>".format(

        tracker.get_slot("HR"),tracker.get_slot("Department")))

    url = "http://rt-dev.rfldev.com//REST/1.0/ticket/new?user="+user+"&pass="+password

    payload = "content=Queue%3A%20"+Department+"%0ARequestor%3A%20"+y+"%0ASubject%3A%20"+HR+"%0AStatus%3A%20new%0AText%3A%20"+HR

    headers = {

      'Content-Type': 'application/x-www-form-urlencoded',

      'Cookie': 'RT_SID_rt-dev.rfldev.com.80=a68feed3dd9cbdcc0e33e11c0d0f5ab0'

    }

    response = requests.request("POST", url, headers=headers, data = payload)

    print(response.text.encode('utf8'))    

    return []        

class ActionEmployeeUserName2(Action):

def name(self) -> Text:

    return "action_RT_UserName4"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    SMG = tracker.get_slot("SMG")

    #print('SMG',SMG)

    Department = tracker.get_slot("Department")

    #print('Department',Department)

    

    username=tracker.current_state()["sender_id"] 

    #print('username',username)

    user = username.split(",")[0]

    #print('user',user)

    password = username.split(",")[1]

    #print('password',password)

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        #username='ashishc'

        mycursor = connection.cursor()

        mycursor.execute("SELECT * FROM Users WHERE Name=%s", (user,))

        myresult = mycursor.fetchall()

        #print(myresult)

        for x in myresult:

            y=x[6]

            #print('y',y)

    dispatcher.utter_message(text="Your ticket is raised with following Details:<br> Requestor:" +user+ "<br>  Email: "+y+"<br>  Subject: {0}<br>  Queue: {1}<br>".format(

        tracker.get_slot("SMG"),tracker.get_slot("Department")))

    url = "http://rt-dev.rfldev.com//REST/1.0/ticket/new?user="+user+"&pass="+password

    payload = "content=Queue%3A%20"+Department+"%0ARequestor%3A%20"+y+"%0ASubject%3A%20"+SMG+"%0AStatus%3A%20new%0AText%3A%20"+SMG

    headers = {

      'Content-Type': 'application/x-www-form-urlencoded',

      'Cookie': 'RT_SID_rt-dev.rfldev.com.80=a68feed3dd9cbdcc0e33e11c0d0f5ab0'

    }

    response = requests.request("POST", url, headers=headers, data = payload)

    print(response.text.encode('utf8'))    

    return []        

class ActionEmployeeUserName3(Action):

def name(self) -> Text:

    return "action_RT_UserName5"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    

    DevOps = tracker.get_slot("DevOps")

    #print('DevOps',DevOps)

    Department = tracker.get_slot("Department")

    #print('Department',Department)

    #Email = tracker.get_slot("Email")

    #print('Email',Email)

    username=tracker.current_state()["sender_id"] 

    #print('username',username) 

    user = username.split(",")[0]

    #print('user',user)

    password = username.split(",")[1]

    #print('password',password)

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        #username='ashishc'

        mycursor = connection.cursor()

        mycursor.execute("SELECT * FROM Users WHERE Name=%s", (user,))

        myresult = mycursor.fetchall()

        #print(myresult)

        for x in myresult:

            y=x[6]

            #print('y',y)

    dispatcher.utter_message(text="Your ticket is raised with following Details:<br> Requestor:" +user+ "<br>  Email: "+y+"<br>  Subject: {0}<br>  Queue: {1}<br>".format(

        tracker.get_slot("DevOps"),tracker.get_slot("Department")))

    url = "http://rt-dev.rfldev.com//REST/1.0/ticket/new?user="+user+"&pass="+password

    payload = "content=Queue%3A%20"+Department+"%0ARequestor%3A%20"+y+"%0ASubject%3A%20"+DevOps+"%0AStatus%3A%20new%0AText%3A%20"+DevOps

    headers = {

      'Content-Type': 'application/x-www-form-urlencoded',

      'Cookie': 'RT_SID_rt-dev.rfldev.com.80=a68feed3dd9cbdcc0e33e11c0d0f5ab0'

    }

    response = requests.request("POST", url, headers=headers, data = payload)

    print(response.text.encode('utf8'))    

    return [] 

class ActionEmployeeUserName4(Action):

def name(self) -> Text:

    return "action_RT_UserName8"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

   

    AdminHelpdesk = tracker.get_slot("AdminHelpdesk")

    #print('AdminHelpdesk',AdminHelpdesk)

    Department = tracker.get_slot("Department")

    #print('Department',Department)

    #Email = tracker.get_slot("Email")

    #print('Email',Email)

    username=tracker.current_state()["sender_id"] 

    #print('username',username) 

    user = username.split(",")[0]

    #print('user',user)

    password = username.split(",")[1]

    #print('password',password)

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        #username='ashishc'

        mycursor = connection.cursor()

        mycursor.execute("SELECT * FROM Users WHERE Name=%s", (user,))

        myresult = mycursor.fetchall()

        #print(myresult)

        for x in myresult:

            y=x[6]

            #print('y',y)

     

    dispatcher.utter_message(text="Your ticket is raised with following Details:<br> Requestor:" +user+ "<br>  Email: "+y+"<br>  Subject: {0}<br>  Queue: {1}<br>".format(

        tracker.get_slot("AdminHelpdesk"),tracker.get_slot("Department")))

    url = "http://rt-dev.rfldev.com//REST/1.0/ticket/new?user="+user+"&pass="+password

    payload = "content=Queue%3A%20"+Department+"%0ARequestor%3A%20"+y+"%0ASubject%3A%20"+AdminHelpdesk+"%0AStatus%3A%20new%0AText%3A%20"+AdminHelpdesk

    headers = {

      'Content-Type': 'application/x-www-form-urlencoded',

      'Cookie': 'RT_SID_rt-dev.rfldev.com.80=a68feed3dd9cbdcc0e33e11c0d0f5ab0'

    }

    response = requests.request("POST", url, headers=headers, data = payload)

    print(response.text.encode('utf8'))    

    return []     

class ActionEmployeeUserName5(Action):

def name(self) -> Text:

    return "action_RT_UserName9"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    username=tracker.current_state()["sender_id"] 

    #print('username',username) 

    user = username.split(",")[0]

    #print('user',user)

    password = username.split(",")[1]

    #print('password',password) 

    TICKETID = tracker.get_slot("TICKETID")

    #print('TICKETID',TICKETID)

    url = "http://rt-dev.rfldev.com//REST/1.0/ticket/"+TICKETID+"?user="+user+"&pass="+password

    payload  = {}

    headers = {

      'Cookie': 'RT_SID_rt-dev.rfldev.com.80=d3f8252e9b1863da444b033bb4989e81'

    }

    response = requests.request("GET", url, headers=headers, data = payload)

    res = response.text.encode('utf8')

    data = res.decode('utf8').replace("'", '"')

    result = {}

    for text in data.split("\n"):

        if ":" in text:

            try:

                result[text.split(":")[0]] = text.split(":")[1].strip()

            except:

                result[text.split(":")[0]] = ""

                           

    dispatcher.utter_message(text= "Ticket details are:<br> SUBJECT: {0}<br>  STATUS: {1}<br>".format(

        result.get("Subject"),result.get("Status")))

       

    return []

class ActionEmployeeUserName6(Action):

def name(self) -> Text:

    return "action_RT_UserName10"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        username=tracker.current_state()["sender_id"] 

        user = username.split(",")[0]

        #print("user",user)

        cursor = connection.cursor()

        cursor.callproc('UserId_procedure', [user,]) 

        for result in cursor.stored_results():

            a = result.fetchall()

            for x in a:

                id = x[0]

                #print("id",id)



    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

                    

        mycursor = connection.cursor()

        mycursor.callproc('TableValues', ['resolved','Comment',id,])   

        for result in mycursor.stored_results():

            myresult = result.fetchall()  

        #print('myresult',myresult)    

        dispatcher.utter_message(text= "Your active tickets are:" )

        res = [list(ele) for ele in myresult]  

        

        for x in range(len(res)): 

            a = (res[x])

            b = a[0]

            c = a[1]  

            d = a[2]

            dispatcher.utter_message(text = "Subject:"+c+"<br> Status:"+d+"<br> Comment:"+b)

class ActionEmployeeUserName7(Action):

def name(self) -> Text:

    return "action_RT_UserName11"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        username=tracker.current_state()["sender_id"] 

        user = username.split(",")[0]

        #print("user",user)

        cursor = connection.cursor()

        cursor.callproc('UserId_procedure', [user,]) 

        for result in cursor.stored_results():

            a = result.fetchall()

            for x in a:

                id = x[0]

                #print("id",id)



    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        mycursor = connection.cursor()

        mycursor.callproc('TableValues', ['resloved','Comment',id,])   

        for result in mycursor.stored_results():

            myresult = result.fetchall()  

        #print('myresult',myresult)    

        #dispatcher.utter_message(text= "Ticket Status is:" )

        res = [list(ele) for ele in myresult]  

        strings = []

        Stat = []

        for x in range(len(res)): 

            a = (res[x])

            b = a[1]

            c = a[2]

            strings.append(b)

            Stat.append(c)

        strings_con = [x.lower() for x in strings]    

        element = tracker.latest_message['text']

        #print("element",element)

        element_con = element.lower()

        #print("element_con",element_con)

        matching = [s for s in strings_con if element_con in s]

        finalString = ''.join(matching)

        position = strings_con.index(finalString) 

        value = Stat[position]

        dispatcher.utter_message(text ="Ticket Status is: <br> Subject:"+finalString+"<br> Status:"+value)

class ActionEmployeeUserName8(Action):

def name(self) -> Text:

    return "action_RT_UserName12"

def run(self, dispatcher: CollectingDispatcher,

        tracker: Tracker,

        domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        username=tracker.current_state()["sender_id"] 

        user = username.split(",")[0]

        #print("user",user)

        cursor = connection.cursor()

        cursor.callproc('UserId_procedure', [user,]) 

        for result in cursor.stored_results():

            a = result.fetchall()

            for x in a:

                id = x[0]

                print("id",id)



    with sshtunnel.SSHTunnelForwarder(

        ('192.168.117.127', 22),

        ssh_username = 'root',

        ssh_password = 'RtDev@20#',

        remote_bind_address = ('127.0.0.1', 3306)

    ) as tunnel:

        connection = mysql.connector.connect(

            user = 'rt4usr',

            password = 'RtSql@Dv20$',

            host = '192.168.117.127',

            port = 3306,

            database = 'rt4'

        )

        mycursor = connection.cursor()

        mycursor.callproc('TableValues', ['resloved','Comment',id,])   

        for result in mycursor.stored_results():

            myresult = result.fetchall()  

        #print('myresult',myresult)    

        res = [list(ele) for ele in myresult]  

        strings = []

        Stat = []

        for x in range(len(res)): 

            a = (res[x])

            b = a[1]

            c = a[2]

            strings.append(b)

            Stat.append(c)

        strings_con = [x.lower() for x in strings]    

        element = tracker.get_slot("Ticket")

        #print("element",element)

        element_con = element.lower()

        #print("element_con",element_con)

        matching = [s for s in strings_con if element_con in s]

        finalString = ''.join(matching)

        position = strings_con.index(finalString) 

        value = Stat[position]

        dispatcher.utter_message(text ="Ticket Status is: <br> Subject:"+finalString+"<br> Status:"+value)

Please make things clearer. Which action you are calling?