Logo

openai

#10098

invalid_role_error

The specified role is not valid. Ensure the role is one of ['system', 'assistant', 'user', 'function'].

This error has been identified and solved.

Reason

The error you are encountering, 'systemm' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.0.role', indicates that the value you provided for the role parameter in your API request is invalid. Specifically, the string 'systemm' does not match any of the acceptable roles which are 'system', 'assistant', 'user', or 'function'.

This error occurs because the OpenAI API strictly enforces the allowed values for the role parameter, and any typo or incorrect value will result in a 400 Bad Request error.

Solution

To resolve the error, you need to correct the role parameter in your API request to one of the accepted values. Here are the steps to fix it:

  • Ensure the role parameter is set to one of the following: system, assistant, user, or function.

  • Check for any typos or incorrect spellings in the role value.

  • Replace the incorrect value 'systemm' with the correct one, such as 'system'.

Here are the valid roles you can use:

  • system

  • assistant

  • user

  • function

Original Error Message

Raw

The specified role is not valid. Ensure the role is one of ['system', 'assistant', 'user', 'function'].

Original Error Message

Raw

The specified role is not valid. Ensure the role is one of ['system', 'assistant', 'user', 'function'].

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →