Logo

anyscale

#10001

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 is due to the input exceeding the maximum allowed context length for the model. Here are the key points:

  • The error message indicates that the input resulted in 4469 tokens, but the model has a maximum context length of 4096 tokens.

  • This exceeds the limit set by the model, leading to a 400 Bad Request error, specifically a PromptTooLongError in this context.

Solution

To fix the 400 Bad Request error due to the input exceeding the maximum allowed context length in the Anyscale API, you can take the following steps:

Ensure that the input prompt does not exceed the maximum context length of 4096 tokens. Here are some actions you can consider:

  • Shorten the input prompt: Reduce the length of the messages or completion to stay within the 4096-token limit.

  • Split the prompt: If necessary, split the input into multiple requests to avoid exceeding the token limit.

  • Optimize the input: Remove any unnecessary parts of the input to fit within the allowed token count.

  • Check for accumulated input: Ensure that the input is not continually accumulated, as this can cause the token count to exceed the limit over time.

Original Error Message

Raw

Input too long: The number of tokens in the input exceeds the maximum allowed length of 4096 tokens. Please reduce the input size.

Original Error Message

Raw

Input too long: The number of tokens in the input exceeds the maximum allowed length of 4096 tokens. Please reduce the input size.