max_input_length()

Guard that rejects user messages exceeding a character limit.

Usage

Source

max_input_length(max_chars)

Parameters

max_chars: int
Maximum allowed characters in the input message.

Returns

Guard
A configured input length guard (input-only).

Examples

bot = tb.ChatBot().guardrail(tb.max_input_length(10000))