I’m trying to stream output from the Assistants API but I’m facing the issue of ThreadRunStepFailed very frequently.
I’ve noticed that it happens when I’m asking something from the code interpreter, for example, draw the graph of y=x^2
. And this issue isn’t always reproducible, but it happens very frequently on the same prompt.
The thread.run.step.failed
event looks like this
ThreadRunStepFailed(data=RunStep(id='step_jqhAcCOXYlxguYdcnifDUjHe', assistant_id='asst_JvlNMlLftIO80HfiBVsWsWvj', cancelled_at=None, completed_at=None, created_at=1713691694, expired_at=None, failed_at=1713691708, last_error=LastError(code='server_error', message='Sorry, something went wrong.'), metadata=None, object='thread.run.step', run_id='run_lQDkrjCRnsfDSBkvxe1lTxB0', status='failed', step_details=ToolCallsStepDetails(tool_calls=[CodeInterpreterToolCall(id='call_kMjTRqIFEMt97eaRD2fh5jMG', code_interpreter=CodeInterpreter(input="import matplotlib.pyplot as plt\nimport numpy as np\n\nx = np.linspace(-10, 10, 400)\ny = x ** 2\n\nplt.figure(figsize=(8, 6))\nplt.plot(x, y, label='y = x^2')\nplt.title('Graph of y = x^2')\nplt.xlabel('x')\nplt.ylabel('y')\nplt.grid(True)\nplt.legend()\nplt.show()", outputs=[CodeInterpreterOutputImage(image=CodeInterpreterOutputImageImage(file_id='file-oxlAsdcgHNJfTqiMeQB2XRLK'), type='image')]), type='code_interpreter')], type='tool_calls'), thread_id='thread_a1VJ4KeTpBrfMsK0zPnmgBZa', type='tool_calls', usage=Usage(completion_tokens=91, prompt_tokens=4250, total_tokens=4341), expires_at=1713692293), event='thread.run.step.failed')
Is this an internal server error, or can I do something to solve it from my end?