feat: enhance knowledge retrieval by adding MaxContextItems support and refactoring related methods

This commit is contained in:
mlogclub
2026-04-12 11:02:08 +08:00
parent 0b77d91dfe
commit 0db5f0d663
4 changed files with 42 additions and 6 deletions
@@ -74,6 +74,7 @@ func (c *RuntimeTraceCollector) SetRetrieverSummary(summary RetrieverTraceSummar
c.Data.Retriever.TopK = summary.TopK
c.Data.Retriever.ScoreThreshold = summary.ScoreThreshold
c.Data.Retriever.ContextMaxTokens = summary.ContextMaxTokens
c.Data.Retriever.MaxContextItems = summary.MaxContextItems
c.Data.Retriever.Count = summary.HitCount
c.Data.Retriever.ContextCount = summary.ContextCount
c.Data.Retriever.EmbeddingMs = summary.EmbeddingMs
@@ -45,6 +45,7 @@ type RetrieverTraceSummary struct {
TopK int
ScoreThreshold float64
ContextMaxTokens int
MaxContextItems int
HitCount int
ContextCount int
EmbeddingMs int64
@@ -103,6 +104,7 @@ type RuntimeTraceData struct {
TopK int `json:"topK,omitempty"`
ScoreThreshold float64 `json:"scoreThreshold,omitempty"`
ContextMaxTokens int `json:"contextMaxTokens,omitempty"`
MaxContextItems int `json:"maxContextItems,omitempty"`
ContextCount int `json:"contextCount,omitempty"`
EmbeddingMs int64 `json:"embeddingMs,omitempty"`
VectorSearchMs int64 `json:"vectorSearchMs,omitempty"`