v.22.11Improvement

Refactor tokens function for adjustable max token return (default disabled)

Refactor function tokens to enable max tokens returned for related functions (disabled by default). #42673 (李扬).
Refactor the tokens function to support a maximum token limit for related functions, allowing control over the number of tokens returned.

Why it matters

This feature addresses the need to limit the number of tokens returned by functions related to tokens, improving query control and preventing excessive data retrieval. It provides users with the ability to constrain output size for performance and usability enhancements.

How to use it

The maximum tokens feature is disabled by default. Users can enable it by specifying the maximum tokens parameter where applicable in the related functions, adjusting the token limit to their requirements.