analyzeModelWithSource analyzes all result files for a single model with batch source info
(modelName string, files []string, batchSource string)
| 265 | |
| 266 | // analyzeModelWithSource analyzes all result files for a single model with batch source info |
| 267 | func analyzeModelWithSource(modelName string, files []string, batchSource string) (*ModelAnalysis, error) { |
| 268 | var allResults []models.AgentTestResult |
| 269 | |
| 270 | // Load and aggregate all results from all files |
| 271 | for _, file := range files { |
| 272 | results, err := loadResultFile(file) |
| 273 | if err != nil { |
| 274 | return nil, fmt.Errorf("failed to load file %s: %w", file, err) |
| 275 | } |
| 276 | allResults = append(allResults, results...) |
| 277 | } |
| 278 | |
| 279 | if len(allResults) == 0 { |
| 280 | return nil, fmt.Errorf("no test results found for model %s", modelName) |
| 281 | } |
| 282 | |
| 283 | // Calculate metrics |
| 284 | toolInvocation := calculateToolInvocationMetrics(allResults) |
| 285 | toolSelection := calculateToolSelectionMetrics(allResults) |
| 286 | averageResponseTime := calculateAverageResponseTime(allResults) |
| 287 | |
| 288 | analysis := &ModelAnalysis{ |
| 289 | ModelName: modelName, |
| 290 | BatchSource: batchSource, |
| 291 | ToolInvocation: toolInvocation, |
| 292 | ToolSelection: toolSelection, |
| 293 | AverageResponseTime: averageResponseTime, |
| 294 | TotalTests: len(allResults), |
| 295 | TotalRuns: len(files), |
| 296 | ResultFiles: files, |
| 297 | } |
| 298 | |
| 299 | return analysis, nil |
| 300 | } |
| 301 | |
| 302 | // loadResultFile loads test results from a JSON file |
| 303 | func loadResultFile(filename string) ([]models.AgentTestResult, error) { |
no test coverage detected