Max Tokens Guard
Enforce a maximum token limit on LLM requests.
Enforce a maximum token limit on LLM requests.
Max Tokens Guard
Section titled “Max Tokens Guard”This guard ensures that the max_tokens parameter sent to the LLM does not exceed
the configured limit. If the parameter is absent, it adds the limit.
If it’s present and exceeds the limit, it overwrites it.
Configuration
Section titled “Configuration”max_tokens(int, optional): The maximum allowed tokens.
Configuration
Section titled “Configuration”| Field | Type | Default | Description |
|---|---|---|---|
max_tokens | `integer | null` | None |
Examples
Section titled “Examples”# Example 1type: max_tokensconfig: max_tokens: 1000