feat: enhance retriever summary handling by adding SetRetrieverSummary method and updating trace summary in knowledge retrieval
This commit is contained in:
@@ -65,6 +65,22 @@ func (c *RuntimeTraceCollector) SetSkillMiddleware(enabled bool, toolName string
|
||||
c.Data.Skill.MiddlewareToolName = toolName
|
||||
}
|
||||
|
||||
func (c *RuntimeTraceCollector) SetRetrieverSummary(summary RetrieverTraceSummary) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.Data.Retriever.TopK = summary.TopK
|
||||
c.Data.Retriever.ScoreThreshold = summary.ScoreThreshold
|
||||
c.Data.Retriever.ContextMaxTokens = summary.ContextMaxTokens
|
||||
c.Data.Retriever.Count = summary.HitCount
|
||||
c.Data.Retriever.ContextCount = summary.ContextCount
|
||||
c.Data.Retriever.EmbeddingMs = summary.EmbeddingMs
|
||||
c.Data.Retriever.VectorSearchMs = summary.VectorSearchMs
|
||||
c.Data.Retriever.HydrateMs = summary.HydrateMs
|
||||
}
|
||||
|
||||
func (c *RuntimeTraceCollector) AddToolItem(item ToolTraceItem) {
|
||||
if c == nil {
|
||||
return
|
||||
|
||||
@@ -41,6 +41,17 @@ type RetrieverTraceItem struct {
|
||||
LatencyMs int64 `json:"latencyMs,omitempty"`
|
||||
}
|
||||
|
||||
type RetrieverTraceSummary struct {
|
||||
TopK int
|
||||
ScoreThreshold float64
|
||||
ContextMaxTokens int
|
||||
HitCount int
|
||||
ContextCount int
|
||||
EmbeddingMs int64
|
||||
VectorSearchMs int64
|
||||
HydrateMs int64
|
||||
}
|
||||
|
||||
type InstructionTraceSummary struct {
|
||||
SectionTitles []string
|
||||
HasProjectRule bool
|
||||
@@ -81,8 +92,15 @@ type RuntimeTraceData struct {
|
||||
CurrentUserMessagePreview string `json:"currentUserMessagePreview,omitempty"`
|
||||
} `json:"input"`
|
||||
Retriever struct {
|
||||
Count int `json:"count,omitempty"`
|
||||
Items []RetrieverTraceItem `json:"items,omitempty"`
|
||||
Count int `json:"count,omitempty"`
|
||||
TopK int `json:"topK,omitempty"`
|
||||
ScoreThreshold float64 `json:"scoreThreshold,omitempty"`
|
||||
ContextMaxTokens int `json:"contextMaxTokens,omitempty"`
|
||||
ContextCount int `json:"contextCount,omitempty"`
|
||||
EmbeddingMs int64 `json:"embeddingMs,omitempty"`
|
||||
VectorSearchMs int64 `json:"vectorSearchMs,omitempty"`
|
||||
HydrateMs int64 `json:"hydrateMs,omitempty"`
|
||||
Items []RetrieverTraceItem `json:"items,omitempty"`
|
||||
} `json:"retriever"`
|
||||
Tools struct {
|
||||
Count int `json:"count,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user