Logo

azure-openai

#2610000

length_limit_error

'$.messages' exceeds the maximum length of 2048 items. Please reduce the number of items in the messages.

This error has been identified and solved.

Reason

The 400 status error in the Azure OpenAI API, specifically the message "false" is not of type "boolean" - "stream", indicates that the API request is malformed due to incorrect data types in the request payload.

Here are the key reasons for this error:

  • Invalid Data Types: The stream parameter is expected to be a boolean value (true or false), but you are passing a string value ("false") instead. This mismatch in data types causes the API to reject the request with a 400 Bad Request error.

  • Malformed Request Payload: The API is unable to process the request because the payload does not conform to the expected schema. In this case, the stream field should be a boolean, and passing a string violates this requirement.

Solution

To fix the 400 status error in the Azure OpenAI API due to a non-boolean value being encountered where a boolean type was expected, you need to ensure the stream parameter is correctly formatted. Here are the steps to resolve the issue:

  • Verify that the stream parameter is set to either true or false, without quotation marks.

  • Ensure all other parameters in the request payload conform to their expected data types.

  • Check the API documentation to confirm the correct data types for each parameter.

Key corrections:

  • Set "stream": true or "stream": false

  • Avoid using "stream": "true" or "stream": "false".

Original Error Message

Raw

'$.messages' exceeds the maximum length of 2048 items. Please reduce the number of items in the messages.

Original Error Message

Raw

'$.messages' exceeds the maximum length of 2048 items. Please reduce the number of items in the messages.

Suggested Links

https://bobcares.com/blog/azure-openai-invalid_request_error/ https://github.com/vllm-project/vllm/issues/1273 https://community.openai.com/t/how-can-i-write-a-post-request-for-azure-openai-that-uses-structured-output/898569 https://learn.microsoft.com/en-us/answers/questions/2139738/openai-badrequesterror-error-code-400-((error-((me https://github.com/microsoft/semantic-kernel/issues/650

© 2024 Portkey, Inc. All rights reserved

HIPAA

COMPLIANT

GDPR

Transform Your AI app prototypes to be production-ready

Talk to us →