(c: TokenUsage)
| 482 | } |
| 483 | |
| 484 | function cacheStats(c: TokenUsage): CacheStats { |
| 485 | const inputTotal = c.inputOther + c.inputCacheRead + c.inputCacheCreation; |
| 486 | return { |
| 487 | inputOther: c.inputOther, |
| 488 | inputCacheRead: c.inputCacheRead, |
| 489 | inputCacheCreation: c.inputCacheCreation, |
| 490 | output: c.output, |
| 491 | hitRate: inputTotal > 0 ? c.inputCacheRead / inputTotal : null, |
| 492 | }; |
| 493 | } |