< Summary

Information
Class: NexusLabs.Needlr.AgentFramework.Langfuse.LangfuseScoreConfigRequest
Assembly: NexusLabs.Needlr.AgentFramework.Langfuse
File(s): /home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Langfuse/LangfuseScoreConfigRequest.cs
Line coverage
100%
Covered lines: 18
Uncovered lines: 0
Coverable lines: 18
Total lines: 47
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
get_Name()100%11100%
get_DataType()100%11100%
get_Categories()100%11100%
get_MinValue()100%11100%
get_MaxValue()100%11100%
get_Description()100%11100%
From(...)100%66100%

File(s)

/home/runner/work/needlr/needlr/src/NexusLabs.Needlr.AgentFramework.Langfuse/LangfuseScoreConfigRequest.cs

#LineLine coverage
 1namespace NexusLabs.Needlr.AgentFramework.Langfuse;
 2
 3/// <summary>
 4/// Serializable payload for <c>POST /api/public/score-configs</c>. Property names are projected to
 5/// camelCase by <see cref="LangfuseApiClient"/>.
 6/// </summary>
 7internal sealed record LangfuseScoreConfigRequest
 8{
 9    /// <summary>Gets the score config name.</summary>
 410    public required string Name { get; init; }
 11
 12    /// <summary>Gets the Langfuse data-type token (<c>NUMERIC</c>, <c>BOOLEAN</c>, <c>CATEGORICAL</c>, <c>TEXT</c>).</s
 413    public required string DataType { get; init; }
 14
 15    /// <summary>Gets the categories for a categorical config, or <see langword="null"/>.</summary>
 416    public IReadOnlyList<LangfuseScoreConfigCategory>? Categories { get; init; }
 17
 18    /// <summary>Gets the inclusive minimum for numeric configs, or <see langword="null"/>.</summary>
 419    public double? MinValue { get; init; }
 20
 21    /// <summary>Gets the inclusive maximum for numeric configs, or <see langword="null"/>.</summary>
 422    public double? MaxValue { get; init; }
 23
 24    /// <summary>Gets the optional description.</summary>
 425    public string? Description { get; init; }
 26
 27    /// <summary>Projects a public <see cref="LangfuseScoreConfig"/> to the wire payload.</summary>
 28    /// <param name="config">The score config to project.</param>
 29    /// <returns>The request payload.</returns>
 30    public static LangfuseScoreConfigRequest From(LangfuseScoreConfig config)
 31    {
 232        ArgumentNullException.ThrowIfNull(config);
 33
 234        var isNumeric = config.DataType == LangfuseScoreDataType.Numeric;
 235        var isCategorical = config.DataType == LangfuseScoreDataType.Categorical;
 36
 237        return new LangfuseScoreConfigRequest
 238        {
 239            Name = config.Name,
 240            DataType = config.DataType.ToLangfuseToken(),
 241            Categories = isCategorical ? config.Categories : null,
 242            MinValue = isNumeric ? config.MinValue : null,
 243            MaxValue = isNumeric ? config.MaxValue : null,
 244            Description = config.Description,
 245        };
 46    }
 47}