#233 — Fix JSON serialization when processing LLM engine’s ChatResponseWidget
Repo: Twill-AI/facade State: closed | Status: done Assignee: Unassigned
Created: 2024-12-05 · Updated: 2025-03-24
Description
We are still facing JSON serialization issues in websockets_router.py when we try to process ChatResponseWidget data from LLM engine:
2024-12-05 06:32:44.945|ERROR|LOCALTENAN|websockets_router:500|003e6bbe-53c4-42dc-9a45-71b4a520bbf7: Failed to handle LLM Engine response in LLM Chat 33:
Traceback (most recent call last):
File "/app/app/api/websockets_router.py", line 467, in _run_llm_engine_with_context
) = await self._process_chat_event(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/app/api/websockets_router.py", line 714, in _process_chat_event
values_rows=json.dumps(
^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/__init__.py", line 238, in dumps
**kw).encode(obj)
^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type date is not JSON serializable
AC:
- WebSocketsRouter successfully processes data of type
ChatResponseWidgetwhen it contains eitherdateordatetimevalues.
Notes
Add implementation notes, blockers, and context here
Related
Add wikilinks to related people, meetings, or other tickets