For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).
Python class
PromptTooLongError
PromptTooLongErrorā
class max.pipelines.context.PromptTooLongError(num_tokens, max_length, *, limit_description='configured maximum context length')
Bases: InputError
Raised when a prompt exceeds the modelās maximum input length.
Exposes num_tokens and max_length as attributes so callers can
handle the failure programmatically (e.g., truncate and retry) instead
of parsing the message.
limit_description describes what is being limited, since the same
failure mode means different things in different architectures (an LLM
context window vs. a diffusion text encoderās max sequence length).
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!