tokenizers.test.ts 404 B

12345678910111213141516
  1. import { countTokens } from '@anthropic-ai/tokenizer';
  2. describe('countTokens', () => {
  3. test('small text', async () => {
  4. expect(countTokens('hello world!')).toEqual(3);
  5. });
  6. test('text normalising', () => {
  7. expect(countTokens('™')).toEqual(1);
  8. expect(countTokens('ϰ')).toEqual(1);
  9. });
  10. test('allows special tokens', () => {
  11. expect(countTokens('<EOT>')).toEqual(1);
  12. });
  13. });