diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx
index e48fd555dda..7cf111bfc60 100644
--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.test.tsx
@@ -366,9 +366,30 @@ describe("LogDetailContent", () => {
expect(screen.getByText("abc123cachekey")).toBeInTheDocument();
});
+ it("should display a cache miss and Cache Key for the request that populates the response cache", () => {
+ render(
+ ,
+ );
+
+ expect(screen.getByText("Response Cache")).toBeInTheDocument();
+ expect(screen.getByText("Miss")).toBeInTheDocument();
+ expect(screen.getByText("Cache Key")).toBeInTheDocument();
+ expect(screen.getByText("abc123cachekey")).toBeInTheDocument();
+ });
+
it("should hide the Cache Key row when caching is off", () => {
render();
+ expect(screen.getByText("Response Cache")).toBeInTheDocument();
+ expect(screen.queryByText("Cache Key")).not.toBeInTheDocument();
+ });
+
+ it("should hide response cache metadata when caching is off and cache_hit is None", () => {
+ render();
+
+ expect(screen.queryByText("Response Cache")).not.toBeInTheDocument();
expect(screen.queryByText("Cache Key")).not.toBeInTheDocument();
});
diff --git a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx
index 79fb60b9646..585f8db90c8 100644
--- a/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx
+++ b/ui/litellm-dashboard/src/components/view_logs/LogDetailsDrawer/LogDetailContent.tsx
@@ -382,8 +382,10 @@ function MetricsSection({ logEntry, metadata }: { logEntry: LogEntry; metadata:
: null;
const responseCacheValue = String(logEntry.cache_hit ?? "").toLowerCase();
+ const responseCacheKey =
+ logEntry.cache_key && logEntry.cache_key !== "Cache OFF" ? logEntry.cache_key : undefined;
const isResponseCacheHit = responseCacheValue === "true";
- const showResponseCache = isResponseCacheHit || responseCacheValue === "false";
+ const showResponseCache = isResponseCacheHit || responseCacheValue === "false" || responseCacheKey != null;
const promptCacheReadTokens = Number(metadata?.additional_usage_values?.cache_read_input_tokens) || 0;
const promptCacheCreationTokens = Number(metadata?.additional_usage_values?.cache_creation_input_tokens) || 0;
@@ -438,11 +440,11 @@ function MetricsSection({ logEntry, metadata }: { logEntry: LogEntry; metadata:
)}
- {showResponseCache && logEntry.cache_key && logEntry.cache_key !== "Cache OFF" && (
+ {responseCacheKey && (
}
>
-
+
)}
{promptCacheReadTokens > 0 && (