(text: string)
| 67 | } |
| 68 | |
| 69 | export function countTokens(text: string): number { |
| 70 | if (!text) return 0 |
| 71 | try { |
| 72 | return anthropicCountTokens(text) |
| 73 | } catch { |
| 74 | return Math.round(text.length / 4) |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | export function estimateTokensBatch(texts: string[]): number { |
| 79 | if (texts.length === 0) return 0 |
no outgoing calls
no test coverage detected