anyscale
#10000
input_length_error
Input too long: The number of tokens in the input exceeds the maximum allowed length of 4096 tokens. Please reduce the input size.
This error has been identified and solved.
Reason
The 400 status error you are encountering in the Anyscale API, specifically the PromptTooLongError
, is due to the following reasons:
Input Length Exceeds Maximum Limit
The input you are sending exceeds the maximum allowed input length. In this case, the API received 7226 tokens, but the maximum input length is 4096 tokens.
Client Error
This error is a client error, indicating that there is an issue with the request body or the values in the request. The error message typically provides details on what was wrong with the request, such as the specific parameter or field that caused the error.
Solution
To fix the 400 status error in the Anyscale API due to the input exceeding the maximum allowed length, you need to adjust the length of your input data. Here are the key steps:
Reduce the number of tokens in your input to be within the 4096 token limit.
Ensure that any messages or completions do not collectively exceed this limit.
Verify that all fields and parameters in your request comply with the API's specifications.
Key Actions:
Shorten the input data to fit within the 4096 token limit.
Review and adjust any long messages or completion requests.
Validate all request parameters to ensure compliance with API requirements.