(text: string | null | undefined)
| 73 | * we round to 4 for a stable baseline. |
| 74 | */ |
| 75 | export function estimateTokens(text: string | null | undefined): number { |
| 76 | if (!text) return 0; |
| 77 | return countTokens(text); |
| 78 | } |
| 79 | |
| 80 | /** Estimate tokens for any JSON-serializable value (used for tool_calls). */ |
| 81 | export function estimateTokensJson(value: unknown): number { |
no test coverage detected