Skip to content

Tracker Serialization of Decimal Value #5215

Closed
@rgstephens

Description

Rasa version: 1.5.1

Issue:
There are Decimal values associated with slots in our DynamoDB tracker store. When an action is run and the tracker store is json encoded it fails when attempting to serialize the Decimal value. This is similar to issue #2265

Error (including full traceback):

2020-01-23 11:47:22 DEBUG    rasa.core.processor  - Object of type Decimal is not JSON serializable
Traceback (most recent call last):
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/rasa/core/processor.py", line 564, in _run_action
events = await action.run(output_channel, nlg, tracker, self.domain)
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/rasa/core/actions/action.py", line 541, in run
json=json_body, method="post", timeout=DEFAULT_REQUEST_TIMEOUT
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/rasa/utils/endpoints.py", line 146, in request
**kwargs,
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/aiohttp/client.py", line 1012, in __aenter__
self._resp = await self._coro
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/aiohttp/client.py", line 365, in _request
data = payload.JsonPayload(json, dumps=self._json_serialize)
File "/Users/dsammut/Repos/chatbot-rasa/venv/lib/python3.7/site-packages/aiohttp/payload.py", line 389, in __init__
dumps(value).encode(encoding),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type Decimal is not JSON serializable

Content of configuration file (config.yml) (if relevant):

language: en
# pretrained_embeddings_convert
pipeline:
- name: "WhitespaceTokenizer"
- name: "ConveRTFeaturizer"
- name: "EmbeddingIntentClassifier"
policies:
- name: FormPolicy
- name: MemoizationPolicy
- name: KerasPolicy
- name: MappingPolicy
- name: TwoStageFallbackPolicy
  nlu_threshold: 0.65
  core_threshold: 0.3
  fallback_core_action_name: action_fallback_transfer
  fallback_nlu_action_name: action_fallback_transfer

Metadata

Assignees

Labels

type:bug 🐛Inconsistencies or issues which will cause an issue or problem for users or implementors.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions