Skip to content

Conversation

@javelir
Copy link

@javelir javelir commented Apr 12, 2025

background: assistant message with tool_calls and empty list content can cause litellm crash for Third-Party Models such as OpenAI, DeepSeek, ollama models, etc.
fix: change empty list content to empty string

messages before fix:
[{'role': 'developer', 'content': 'I can answer your questions about the time and weather in a city.\n\nYou are an agent. Your internal name is "weather_time_agent".\n\n The description about you is "Agent to answer questions about the time and weather in a city."'}, {'role': 'user', 'content': 'what time is it in new york?'}, {'role': 'assistant', 'content': [], 'tool_calls': [dict(function=dict(arguments='{"city": "New York"}', name='get_current_time'), id='f61b9dcb-592a-4a3d-9598-1006bc0cfedf', type='function')]}, {'role': 'tool', 'tool_call_id': 'f61b9dcb-592a-4a3d-9598-1006bc0cfedf', 'content': '{"status": "success", "report": "The current time in New York is 2025-04-12 07:35:46 EDT-0400"}'}]

messages after fix -- messages[2]['content']
[{'role': 'developer', 'content': 'I can answer your questions about the time and weather in a city.\n\nYou are an agent. Your internal name is "weather_time_agent".\n\n The description about you is "Agent to answer questions about the time and weather in a city."'}, {'role': 'user', 'content': 'what time is it in new york?'}, {'role': 'assistant', 'content': '', 'tool_calls': [dict(function=dict(arguments='{"city": "New York"}', name='get_current_time'), id='f61b9dcb-592a-4a3d-9598-1006bc0cfedf', type='function')]}, {'role': 'tool', 'tool_call_id': 'f61b9dcb-592a-4a3d-9598-1006bc0cfedf', 'content': '{"status": "success", "report": "The current time in New York is 2025-04-12 07:35:46 EDT-0400"}'}]

@google-cla
Copy link

google-cla bot commented Apr 12, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@binnn6
Copy link

binnn6 commented Apr 14, 2025

related issues.
#171
#20
#143

@hangfei hangfei requested a review from selcukgun May 30, 2025 21:17
@hangfei
Copy link
Collaborator

hangfei commented Jul 10, 2025

related issues. #171 #20 #143

it's fixed per the discussion in this post.

@hangfei hangfei closed this Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants