| | | 1 | | namespace NexusLabs.Needlr.AgentFramework.Langfuse; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Serializable payload for <c>POST /api/public/dataset-items</c>. Items are upserted on |
| | | 5 | | /// <see cref="Id"/>. Property names are projected to camelCase by <see cref="LangfuseApiClient"/>. |
| | | 6 | | /// </summary> |
| | | 7 | | internal sealed record LangfuseCreateDatasetItemRequest |
| | | 8 | | { |
| | | 9 | | /// <summary>Gets the dataset name the item belongs to.</summary> |
| | 2 | 10 | | public required string DatasetName { get; init; } |
| | | 11 | | |
| | | 12 | | /// <summary>Gets the optional stable item id used for upsert.</summary> |
| | 2 | 13 | | public string? Id { get; init; } |
| | | 14 | | |
| | | 15 | | /// <summary>Gets the item input.</summary> |
| | 2 | 16 | | public object? Input { get; init; } |
| | | 17 | | |
| | | 18 | | /// <summary>Gets the expected output.</summary> |
| | 2 | 19 | | public object? ExpectedOutput { get; init; } |
| | | 20 | | |
| | | 21 | | /// <summary>Gets optional metadata.</summary> |
| | 2 | 22 | | public object? Metadata { get; init; } |
| | | 23 | | |
| | | 24 | | /// <summary>Gets the optional source trace id.</summary> |
| | 2 | 25 | | public string? SourceTraceId { get; init; } |
| | | 26 | | |
| | | 27 | | /// <summary>Gets the optional source observation id.</summary> |
| | 2 | 28 | | public string? SourceObservationId { get; init; } |
| | | 29 | | |
| | | 30 | | /// <summary>Projects a public <see cref="LangfuseDatasetItem"/> to the wire payload.</summary> |
| | | 31 | | /// <param name="item">The dataset item to project.</param> |
| | | 32 | | /// <returns>The request payload.</returns> |
| | | 33 | | public static LangfuseCreateDatasetItemRequest From(LangfuseDatasetItem item) |
| | | 34 | | { |
| | 1 | 35 | | ArgumentNullException.ThrowIfNull(item); |
| | | 36 | | |
| | 1 | 37 | | return new LangfuseCreateDatasetItemRequest |
| | 1 | 38 | | { |
| | 1 | 39 | | DatasetName = item.DatasetName, |
| | 1 | 40 | | Id = item.Id, |
| | 1 | 41 | | Input = item.Input, |
| | 1 | 42 | | ExpectedOutput = item.ExpectedOutput, |
| | 1 | 43 | | Metadata = item.Metadata, |
| | 1 | 44 | | SourceTraceId = item.SourceTraceId, |
| | 1 | 45 | | SourceObservationId = item.SourceObservationId, |
| | 1 | 46 | | }; |
| | | 47 | | } |
| | | 48 | | } |