OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

[Bug]: Unsupported value: 'messages[0].role' does not support 'system' with this model.

Open twhite54 opened this issue 1 year ago • 1 comments

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'}}

image

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'}}

twhite54 avatar Nov 08 '24 03:11 twhite54

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.

neubig avatar Nov 08 '24 04:11 neubig

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.

github-actions[bot] avatar Dec 10 '24 02:12 github-actions[bot]

I think litellm has fixed this a while ago. Please reopen or add a new issue if it happens again.

enyst avatar Dec 10 '24 02:12 enyst

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'}}

rw-MohamedAbouseif avatar Jan 14 '25 08:01 rw-MohamedAbouseif