diff options
Diffstat (limited to 'stats.go')
| -rw-r--r-- | stats.go | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/stats.go b/stats.go new file mode 100644 index 0000000..ae0d2c1 --- /dev/null +++ b/stats.go @@ -0,0 +1,69 @@ +package main + +/* + // The following are the Go equivalents of the gemini-cli's TypeScript + // interfaces for session statistics. You can use these to collect and + // store metrics in your application. + + // ToolCallDecision represents the user's decision on a tool call. + type ToolCallDecision string + + const ( + Accept ToolCallDecision = "accept" + Reject ToolCallDecision = "reject" + Modify ToolCallDecision = "modify" + AutoAccept ToolCallDecision = "auto_accept" + ) + + // ToolCallStats holds the statistics for a single tool. + type ToolCallStats struct { + Count int + Success int + Fail int + DurationMs int + Decisions map[ToolCallDecision]int + } + + // ModelMetrics holds the statistics for a single model. + type ModelMetrics struct { + API struct { + TotalRequests int + TotalErrors int + TotalLatencyMs int + } + Tokens struct { + Prompt int + Candidates int + Total int + Cached int + Thoughts int + Tool int + } + } + + // SessionMetrics holds all the statistics for a session. + type SessionMetrics struct { + Models map[string]ModelMetrics + Tools struct { + TotalCalls int + TotalSuccess int + TotalFail int + TotalDurationMs int + TotalDecisions map[ToolCallDecision]int + ByName map[string]ToolCallStats + } + Files struct { + TotalLinesAdded int + TotalLinesRemoved int + } + } + + // You will need to initialize and update this struct as your application + // makes API calls and runs tools. + var sessionMetrics SessionMetrics + + // Example of how you might update the metrics after an API call: + // modelMetrics := sessionMetrics.Models["gemini-pro"] + // modelMetrics.API.TotalRequests++ + // ... and so on. +*/ |
