feat: add Graph Tool tracing and logging support in agent run logs
This commit is contained in:
@@ -49,3 +49,13 @@ func (c *RuntimeTraceCollector) AddToolSearchItem(item ToolSearchTraceItem) {
|
||||
c.Data.ToolSearch.Count++
|
||||
c.Data.ToolSearch.Items = append(c.Data.ToolSearch.Items, item)
|
||||
}
|
||||
|
||||
func (c *RuntimeTraceCollector) AddGraphToolItem(item GraphToolTraceItem) {
|
||||
if c == nil {
|
||||
return
|
||||
}
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
c.Data.GraphTools.Count++
|
||||
c.Data.GraphTools.Items = append(c.Data.GraphTools.Items, item)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,16 @@ type ToolSearchTraceItem struct {
|
||||
ErrorMessage string `json:"errorMessage,omitempty"`
|
||||
}
|
||||
|
||||
type GraphToolTraceItem struct {
|
||||
ToolCode string `json:"toolCode"`
|
||||
ToolName string `json:"toolName"`
|
||||
Arguments map[string]any `json:"arguments,omitempty"`
|
||||
ResultPreview string `json:"resultPreview,omitempty"`
|
||||
LatencyMs int64 `json:"latencyMs,omitempty"`
|
||||
Status string `json:"status,omitempty"`
|
||||
ErrorMessage string `json:"errorMessage,omitempty"`
|
||||
}
|
||||
|
||||
type RetrieverTraceItem struct {
|
||||
Query string `json:"query,omitempty"`
|
||||
KnowledgeBaseID int64 `json:"knowledgeBaseId,omitempty"`
|
||||
@@ -62,6 +72,10 @@ type RuntimeTraceData struct {
|
||||
Count int `json:"count,omitempty"`
|
||||
Items []ToolSearchTraceItem `json:"items,omitempty"`
|
||||
} `json:"toolSearch"`
|
||||
GraphTools struct {
|
||||
Count int `json:"count,omitempty"`
|
||||
Items []GraphToolTraceItem `json:"items,omitempty"`
|
||||
} `json:"graphTools"`
|
||||
Output struct {
|
||||
ReplyText string `json:"replyText,omitempty"`
|
||||
FinishReason string `json:"finishReason,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user