| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Langfuse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Declares the shape of a named Langfuse score so the dashboard renders consistent ranges, |
| | | 5 | | /// colors, and category sets and validates incoming values. Created via |
| | | 6 | | /// <see cref="ILangfuseScoreConfigClient.EnsureScoreConfigAsync"/>. |
| | | 7 | | /// </summary> |
| | | 8 | | /// <remarks> |
| | | 9 | | /// Score configs are project-level setup, typically ensured once at the start of an eval suite. |
| | | 10 | | /// They are matched to scores by <see cref="Name"/>, so use the same name you pass when recording |
| | | 11 | | /// the score (and the same casing/normalization). |
| | | 12 | | /// </remarks> |
| | | 13 | | public sealed record LangfuseScoreConfig |
| | | 14 | | { |
| | | 15 | | /// <summary> |
| | | 16 | | /// Gets the score config name (max 35 characters; letters, numbers, underscores, spaces, |
| | | 17 | | /// periods, parentheses, and hyphens). Must match the score name used when recording. |
| | | 18 | | /// </summary> |
| | 11 | 19 | | public required string Name { get; init; } |
| | | 20 | | |
| | | 21 | | /// <summary>Gets the data type the score values must conform to.</summary> |
| | 9 | 22 | | public required LangfuseScoreDataType DataType { get; init; } |
| | | 23 | | |
| | | 24 | | /// <summary> |
| | | 25 | | /// Gets the inclusive minimum for <see cref="LangfuseScoreDataType.Numeric"/> scores. Ignored |
| | | 26 | | /// for other data types. <see langword="null"/> leaves the minimum unbounded. |
| | | 27 | | /// </summary> |
| | 3 | 28 | | public double? MinValue { get; init; } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Gets the inclusive maximum for <see cref="LangfuseScoreDataType.Numeric"/> scores. Ignored |
| | | 32 | | /// for other data types. <see langword="null"/> leaves the maximum unbounded. |
| | | 33 | | /// </summary> |
| | 3 | 34 | | public double? MaxValue { get; init; } |
| | | 35 | | |
| | | 36 | | /// <summary> |
| | | 37 | | /// Gets the allowed categories for a <see cref="LangfuseScoreDataType.Categorical"/> score. |
| | | 38 | | /// Required for categorical configs; must be omitted for other data types (boolean categories |
| | | 39 | | /// are generated by Langfuse). |
| | | 40 | | /// </summary> |
| | 2 | 41 | | public IReadOnlyList<LangfuseScoreConfigCategory>? Categories { get; init; } |
| | | 42 | | |
| | | 43 | | /// <summary>Gets an optional description shown across the Langfuse UI.</summary> |
| | 3 | 44 | | public string? Description { get; init; } |
| | | 45 | | } |