-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
Sometimes the API returns an error as plain text instead of JSON, this causes the client to raise an additional exception.
Traceback (most recent call last):
File "/Users/tommaso/src/Vision-Agents/.venv/lib/python3.12/site-packages/cartesia/tts/client.py", line 335, in bytes
_response_json = _response.json()
^^^^^^^^^^^^^^^^
File "/Users/tommaso/src/Vision-Agents/.venv/lib/python3.12/site-packages/httpx/_models.py", line 832, in json
return jsonlib.loads(self.content, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommaso/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommaso/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/json/decoder.py", line 338, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/tommaso/.local/share/uv/python/cpython-3.12.9-macos-aarch64-none/lib/python3.12/json/decoder.py", line 356, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/tommaso/src/Vision-Agents/agents-core/vision_agents/core/events/manager.py", line 503, in _run_handler
return await handler(event)
^^^^^^^^^^^^^^^^^^^^
File "/Users/tommaso/src/Vision-Agents/agents-core/vision_agents/core/agents/agents.py", line 202, in on_llm_response_send_to_tts
await self.tts.send(event.text)
File "/Users/tommaso/src/Vision-Agents/agents-core/vision_agents/core/tts/tts.py", line 194, in send
async for chunk in audio_data:
File "/Users/tommaso/src/Vision-Agents/plugins/cartesia/vision_agents/plugins/cartesia/tts.py", line 94, in _audio_chunk_stream
async for chunk in response:
File "/Users/tommaso/src/Vision-Agents/.venv/lib/python3.12/site-packages/cartesia/tts/client.py", line 337, in bytes
raise ApiError(status_code=_response.status_code, body=_response.text)
cartesia.core.api_error.ApiError: status_code: 402, body: credit limit reached. Please upgrade your subscription at (https://play.cartesia.ai/subscription) to increase your credit limit or contact us at support@cartesia.ai

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels