Truncation happens at a word boundary where the text has whitespace, and at a
character boundary where it does not (base64, a data URI, a CJK run, a minified
line); otherwise the cap would be unenforceable for exactly the inputs that
most need it. Returns "" for
empty input and never returns NA.
See also
Other cost and token functions:
gr_budget(),
gr_count_tokens(),
gr_estimate_cost(),
gr_model_info(),
gr_model_limits(),
gr_models(),
gr_register_model(),
gr_set_tokenizer(),
gr_tokenizer()