* Count tokens for a single string
(model: string, text: string)
| 41 | * Count tokens for a single string |
| 42 | */ |
| 43 | async countTokens(model: string, text: string): Promise<number> { |
| 44 | assert( |
| 45 | typeof model === "string" && model.length > 0, |
| 46 | "Tokenizer countTokens requires model name" |
| 47 | ); |
| 48 | assert(typeof text === "string", "Tokenizer countTokens requires text"); |
| 49 | return countTokens(model, text); |
| 50 | } |
| 51 | |
| 52 | /** |
| 53 | * Count tokens for a batch of strings |
no test coverage detected