OpenHands
OpenHands copied to clipboard
[Bug]: Tool descriptions too long for OpenAI's models
Is there an existing issue for the same bug?
- [x] I have checked the existing issues.
Describe the bug and reproduction steps
After the prompt changes in https://github.com/All-Hands-AI/OpenHands/pull/7018, it seems the tool descriptions are now exceeding the max length limit for OpenAI's models. I got the following error when using o3-mini and gpt-4o:
litellm.exceptions.ContextWindowExceededError: litellm.ContextWindowExceededError: litellm.BadRequestError: ContextWindowExceededError: OpenAIException - Error code: 400 - {'error': {'message': 'litellm.ContextWindowExceededError: litellm.BadRequestError: ContextWindowExceededError: OpenAIException - Error code: 400 - {\'error\': {\'message\': "Invalid \'tools[0].function.description\': string too long. Expected a string with maximum length 1024, but got a string with length 1602 instead.", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.description\', \'code\': \'string_above_max_length\'}}. Received Model Group=o3-mini\nAvailable Model Group Fallbacks=None\nError doing the fallback: litellm.ContextWindowExceededError: litellm.BadRequestError: ContextWindowExceededError: OpenAIException - Error code: 400 - {\'error\': {\'message\': "Invalid \'tools[0].function.description\': string too long. Expected a string with maximum length 1024, but got a string with length 1602 instead.", \'type\': \'invalid_request_error\', \'param\': \'tools[0].function.description\', \'code\': \'string_above_max_length\'}}', 'type': None, 'param': None, 'code': '400'}}
OpenHands Installation
Development workflow
OpenHands Version
main
Operating System
Linux
Logs, Errors, Screenshots, and Additional Context
No response
I'm having the same error, only in version 0.28. In version 0.27, everything runs fine.
Using AzureOpenAI with o3-mini.