I want to use Rasa NLU server only for my custom dialogue management , which is written in a python code. For that i want to post messages to the nlu server and get the intent rankings. I tried -
response :
{‘version’: ‘2.8.18’, ‘status’: ‘failure’, ‘message’: ‘An unexpected error occurred. Error: string indices must be integers’, ‘reason’: ‘ParsingError’, ‘details’: {}, ‘help’: None, ‘code’: 500}
But if the payload is -
payload = {'text':'hi how are you?'}
headers = {'content-type': 'application/json'}
r = requests.post('http://10.101.1.239:5005/model/parse', json=payload, headers=headers)
then i get the list of intent rankings properly.
The sender id is necessary as I am trying to manage dialogues externally through my code. Please help
TypeError: means that you are trying to perform an operation on a value whose type is not compatible with that operation. An Iterable is a collection of elements that can be accessed sequentially . In Python, iterable objects are indexed using numbers . When you try to access an iterable object using a string or a float as the index, an error will be returned as TypeError: string indices must be integers. This means that when you’re accessing an iterable object like a string or float value, you must do it using an integer value.
For example, str[hello"] and str[2.1] as indexes. As these are not integers, a TypeError exception is raised. This means that when you’re accessing an iterable object like a string or float value, you must do it using an integer value . If you are accessing items from a dictionary , make sure that you are accessing the dictionary itself and not a key in the dictionary.
Python supports slice notation for any sequential data type like lists, strings , tuples, bytes, bytearrays, and ranges. When working with strings and slice notation, it can happen that a TypeError: string indices must be integers is raised, pointing out that the indices must be integers, even if they obviously are.