[Bug]: Unsupported value: 'messages[0].role' does not support 'system' with this model.
Is there an existing issue for the same bug?
- [X] I have checked the existing issues.
Describe the bug and reproduction steps
Run anything with o1-preview
There was an unexpected error while running the agent
litellm.BadRequestError: AzureException BadRequestError - Error code: 400 - {'error': {'message': "Unsupported value: 'messages[0].role' does not support 'system' with this model.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'unsupported_value'}}
OpenHands Installation
Docker command in README
OpenHands Version
openhands:0.12
Operating System
WSL on Windows
Logs, Errors, Screenshots, and Additional Context
Ubuntu nor Docker had any errors in the logs.
UI Error Message:
There was an unexpected error while running the agent
litellm.BadRequestError: AzureException BadRequestError - Error code: 400 - {'error': {'message': "Unsupported value: 'messages[0].role' does not support 'system' with this model.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'unsupported_value'}}
Thanks @twhite54! It seems that you're running through Azure. Could you try running the following program, replacing the key with your Azure key?
import litellm
messages = [
{"role": "system", "content": "Respond in pirate speak."},
{"role": "user", "content": "What is 2+2?"},
]
response = litellm.completion(
api_key="sk-XXX",
model="azure/o1-preview",
messages=messages,
)
print(json.dumps(response.model_dump(), indent=2))
If this fails, then it's probably a problem that should be reported directly to LiteLLM: https://github.com/BerriAI/litellm/
If it works, then we'll need to investigate further, as it may be an error on our side.
This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.
I think litellm has fixed this a while ago. Please reopen or add a new issue if it happens again.
I am still having the same issue even with the latest installation, when using o1 or o1-preview model through azure.
litellm.exceptions.BadRequestError: litellm.BadRequestError: AzureException BadRequestError - Error code: 400 - {'error': {'message': "Unsupported value: 'messages[0].role' does not support 'system' with this model.", 'type': 'invalid_request_error', 'param': 'messages[0].role', 'code': 'unsupported_value'}}