Logo

azure-openai

#10057

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 role specified in the prompt message is not one of the valid roles recognized by the API.

The valid roles for the OpenAI API are 'system', 'assistant', 'user', and in some contexts, 'function'[3"].

In your case, the prompt message includes a custom role description ('you are a bot that creates FAQs') which does not match any of these valid roles, resulting in the "Bad Request" error.

Solution

To fix the 400 status error in the Azure OpenAI API, you need to ensure that the roles used in the prompt messages are valid. Here are the steps to correct this:

  • Replace the custom role description with one of the valid roles.

  • Use either 'system', 'assistant', or 'user' as the role in your prompt message.

Key actions:

  • Change 'you are a bot that creates FAQs' to a valid role such as 'system', 'assistant', or 'user'.

  • Ensure all roles in the prompt messages conform to these valid options.

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.

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →