Merge pull request #701 from 50h100a/api-tokenize

Added tokenizer option for Ooba-like APIs
This commit is contained in:
Cohee
2023-07-12 11:28:50 +03:00
committed by GitHub
4 changed files with 25 additions and 0 deletions

View File

@@ -581,6 +581,8 @@ function getTokenCount(str, padding = undefined) {
return countTokensRemote('/tokenize_nerdstash', str, padding);
case tokenizers.NERD2:
return countTokensRemote('/tokenize_nerdstash_v2', str, padding);
case tokenizers.API:
return countTokensRemote('/tokenize_via_api', str, padding);
default:
console.warn("Unknown tokenizer type", tokenizerType);
return Math.ceil(str.length / CHARACTERS_PER_TOKEN_RATIO) + padding;