| | | 1 | | using System.Text.Json.Serialization; |
| | | 2 | | using EHonda.KicktippAi.Core; |
| | | 3 | | |
| | | 4 | | namespace Orchestrator.Commands.Observability.Experiments; |
| | | 5 | | |
| | | 6 | | internal sealed record PreparedExperimentManifest |
| | | 7 | | { |
| | | 8 | | [JsonPropertyName("task")] |
| | | 9 | | public string? TaskType { get; init; } |
| | | 10 | | |
| | | 11 | | [JsonPropertyName("sliceKey")] |
| | | 12 | | public string SliceKey { get; init; } = string.Empty; |
| | | 13 | | |
| | | 14 | | [JsonPropertyName("sliceKind")] |
| | | 15 | | public string SliceKind { get; init; } = string.Empty; |
| | | 16 | | |
| | | 17 | | [JsonPropertyName("sampleMethod")] |
| | | 18 | | public string SampleMethod { get; init; } = string.Empty; |
| | | 19 | | |
| | | 20 | | [JsonPropertyName("communityContext")] |
| | | 21 | | public string CommunityContext { get; init; } = string.Empty; |
| | | 22 | | |
| | | 23 | | [JsonPropertyName("sourcePoolKey")] |
| | | 24 | | public string SourcePoolKey { get; init; } = string.Empty; |
| | | 25 | | |
| | | 26 | | [JsonPropertyName("sourceDatasetName")] |
| | | 27 | | public string SourceDatasetName { get; init; } = string.Empty; |
| | | 28 | | |
| | | 29 | | [JsonPropertyName("sliceDatasetName")] |
| | | 30 | | public string SliceDatasetName { get; init; } = string.Empty; |
| | | 31 | | |
| | | 32 | | [JsonPropertyName("competition")] |
| | | 33 | | public string Competition { get; init; } = string.Empty; |
| | | 34 | | |
| | | 35 | | [JsonPropertyName("season")] |
| | | 36 | | public string Season { get; init; } = string.Empty; |
| | | 37 | | |
| | | 38 | | [JsonPropertyName("sampleSeed")] |
| | | 39 | | public int? SampleSeed { get; init; } |
| | | 40 | | |
| | | 41 | | [JsonPropertyName("sampleSize")] |
| | | 42 | | public int SampleSize { get; init; } |
| | | 43 | | |
| | | 44 | | [JsonPropertyName("matchCount")] |
| | | 45 | | public int? MatchCount { get; init; } |
| | | 46 | | |
| | | 47 | | [JsonPropertyName("repetitions")] |
| | | 48 | | public int? Repetitions { get; init; } |
| | | 49 | | |
| | | 50 | | [JsonPropertyName("selectedItemIds")] |
| | | 51 | | public IReadOnlyList<string> SelectedItemIds { get; init; } = []; |
| | | 52 | | |
| | | 53 | | [JsonPropertyName("selectedItemIdsHash")] |
| | | 54 | | public string SelectedItemIdsHash { get; init; } = string.Empty; |
| | | 55 | | |
| | | 56 | | [JsonPropertyName("cutoffMatchday")] |
| | | 57 | | public int? CutoffMatchday { get; init; } |
| | | 58 | | |
| | | 59 | | [JsonPropertyName("startsAfter")] |
| | | 60 | | public string? StartsAfter { get; init; } |
| | | 61 | | |
| | | 62 | | [JsonPropertyName("participants")] |
| | | 63 | | public IReadOnlyList<PreparedExperimentParticipantManifest> Participants { get; init; } = []; |
| | | 64 | | |
| | | 65 | | [JsonPropertyName("items")] |
| | | 66 | | public IReadOnlyList<PreparedExperimentManifestItem> Items { get; init; } = []; |
| | | 67 | | } |
| | | 68 | | |
| | | 69 | | internal sealed record PreparedExperimentParticipantManifest |
| | | 70 | | { |
| | | 71 | | [JsonPropertyName("participantId")] |
| | | 72 | | public string ParticipantId { get; init; } = string.Empty; |
| | | 73 | | |
| | | 74 | | [JsonPropertyName("displayName")] |
| | | 75 | | public string DisplayName { get; init; } = string.Empty; |
| | | 76 | | |
| | | 77 | | [JsonPropertyName("predictions")] |
| | | 78 | | public IReadOnlyList<PreparedExperimentParticipantPrediction> Predictions { get; init; } = []; |
| | | 79 | | } |
| | | 80 | | |
| | | 81 | | internal sealed record PreparedExperimentParticipantPrediction |
| | | 82 | | { |
| | | 83 | | [JsonPropertyName("sourceDatasetItemId")] |
| | | 84 | | public string SourceDatasetItemId { get; init; } = string.Empty; |
| | | 85 | | |
| | | 86 | | [JsonPropertyName("status")] |
| | | 87 | | public string Status { get; init; } = string.Empty; |
| | | 88 | | |
| | | 89 | | [JsonPropertyName("homeGoals")] |
| | | 90 | | public int? HomeGoals { get; init; } |
| | | 91 | | |
| | | 92 | | [JsonPropertyName("awayGoals")] |
| | | 93 | | public int? AwayGoals { get; init; } |
| | | 94 | | |
| | | 95 | | [JsonPropertyName("kicktippPoints")] |
| | | 96 | | public int KicktippPoints { get; init; } |
| | | 97 | | } |
| | | 98 | | |
| | | 99 | | internal sealed record PreparedExperimentManifestItem |
| | | 100 | | { |
| | | 101 | | [JsonPropertyName("sourceDatasetItemId")] |
| | 1 | 102 | | public string SourceDatasetItemId { get; init; } = string.Empty; |
| | | 103 | | |
| | | 104 | | [JsonPropertyName("sliceDatasetItemId")] |
| | 1 | 105 | | public string SliceDatasetItemId { get; init; } = string.Empty; |
| | | 106 | | |
| | | 107 | | [JsonPropertyName("homeTeam")] |
| | 1 | 108 | | public string HomeTeam { get; init; } = string.Empty; |
| | | 109 | | |
| | | 110 | | [JsonPropertyName("awayTeam")] |
| | 1 | 111 | | public string AwayTeam { get; init; } = string.Empty; |
| | | 112 | | |
| | | 113 | | [JsonPropertyName("matchday")] |
| | | 114 | | public int Matchday { get; init; } |
| | | 115 | | |
| | | 116 | | [JsonPropertyName("startsAt")] |
| | 1 | 117 | | public string StartsAt { get; init; } = string.Empty; |
| | | 118 | | |
| | | 119 | | [JsonPropertyName("tippSpielId")] |
| | | 120 | | public string? TippSpielId { get; init; } |
| | | 121 | | |
| | | 122 | | [JsonPropertyName("fixtureIndex")] |
| | | 123 | | public int? FixtureIndex { get; init; } |
| | | 124 | | |
| | | 125 | | [JsonPropertyName("repetitionIndex")] |
| | | 126 | | public int? RepetitionIndex { get; init; } |
| | | 127 | | } |
| | | 128 | | |
| | | 129 | | internal sealed record PreparedExperimentEvaluationTimestampPolicyMetadata |
| | | 130 | | { |
| | | 131 | | [JsonPropertyName("kind")] |
| | | 132 | | public string? Kind { get; init; } |
| | | 133 | | |
| | | 134 | | [JsonPropertyName("reference")] |
| | | 135 | | public string? Reference { get; init; } |
| | | 136 | | |
| | | 137 | | [JsonPropertyName("offset")] |
| | | 138 | | public string? Offset { get; init; } |
| | | 139 | | } |
| | | 140 | | |
| | | 141 | | internal sealed record PreparedExperimentRunMetadata |
| | | 142 | | { |
| | | 143 | | [JsonPropertyName("runner")] |
| | | 144 | | public string? Runner { get; init; } |
| | | 145 | | |
| | | 146 | | [JsonPropertyName("task")] |
| | | 147 | | public string? TaskType { get; init; } |
| | | 148 | | |
| | | 149 | | [JsonPropertyName("communityContext")] |
| | | 150 | | public string? CommunityContext { get; init; } |
| | | 151 | | |
| | | 152 | | [JsonPropertyName("competition")] |
| | | 153 | | public string? Competition { get; init; } |
| | | 154 | | |
| | | 155 | | [JsonPropertyName("sourceDatasetName")] |
| | | 156 | | public string? SourceDatasetName { get; init; } |
| | | 157 | | |
| | | 158 | | [JsonPropertyName("datasetName")] |
| | | 159 | | public string? DatasetName { get; init; } |
| | | 160 | | |
| | | 161 | | [JsonPropertyName("promptKey")] |
| | | 162 | | public string? PromptKey { get; init; } |
| | | 163 | | |
| | | 164 | | [JsonPropertyName("promptSource")] |
| | | 165 | | public string? PromptSource { get; init; } |
| | | 166 | | |
| | | 167 | | [JsonPropertyName("langfusePromptName")] |
| | | 168 | | public string? LangfusePromptName { get; init; } |
| | | 169 | | |
| | | 170 | | [JsonPropertyName("langfusePromptLabel")] |
| | | 171 | | public string? LangfusePromptLabel { get; init; } |
| | | 172 | | |
| | | 173 | | [JsonPropertyName("langfusePromptVersion")] |
| | | 174 | | public int? LangfusePromptVersion { get; init; } |
| | | 175 | | |
| | | 176 | | [JsonPropertyName("reasoningEffort")] |
| | | 177 | | public string? ReasoningEffort { get; init; } |
| | | 178 | | |
| | | 179 | | [JsonPropertyName("maxOutputTokens")] |
| | | 180 | | public int? MaxOutputTokenCount { get; init; } |
| | | 181 | | |
| | | 182 | | [JsonPropertyName("sliceKind")] |
| | | 183 | | public string? SliceKind { get; init; } |
| | | 184 | | |
| | | 185 | | [JsonPropertyName("sliceKey")] |
| | | 186 | | public string? SliceKey { get; init; } |
| | | 187 | | |
| | | 188 | | [JsonPropertyName("sourcePoolKey")] |
| | | 189 | | public string? SourcePoolKey { get; init; } |
| | | 190 | | |
| | | 191 | | [JsonPropertyName("selectedItemIdsHash")] |
| | | 192 | | public string? SelectedItemIdsHash { get; init; } |
| | | 193 | | |
| | | 194 | | [JsonPropertyName("selectedItemIdsCount")] |
| | | 195 | | public int SelectedItemIdsCount { get; init; } |
| | | 196 | | |
| | | 197 | | [JsonPropertyName("sampleSize")] |
| | | 198 | | public int SampleSize { get; init; } |
| | | 199 | | |
| | | 200 | | [JsonPropertyName("matchCount")] |
| | | 201 | | public int? MatchCount { get; init; } |
| | | 202 | | |
| | | 203 | | [JsonPropertyName("repetitions")] |
| | | 204 | | public int? Repetitions { get; init; } |
| | | 205 | | |
| | | 206 | | [JsonPropertyName("evaluationTimestampPolicyKey")] |
| | | 207 | | public string? EvaluationTimestampPolicyKey { get; init; } |
| | | 208 | | |
| | | 209 | | [JsonPropertyName("evaluationTimestampPolicy")] |
| | | 210 | | public PreparedExperimentEvaluationTimestampPolicyMetadata? EvaluationTimestampPolicy { get; init; } |
| | | 211 | | |
| | | 212 | | [JsonPropertyName("evaluationTime")] |
| | | 213 | | public string? EvaluationTime { get; init; } |
| | | 214 | | |
| | | 215 | | [JsonPropertyName("startedAtUtc")] |
| | | 216 | | public string? StartedAtUtc { get; init; } |
| | | 217 | | |
| | | 218 | | [JsonPropertyName("sampleSeed")] |
| | | 219 | | public int? SampleSeed { get; init; } |
| | | 220 | | |
| | | 221 | | [JsonPropertyName("sampleMethod")] |
| | | 222 | | public string? SampleMethod { get; init; } |
| | | 223 | | |
| | | 224 | | [JsonPropertyName("includeJustification")] |
| | | 225 | | public bool IncludeJustification { get; init; } |
| | | 226 | | |
| | | 227 | | [JsonPropertyName("promptVersion")] |
| | | 228 | | public string? PromptVersion { get; init; } |
| | | 229 | | |
| | | 230 | | [JsonPropertyName("sourceDatasetKind")] |
| | | 231 | | public string? SourceDatasetKind { get; init; } |
| | | 232 | | |
| | | 233 | | [JsonPropertyName("datasetItemIdMap")] |
| | | 234 | | public IReadOnlyDictionary<string, string> DatasetItemIdMap { get; init; } = new Dictionary<string, string>(); |
| | | 235 | | |
| | | 236 | | [JsonPropertyName("model")] |
| | | 237 | | public string? Model { get; init; } |
| | | 238 | | |
| | | 239 | | [JsonPropertyName("observationName")] |
| | | 240 | | public string? ObservationName { get; init; } |
| | | 241 | | |
| | | 242 | | [JsonPropertyName("runSubjectKind")] |
| | | 243 | | public string? RunSubjectKind { get; init; } |
| | | 244 | | |
| | | 245 | | [JsonPropertyName("runSubjectId")] |
| | | 246 | | public string? RunSubjectId { get; init; } |
| | | 247 | | |
| | | 248 | | [JsonPropertyName("runSubjectDisplayName")] |
| | | 249 | | public string? RunSubjectDisplayName { get; init; } |
| | | 250 | | |
| | | 251 | | [JsonPropertyName("batchStrategy")] |
| | | 252 | | public string? BatchStrategy { get; init; } |
| | | 253 | | |
| | | 254 | | [JsonPropertyName("batchSize")] |
| | | 255 | | public int? BatchSize { get; init; } |
| | | 256 | | |
| | | 257 | | [JsonPropertyName("batchCount")] |
| | | 258 | | public int? BatchCount { get; init; } |
| | | 259 | | |
| | | 260 | | [JsonPropertyName("parallelism")] |
| | | 261 | | public int? Parallelism { get; init; } |
| | | 262 | | } |
| | | 263 | | |
| | | 264 | | internal sealed record ExperimentItemScores( |
| | | 265 | | [property: JsonPropertyName("kicktipp_points")] int KicktippPoints); |
| | | 266 | | |
| | | 267 | | internal sealed record ExperimentAggregateScores( |
| | | 268 | | [property: JsonPropertyName("total_kicktipp_points")] double TotalKicktippPoints, |
| | | 269 | | [property: JsonPropertyName("avg_kicktipp_points")] double AvgKicktippPoints); |
| | | 270 | | |
| | | 271 | | internal sealed record PreparedExperimentExecutionSummary( |
| | | 272 | | string DatasetItemId, |
| | | 273 | | string SourceDatasetItemId, |
| | | 274 | | string RunName, |
| | | 275 | | string TraceId, |
| | | 276 | | Prediction? Prediction, |
| | | 277 | | ExperimentItemScores Scores, |
| | | 278 | | IReadOnlyList<string> TraceTags, |
| | | 279 | | PreparedExperimentTokenUsageSummary? Usage = null, |
| | | 280 | | string PredictionStatus = "placed", |
| | | 281 | | int? FixtureIndex = null, |
| | | 282 | | int? RepetitionIndex = null); |
| | | 283 | | |
| | | 284 | | internal sealed record PreparedExperimentDatasetRunSummary( |
| | | 285 | | int Repetition, |
| | | 286 | | string RunName, |
| | | 287 | | string DatasetRunId, |
| | | 288 | | int RunItemCount, |
| | | 289 | | ExperimentAggregateScores AggregateScores, |
| | | 290 | | PreparedExperimentExecutionSummary? FirstExecution, |
| | | 291 | | PreparedExperimentExecutionSummary? LastExecution); |
| | | 292 | | |
| | | 293 | | internal sealed record PreparedExperimentRunSummary( |
| | | 294 | | string DatasetName, |
| | | 295 | | string RunName, |
| | | 296 | | string RunFamilyName, |
| | | 297 | | string TaskType, |
| | | 298 | | string Model, |
| | | 299 | | bool DeletedExistingRun, |
| | | 300 | | int SampleSize, |
| | | 301 | | string BatchStrategy, |
| | | 302 | | int? BatchSize, |
| | | 303 | | int? BatchCount, |
| | | 304 | | int? Parallelism, |
| | | 305 | | int ExecutionCount, |
| | | 306 | | int RunCount, |
| | | 307 | | ExperimentAggregateScores AggregateScores, |
| | | 308 | | IReadOnlyList<PreparedExperimentDatasetRunSummary> DatasetRuns, |
| | | 309 | | PreparedExperimentExecutionSummary? FirstExecution, |
| | | 310 | | PreparedExperimentExecutionSummary? LastExecution); |
| | | 311 | | |
| | | 312 | | internal sealed record PreparedExperimentTokenUsageSummary( |
| | | 313 | | int PromptTokens, |
| | | 314 | | int CompletionTokens, |
| | | 315 | | int TotalTokens); |
| | | 316 | | |
| | | 317 | | internal sealed record PreparedExperimentExecutionRequest( |
| | | 318 | | PreparedExperimentManifest Manifest, |
| | | 319 | | PreparedExperimentRunMetadata RunMetadata, |
| | | 320 | | string Model, |
| | | 321 | | string RunName, |
| | | 322 | | string? RunDescription, |
| | | 323 | | bool ReplaceRun, |
| | | 324 | | IReadOnlyList<IReadOnlyList<PreparedExperimentManifestItem>> Batches); |