What’s the best way to truncate text?

I’ve got text stored in a “Get Multiple Variables” module, and I’ve calculated its token count with the next module.

If the token count exceeds a specific limit (eg. 50,000 tokens), what’s the best way to truncate the text to match that limit? Using the ‘slice’ function?

Please advise, thank you!

Possible solution here To long JSON - #2 by samliew

I should put this into a module :slight_smile:

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

4 Likes

Thanks and yeah would be a neat feature!

You now have two new options,

Module can be installed here: Is there a way to count tokens?

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

1 Like

Very cool, thank you again!

2 Likes

No, thank you for suggesting it! Hope you find it useful!!!

If you find any issues with any of my modules, or have new module ideas or requests, I would appreciate it if you can message me with any errors you find.

You can use the private messaging feature to directly reach out to other forum members. To do this, go to your profile, and click on the “New Message” button found there:

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.