feat(llm): add prompt-cache observability and wiki cache-friendly prompts
Normalize provider-specific cache counters into TokenUsage, propagate call purpose and prefix fingerprints through context for logging and Langfuse, and restructure wiki page-modify prompts with warmup/singleflight to improve prefix cache hit rates during reduce batches.
This commit is contained in:
@@ -108,8 +108,9 @@ func buildResponseToolCalls(tcs []types.LLMToolCall) []logger.LLMToolCallInfo {
|
||||
}
|
||||
|
||||
func usageString(u types.TokenUsage) string {
|
||||
return fmt.Sprintf("Prompt: %d, Completion: %d, Total: %d",
|
||||
u.PromptTokens, u.CompletionTokens, u.TotalTokens)
|
||||
return fmt.Sprintf("Prompt: %d, Completion: %d, Total: %d, CacheRead: %d, CacheWrite: %d, CacheMiss: %d, CacheStatus: %s",
|
||||
u.PromptTokens, u.CompletionTokens, u.TotalTokens, u.CacheReadTokens,
|
||||
u.CacheWriteTokens, u.CacheMissTokens, u.CacheStatus)
|
||||
}
|
||||
|
||||
// logLLMDebugCall logs a complete non-stream LLM chat call.
|
||||
|
||||
Reference in New Issue
Block a user