docs/1_python/_7_api-reference/count-tokens.md at main · lmstudio-ai/docs · GitHub
Skip to content

Latest commit

 

History

History
7 lines (6 loc) · 393 Bytes

count-tokens.md

File metadata and controls

7 lines (6 loc) · 393 Bytes
title .countTokens()
sidebar_title .countTokens()
description .countTokens() - API reference for counting tokens in a string using a model's tokenizer

.countTokens() is a method that counts the number of tokens in a string using a model's tokenizer. This method is useful for situations such as assessing whether a string could fit in the model's remaining context window.