mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
feat(ui): add Time to First Token metric to log detail drawer
This commit is contained in:
parent
fbd8c445e6
commit
0765b042c6
1 changed files with 9 additions and 0 deletions
|
|
@ -258,6 +258,12 @@ function GuardrailLabel({ label, maskedCount }: { label: string; maskedCount: nu
|
|||
}
|
||||
|
||||
function MetricsSection({ logEntry, metadata }: { logEntry: LogEntry; metadata: Record<string, any> }) {
|
||||
const completionStartTime = logEntry.completionStartTime;
|
||||
const ttftMs =
|
||||
completionStartTime && completionStartTime !== logEntry.endTime
|
||||
? new Date(completionStartTime).getTime() - new Date(logEntry.startTime).getTime()
|
||||
: null;
|
||||
|
||||
const hasCacheActivity =
|
||||
logEntry.cache_hit ||
|
||||
(metadata?.additional_usage_values?.cache_read_input_tokens &&
|
||||
|
|
@ -284,6 +290,9 @@ function MetricsSection({ logEntry, metadata }: { logEntry: LogEntry; metadata:
|
|||
</Descriptions.Item>
|
||||
<Descriptions.Item label="Cost">${formatNumberWithCommas(logEntry.spend || 0, 8)}</Descriptions.Item>
|
||||
<Descriptions.Item label="Duration">{logEntry.request_duration_ms != null ? (logEntry.request_duration_ms / 1000).toFixed(3) : "-"} s</Descriptions.Item>
|
||||
{ttftMs != null && ttftMs > 0 && (
|
||||
<Descriptions.Item label="Time to First Token">{(ttftMs / 1000).toFixed(3)} s</Descriptions.Item>
|
||||
)}
|
||||
|
||||
{hasCacheActivity && (
|
||||
<>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue