-
Notifications
You must be signed in to change notification settings - Fork 56
Description
I tried to run the testing claude code, if I do not interrupt the model, everything is working fine. If I interrupt during the conversation, I received following error:
Received interaction_type=response_required, response_id=1, last_transcript=Yes. I would like to make appointment
Transcript messages: [{'role': 'user', 'content': '\n ...\n '}, {'role': 'assistant', 'content': "Hey there, I'm your personal AI therapist, how can I help you?"}, {'role': 'user', 'content': 'Yes. I would like to make appointment'}]
request.response_id: 1
Stop reason: end_turn
Received interaction_type=response_required, response_id=2, last_transcript=an appointment. Can you tell me what day and time
Transcript messages: [{'role': 'user', 'content': '\n ...\n '}, {'role': 'assistant', 'content': "Hey there, I'm your personal AI therapist, how can I help you?"}, {'role': 'user', 'content': 'Yes. I would like to make appointment'}, {'role': 'assistant', 'content': "Absolutely! I'd be happy to help you schedule "}, {'role': 'user', 'content': 'What time'}, {'role': 'assistant', 'content': 'an appointment. Can you tell me what day and time '}]
request.response_id: 2
Task exception was never retrieved
future: <Task finished name='Task-56' coro=<websocket_handler..handle_message() done, defined at D:\Project-AI-Retell\retell-custom-llm-python-demo\app\server.py:153> exception=BadRequestError("Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: final assistant content cannot end with trailing whitespace'}}")>
Traceback (most recent call last):
File "D:\Project-AI-Retell\retell-custom-llm-python-demo\app\server.py", line 185, in handle_message
async for event in llm_client.draft_response(request):
File "D:\Project-AI-Retell\retell-custom-llm-python-demo\app\claude_with_func_calling.py", line 264, in draft_response
stream = await self.client.messages.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\miniconda3\envs\retell\Lib\site-packages\anthropic\resources\messages.py", line 1799, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "D:\miniconda3\envs\retell\Lib\site-packages\anthropic_base_client.py", line 1816, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\miniconda3\envs\retell\Lib\site-packages\anthropic_base_client.py", line 1510, in request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "D:\miniconda3\envs\retell\Lib\site-packages\anthropic_base_client.py", line 1611, in _request
raise self._make_status_error_from_response(err.response) from None
anthropic.BadRequestError: Error code: 400 - {'type': 'error', 'error': {'type': 'invalid_request_error', 'message': 'messages: final assistant content cannot end with trailing whitespace'}}
Received interaction_type=response_required, response_id=3, last_transcript=is the today?