({ models, totalCachedTokens, cacheEfficiency })
| 70 | totalCachedTokens: number; |
| 71 | cacheEfficiency: number; |
| 72 | }> = ({ models, totalCachedTokens, cacheEfficiency }) => { |
| 73 | const nameWidth = 25; |
| 74 | const requestsWidth = 8; |
| 75 | const inputTokensWidth = 15; |
| 76 | const outputTokensWidth = 15; |
| 77 | |
| 78 | return ( |
| 79 | <Box flexDirection="column" marginTop={1}> |
| 80 | {/* Header */} |
| 81 | <Box> |
| 82 | <Box width={nameWidth}> |
| 83 | <Text bold>Model Usage</Text> |
| 84 | </Box> |
| 85 | <Box width={requestsWidth} justifyContent="flex-end"> |
| 86 | <Text bold>Reqs</Text> |
| 87 | </Box> |
| 88 | <Box width={inputTokensWidth} justifyContent="flex-end"> |
| 89 | <Text bold>Input Tokens</Text> |
| 90 | </Box> |
| 91 | <Box width={outputTokensWidth} justifyContent="flex-end"> |
| 92 | <Text bold>Output Tokens</Text> |
| 93 | </Box> |
| 94 | </Box> |
| 95 | {/* Divider */} |
| 96 | <Box |
| 97 | borderStyle="round" |
| 98 | borderBottom={true} |
| 99 | borderTop={false} |
| 100 | borderLeft={false} |
| 101 | borderRight={false} |
| 102 | width={nameWidth + requestsWidth + inputTokensWidth + outputTokensWidth} |
| 103 | ></Box> |
| 104 | |
| 105 | {/* Rows */} |
| 106 | {Object.entries(models).map(([name, modelMetrics]) => ( |
| 107 | <Box key={name}> |
| 108 | <Box width={nameWidth}> |
| 109 | <Text>{name.replace('-001', '')}</Text> |
| 110 | </Box> |
| 111 | <Box width={requestsWidth} justifyContent="flex-end"> |
| 112 | <Text>{modelMetrics.api.totalRequests}</Text> |
| 113 | </Box> |
| 114 | <Box width={inputTokensWidth} justifyContent="flex-end"> |
| 115 | <Text color={Colors.AccentYellow}> |
| 116 | {modelMetrics.tokens.prompt.toLocaleString()} |
| 117 | </Text> |
| 118 | </Box> |
| 119 | <Box width={outputTokensWidth} justifyContent="flex-end"> |
| 120 | <Text color={Colors.AccentYellow}> |
| 121 | {modelMetrics.tokens.candidates.toLocaleString()} |
| 122 | </Text> |
| 123 | </Box> |
| 124 | </Box> |
| 125 | ))} |
| 126 | {cacheEfficiency > 0 && ( |
| 127 | <Box flexDirection="column" marginTop={1}> |
| 128 | <Text> |
| 129 | <Text color={Colors.AccentGreen}>Savings Highlight:</Text>{' '} |
nothing calls this directly
no outgoing calls
no test coverage detected