* Default token counting implementation using tiktoken. * Providers can override this to use their native token counting endpoints. * * @param content The content to count tokens for * @returns A promise resolving to the token count
(content: Anthropic.Messages.ContentBlockParam[])
| 116 | * @returns A promise resolving to the token count |
| 117 | */ |
| 118 | async countTokens(content: Anthropic.Messages.ContentBlockParam[]): Promise<number> { |
| 119 | if (content.length === 0) { |
| 120 | return 0 |
| 121 | } |
| 122 | |
| 123 | return countTokens(content, { useWorker: true }) |
| 124 | } |
| 125 | } |
nothing calls this directly
no test coverage detected