| | | 1 | | using System.Text.Json.Serialization; |
| | | 2 | | |
| | | 3 | | namespace Intentum.AI.SystemOne; |
| | | 4 | | |
| | | 5 | | /// <summary>Answer for a single typed question returned by a System One engine.</summary> |
| | | 6 | | public sealed class SystemOneAnswer |
| | | 7 | | { |
| | | 8 | | /// <summary>Most likely option for a choice question.</summary> |
| | | 9 | | [JsonPropertyName("choice")] |
| | 4 | 10 | | public string? Choice { get; init; } |
| | | 11 | | |
| | | 12 | | /// <summary>Probability per option for a choice/score question.</summary> |
| | | 13 | | [JsonPropertyName("probabilities")] |
| | 4 | 14 | | public IReadOnlyDictionary<string, double>? Probabilities { get; init; } |
| | | 15 | | |
| | | 16 | | /// <summary>Engine-reported confidence of the answer.</summary> |
| | | 17 | | [JsonPropertyName("confidence")] |
| | 5 | 18 | | public double? Confidence { get; init; } |
| | | 19 | | |
| | | 20 | | /// <summary>Probability of the reported answer (Laya and newer engines).</summary> |
| | | 21 | | [JsonPropertyName("answer_confidence")] |
| | 1 | 22 | | public double? AnswerConfidence { get; init; } |
| | | 23 | | |
| | | 24 | | /// <summary>Probability of yes for a noul question.</summary> |
| | | 25 | | [JsonPropertyName("noul")] |
| | 3 | 26 | | public double? Noul { get; init; } |
| | | 27 | | |
| | | 28 | | /// <summary>Mean level index for a score question (0-based).</summary> |
| | | 29 | | [JsonPropertyName("score")] |
| | 3 | 30 | | public double? Score { get; init; } |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | /// <summary>Response payload of POST /v1/systemone.</summary> |
| | | 34 | | public sealed class SystemOneResponse |
| | | 35 | | { |
| | | 36 | | /// <summary>Answers keyed by question id.</summary> |
| | | 37 | | [JsonPropertyName("answers")] |
| | | 38 | | public IReadOnlyDictionary<string, SystemOneAnswer> Answers { get; init; } = |
| | | 39 | | new Dictionary<string, SystemOneAnswer>(); |
| | | 40 | | } |