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:
@@ -8,10 +8,13 @@ import (
|
||||
// underlying model, in Langfuse's canonical schema. Set as the value of the
|
||||
// langfuse.observation.usage_details span attribute (JSON-serialized).
|
||||
type TokenUsage struct {
|
||||
Input int `json:"input,omitempty"`
|
||||
Output int `json:"output,omitempty"`
|
||||
Total int `json:"total,omitempty"`
|
||||
Unit string `json:"unit,omitempty"`
|
||||
Input int `json:"input,omitempty"`
|
||||
Output int `json:"output,omitempty"`
|
||||
Total int `json:"total,omitempty"`
|
||||
CacheRead int `json:"cache_read_input_tokens,omitempty"`
|
||||
CacheWrite int `json:"cache_creation_input_tokens,omitempty"`
|
||||
CacheMiss int `json:"cache_miss_input_tokens,omitempty"`
|
||||
Unit string `json:"unit,omitempty"`
|
||||
}
|
||||
|
||||
// Langfuse / OpenTelemetry semantic-convention attribute keys mirrored from
|
||||
|
||||
Reference in New Issue
Block a user