| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Langfuse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Maps a <see cref="LangfuseScoreDataType"/> to the string token expected by the Langfuse REST API. |
| | | 5 | | /// </summary> |
| | | 6 | | internal static class LangfuseScoreDataTypeExtensions |
| | | 7 | | { |
| | | 8 | | /// <summary>Returns the Langfuse API token (<c>NUMERIC</c>, <c>BOOLEAN</c>, <c>CATEGORICAL</c>, <c>TEXT</c>).</summ |
| | | 9 | | /// <param name="dataType">The data type.</param> |
| | | 10 | | /// <returns>The uppercase Langfuse token.</returns> |
| | | 11 | | /// <exception cref="ArgumentOutOfRangeException"><paramref name="dataType"/> is not a defined value.</exception> |
| | 2 | 12 | | public static string ToLangfuseToken(this LangfuseScoreDataType dataType) => dataType switch |
| | 2 | 13 | | { |
| | 1 | 14 | | LangfuseScoreDataType.Numeric => "NUMERIC", |
| | 0 | 15 | | LangfuseScoreDataType.Boolean => "BOOLEAN", |
| | 1 | 16 | | LangfuseScoreDataType.Categorical => "CATEGORICAL", |
| | 0 | 17 | | LangfuseScoreDataType.Text => "TEXT", |
| | 0 | 18 | | _ => throw new ArgumentOutOfRangeException(nameof(dataType), dataType, "Unknown Langfuse score data type."), |
| | 2 | 19 | | }; |
| | | 20 | | } |