| | | 1 | | using System.ComponentModel; |
| | | 2 | | using Spectre.Console; |
| | | 3 | | using Spectre.Console.Cli; |
| | | 4 | | |
| | | 5 | | namespace Orchestrator.Commands.Observability.ExportExperimentAnalysis; |
| | | 6 | | |
| | | 7 | | public sealed class ExportExperimentAnalysisSettings : CommandSettings |
| | | 8 | | { |
| | | 9 | | [CommandOption("--dataset-name")] |
| | | 10 | | [Description("Hosted Langfuse dataset name that contains the compared runs")] |
| | 1 | 11 | | public string DatasetName { get; set; } = string.Empty; |
| | | 12 | | |
| | | 13 | | [CommandOption("--run-names")] |
| | | 14 | | [Description("Comma-separated list of Langfuse dataset run names to export as one comparable analysis bundle")] |
| | 1 | 15 | | public string RunNames { get; set; } = string.Empty; |
| | | 16 | | |
| | | 17 | | [CommandOption("--output")] |
| | | 18 | | [Description("Optional output path for the normalized analysis bundle JSON file")] |
| | | 19 | | public string? OutputPath { get; set; } |
| | | 20 | | |
| | | 21 | | public override ValidationResult Validate() |
| | | 22 | | { |
| | 1 | 23 | | if (string.IsNullOrWhiteSpace(DatasetName)) |
| | | 24 | | { |
| | 0 | 25 | | return ValidationResult.Error("--dataset-name is required"); |
| | | 26 | | } |
| | | 27 | | |
| | 1 | 28 | | var runNames = GetParsedRunNames(); |
| | 1 | 29 | | if (runNames.Count < 1) |
| | | 30 | | { |
| | 0 | 31 | | return ValidationResult.Error("--run-names must contain at least one unique run name"); |
| | | 32 | | } |
| | | 33 | | |
| | 1 | 34 | | return ValidationResult.Success(); |
| | | 35 | | } |
| | | 36 | | |
| | | 37 | | internal IReadOnlyList<string> GetParsedRunNames() |
| | | 38 | | { |
| | 1 | 39 | | return RunNames |
| | 1 | 40 | | .Split(',', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries) |
| | 1 | 41 | | .Where(runName => !string.IsNullOrWhiteSpace(runName)) |
| | 1 | 42 | | .Distinct(StringComparer.Ordinal) |
| | 1 | 43 | | .ToList(); |
| | | 44 | | } |
| | | 45 | | } |