Logo

azure-openai

#10056

input_validation_error

Invalid input role: expected a role from ["system", "assistant", "user", "function"]. Please correct the role and try again.

This error has been identified and solved.

Reason

The 400 status error in the Azure OpenAI API, specifically the message "you are a bot that creates FAQs" is not one of ["system", "assistant", "user", "function"] - "messages.0.role", indicates that the request is invalid due to an incorrect role specification in the messages array.

This error occurs because the OpenAI API expects the role field in each message to be one of the predefined roles: "system", "assistant", "user", or "function". The provided role "you are a bot that creates FAQs" does not match any of these valid roles, resulting in a "Bad Request" error.

Solution

To fix the 400 status error in the Azure OpenAI API due to an invalid role specification, you need to ensure that the role field in each message matches one of the predefined roles. Here are the steps to correct this:

  • Update the role field in the messages array to one of the valid roles.

  • Use only the following roles: "system", "assistant", "user", or "function".

Ensure all messages in the request adhere to these valid roles to resolve the error.

Original Error Message

Raw

Invalid input role: expected a role from ["system", "assistant", "user", "function"]. Please correct the role and try again.

Original Error Message

Raw

Invalid input role: expected a role from ["system", "assistant", "user", "function"]. Please correct the role and try again.

Suggested Links

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →