Azure-Samples / aisearch-openai-rag-audio

A simple example implementation of the VoiceRAG pattern to power interactive voice generative AI experiences using RAG with Azure AI Search and Azure OpenAI's gpt-4o-realtime-preview model.
https://azure.microsoft.com/products/search
MIT License
211 stars 105 forks source link

Error handling request - JSONDecodeError #10

Open iMicknl opened 3 weeks ago

iMicknl commented 3 weeks ago

I did face a JSONDecodeError sometimes, but I haven't been able to debug this yet. It occurs at random times and I couldn't do a solid repro.

Error handling request
Traceback (most recent call last):
  File "/home/vscode/.local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/vscode/.local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/aisearch-openai-rag-audio/app/backend/rtmt.py", line 210, in _websocket_handler
    await self._forward_messages(ws)
  File "/workspaces/aisearch-openai-rag-audio/app/backend/rtmt.py", line 202, in _forward_messages
    await asyncio.gather(from_client_to_server(), from_server_to_client())
  File "/workspaces/aisearch-openai-rag-audio/app/backend/rtmt.py", line 195, in from_server_to_client
    new_msg = await self._process_message_to_client(msg, ws, target_ws)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspaces/aisearch-openai-rag-audio/app/backend/rtmt.py", line 114, in _process_message_to_client
    result = await tool.target(json.loads(args))
                               ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)