[feature] Hidden State Prefix Caching (#2164)

Signed-off-by: Alex Brooks <albrooks@redhat.com>
This commit is contained in:
Alex Brooks authored and GitHub committed 2026-04-15 17:01:45 +00:00
1 parent c6d76d081b
commit f1e3f03726
9 files changed
+1145 -68

No files matched your search

+6
View File
@@ -1850,6 +1850,7 @@ class OmniResponse:
e2e_latency: float | None = None
success: bool = False
error_message: str | None = None
cached_tokens: int | None = None
@dataclass
@@ -2345,6 +2346,11 @@ class OpenAIClientHandler:
if hasattr(choice.message, "content") and choice.message.content is not None:
text_content = choice.message.content
# Extract cached_tokens for prefix caching tests
usage = getattr(chat_completion, "usage", None)
if usage and (details := getattr(usage, "prompt_tokens_details", None)):
result.cached_tokens = details.cached_tokens
# Calculate end-to-end latency
result.e2e_latency = time.perf_counter() - start_time