(fileExtension: string)
| 213 | * which makes the real ratio closer to 2 rather than the default 4. |
| 214 | */ |
| 215 | export function bytesPerTokenForFileType(fileExtension: string): number { |
| 216 | switch (fileExtension) { |
| 217 | case 'json': |
| 218 | case 'jsonl': |
| 219 | case 'jsonc': |
| 220 | return 2 |
| 221 | default: |
| 222 | return 4 |
| 223 | } |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * Like {@link roughTokenCountEstimation} but uses a more accurate |
no outgoing calls
no test coverage detected