Skip to content

LangfuseDatasetCaseSource TCase

NexusLabs.Foundry.Langfuse

LangfuseDatasetCaseSource<TCase> Class

Materializes one hosted Langfuse dataset as a finite provider-neutral experiment case source.

public sealed class LangfuseDatasetCaseSource<TCase> : NexusLabs.Foundry.Evaluation.Experiments.IExperimentCaseSource<TCase>

Type parameters

TCase

The caller-owned case value type.

Inheritance System.Object 🡒 LangfuseDatasetCaseSource\<TCase>

Implements NexusLabs.Foundry.Evaluation.Experiments.IExperimentCaseSource<TCase>

Remarks

The mapper controls the case value, trial count, and tags. It must preserve each hosted dataset item id as the corresponding NexusLabs.Foundry.Evaluation.Experiments.ExperimentCase<>.Id so later Langfuse trial scopes can link the trace to the correct hosted item.

Constructors

LangfuseDatasetCaseSource(ILangfuseDatasetClient, LangfuseDatasetSelection, LangfuseDatasetItemMapper<TCase>) Constructor

Initializes a hosted Langfuse dataset case source.

public LangfuseDatasetCaseSource(NexusLabs.Foundry.Langfuse.ILangfuseDatasetClient datasetClient, NexusLabs.Foundry.Langfuse.LangfuseDatasetSelection selection, NexusLabs.Foundry.Langfuse.LangfuseDatasetItemMapper<TCase> mapper);

Parameters

datasetClient ILangfuseDatasetClient

The existing Langfuse dataset client.

selection LangfuseDatasetSelection

The hosted dataset name and optional version timestamp.

mapper NexusLabs.Foundry.Langfuse.LangfuseDatasetItemMapper<TCase>

Maps each hosted item to one experiment case.

Exceptions

System.ArgumentNullException
An argument is null.

System.ArgumentException
The dataset name is empty or whitespace.

Properties

LangfuseDatasetCaseSource<TCase>.Selection Property

Gets the hosted dataset selection used by this source.

public NexusLabs.Foundry.Langfuse.LangfuseDatasetSelection Selection { get; }

Property Value

LangfuseDatasetSelection

Methods

LangfuseDatasetCaseSource<TCase>.LoadAsync() Method

Loads the complete hosted dataset case collection without caller cancellation.

public System.Threading.Tasks.ValueTask<NexusLabs.Foundry.Evaluation.Experiments.ExperimentCaseSourceResult<TCase>> LoadAsync();

Implements LoadAsync()

Returns

System.Threading.Tasks.ValueTask<NexusLabs.Foundry.Evaluation.Experiments.ExperimentCaseSourceResult<TCase>>
The hosted source identity and ordered cases.

Exceptions

System.InvalidOperationException
Langfuse is disabled or the hosted dataset contains no active items.

System.ArgumentException
The mapper returns an invalid, duplicate, or provider-identity-breaking case id.

LangfuseException
The provider request or response is invalid or inconsistent.

LangfuseDatasetCaseSource<TCase>.LoadAsync(CancellationToken) Method

Loads the complete hosted dataset case collection with caller cancellation.

public System.Threading.Tasks.ValueTask<NexusLabs.Foundry.Evaluation.Experiments.ExperimentCaseSourceResult<TCase>> LoadAsync(System.Threading.CancellationToken cancellationToken);

Parameters

cancellationToken System.Threading.CancellationToken

A cancellation token.

Implements LoadAsync(CancellationToken)

Returns

System.Threading.Tasks.ValueTask<NexusLabs.Foundry.Evaluation.Experiments.ExperimentCaseSourceResult<TCase>>
The hosted source identity and ordered cases.

Exceptions

System.InvalidOperationException
Langfuse is disabled or the hosted dataset contains no active items.

System.ArgumentException
The mapper returns an invalid, duplicate, or provider-identity-breaking case id.

LangfuseException
The provider request or response is invalid or inconsistent.

System.OperationCanceledException
cancellationToken was canceled.