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:
@@ -60,6 +60,7 @@ func (p *PluginChatCompletionStream) OnEvent(ctx context.Context,
|
||||
resourceRefs := llmresource.NewRegistry()
|
||||
chatMessages = sourceRefs.EncodeMessages(chatMessages)
|
||||
chatMessages = resourceRefs.EncodeMessages(chatMessages)
|
||||
ctx = withPromptCacheMetadata(ctx, chatModel, chatMessages, opt, "knowledge_qa")
|
||||
pipelineInfo(ctx, "Stream", "messages_ready", map[string]interface{}{
|
||||
"message_count": len(chatMessages),
|
||||
"system_prompt": chatMessages[0].Content,
|
||||
|
||||
Reference in New Issue
Block a user