ILangfuseClient
NexusLabs.Foundry.Langfuse¶
ILangfuseClient Interface¶
Provides the complete non-owning Langfuse client surface for scenarios, experiments, datasets, score configuration, metrics, model pricing, prompts, comments, and known-trace scoring.
Derived
↳ ILangfuseSession
Remarks¶
Resolve this interface from dependency injection after calling AddFoundryLangfuse(this IServiceCollection, Action<LangfuseOptions>). The facade does not own the host's OpenTelemetry providers or HTTP transport and does not implement System.IDisposable.
For standalone applications that must own and explicitly shut down their OpenTelemetry providers, use Start(LangfuseOptions) and retain the returned ILangfuseSession.
Properties¶
ILangfuseClient.Datasets Property¶
Gets the client for reading, creating, and populating Langfuse datasets.
Property Value¶
ILangfuseClient.IsEnabled Property¶
Gets a value indicating whether Langfuse export and API operations are enabled. false indicates a coherent no-op client.
Property Value¶
ILangfuseClient.Metrics Property¶
Gets the client for reading aggregates from the Langfuse Metrics API.
Property Value¶
ILangfuseClient.Models Property¶
Gets the client for registering Langfuse model price definitions.
Property Value¶
ILangfuseClient.Prompts Property¶
Gets the client for fetching and creating prompts in Langfuse prompt management.
Property Value¶
ILangfuseClient.PublicationHealth Property¶
Gets structured trace, REST publication, retry, and local-drain health.
Property Value¶
ILangfuseClient.ScoreConfigs Property¶
Gets the client for idempotently registering Langfuse score configurations.
Property Value¶
ILangfuseClient.Scores Property¶
Gets the client for recording scores against known trace, observation, and session ids.
Property Value¶
Methods¶
ILangfuseClient.AddTraceCommentAsync(string, string, CancellationToken) Method¶
Attaches a comment to an existing Langfuse trace.
System.Threading.Tasks.Task AddTraceCommentAsync(string traceId, string content, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
Parameters¶
traceId System.String
The id of an existing Langfuse trace.
content System.String
The comment content.
cancellationToken System.Threading.CancellationToken
A cancellation token.
Returns¶
System.Threading.Tasks.Task
A task that completes when Langfuse accepts the comment or a non-fatal failure is reported.
ILangfuseClient.BeginExperimentRun(string, string) Method¶
Begins a Langfuse experiment run whose item traces are linked to an existing dataset.
NexusLabs.Foundry.Langfuse.ILangfuseExperimentRun BeginExperimentRun(string datasetName, string runName);
Parameters¶
datasetName System.String
The existing dataset to score against.
runName System.String
A caller-supplied run name used for experiment comparison.
Returns¶
ILangfuseExperimentRun
An ILangfuseExperimentRun. A disabled client returns an inert no-op run.
Exceptions¶
System.ArgumentException
datasetName or runName is null or whitespace.
ILangfuseClient.BeginExperimentRun(string, string, LangfuseExperimentRunOptions) Method¶
Begins a Langfuse experiment run whose item traces are linked to an existing dataset.
NexusLabs.Foundry.Langfuse.ILangfuseExperimentRun BeginExperimentRun(string datasetName, string runName, NexusLabs.Foundry.Langfuse.LangfuseExperimentRunOptions? options);
Parameters¶
datasetName System.String
The existing dataset to score against.
runName System.String
A caller-supplied run name used for experiment comparison.
options LangfuseExperimentRunOptions
Optional description and structured metadata for the run.
Returns¶
ILangfuseExperimentRun
An ILangfuseExperimentRun. A disabled client returns an inert no-op run.
Exceptions¶
System.ArgumentException
datasetName or runName is null or whitespace.
ILangfuseClient.BeginScenario(string, string, string, IEnumerable<string>, IReadOnlyDictionary<string,string>) Method¶
Begins a Langfuse trace scoped to a single evaluation scenario or agent run.
NexusLabs.Foundry.Langfuse.ILangfuseScenario BeginScenario(string name, string? sessionId=null, string? userId=null, System.Collections.Generic.IEnumerable<string>? tags=null, System.Collections.Generic.IReadOnlyDictionary<string,string>? metadata=null);
Parameters¶
name System.String
The trace name shown in Langfuse.
sessionId System.String
An optional Langfuse session id used to group related traces.
userId System.String
An optional end-user identifier associated with the trace.
tags System.Collections.Generic.IEnumerable<System.String>
Optional tags used to categorize the trace.
metadata System.Collections.Generic.IReadOnlyDictionary<System.String,System.String>
Optional filterable key/value metadata attached to the trace.
Returns¶
ILangfuseScenario
An ILangfuseScenario to dispose when the scenario completes. A disabled client
returns an inert no-op scenario.
Exceptions¶
System.ArgumentException
name is null or whitespace.