| 357 | } |
| 358 | |
| 359 | func evalCmd() *cobra.Command { |
| 360 | var dataset, baseURL, pipeline, apiKey string |
| 361 | run := &cobra.Command{ |
| 362 | Use: "run", |
| 363 | Short: "POST each dataset row to /infer and print summary", |
| 364 | RunE: func(cmd *cobra.Command, args []string) error { |
| 365 | if strings.TrimSpace(dataset) == "" { |
| 366 | return fmt.Errorf("--dataset is required") |
| 367 | } |
| 368 | key := strings.TrimSpace(apiKey) |
| 369 | if key == "" { |
| 370 | key = strings.TrimSpace(os.Getenv("INFERCORE_API_KEY")) |
| 371 | } |
| 372 | ctx := context.Background() |
| 373 | return eval.Run(ctx, baseURL, dataset, os.Stdout, pipeline, key) |
| 374 | }, |
| 375 | } |
| 376 | run.Flags().StringVar(&dataset, "dataset", "", "path to JSON array of eval items") |
| 377 | run.Flags().StringVar(&baseURL, "base-url", "http://127.0.0.1:8080", "InferCore base URL") |
| 378 | run.Flags().StringVar(&pipeline, "pipeline", "", "default pipeline_ref (e.g. inference/basic:v1)") |
| 379 | run.Flags().StringVar(&apiKey, "api-key", "", "X-InferCore-Api-Key (optional; env INFERCORE_API_KEY if unset)") |
| 380 | root := &cobra.Command{Use: "eval", Short: "Routing-focused evaluation"} |
| 381 | root.AddCommand(run) |
| 382 | return root |
| 383 | } |