Skip to content

ILangfusePromptClient

NexusLabs.Needlr.AgentFramework.Langfuse

ILangfusePromptClient Interface

Fetches and creates prompts in Langfuse prompt management, so the prompt an eval runs against lives in Langfuse and the generations link to the exact version that was used.

public interface ILangfusePromptClient

Properties

ILangfusePromptClient.IsEnabled Property

Gets a value indicating whether prompt operations are performed. false when Langfuse is not configured, in which case GetPromptAsync(string, string, Nullable<int>, CancellationToken) returns null.

bool IsEnabled { get; }

Property Value

System.Boolean

Methods

ILangfusePromptClient.CreateTextPromptAsync(string, string, IEnumerable<string>, CancellationToken) Method

Creates a new version of a text prompt (creating the prompt if the name is new).

System.Threading.Tasks.Task<NexusLabs.Needlr.AgentFramework.Langfuse.LangfusePrompt> CreateTextPromptAsync(string name, string prompt, System.Collections.Generic.IEnumerable<string>? labels=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

name System.String

The prompt name.

prompt System.String

The prompt text.

labels System.Collections.Generic.IEnumerable<System.String>

Optional labels to apply (for example production).

cancellationToken System.Threading.CancellationToken

A cancellation token.

Returns

System.Threading.Tasks.Task<LangfusePrompt>
The created prompt version.

ILangfusePromptClient.GetPromptAsync(string, string, Nullable<int>, CancellationToken) Method

Fetches a managed prompt by name, optionally pinned to a label or version. With neither, the production label is used. Returns null when the prompt does not exist (or Langfuse is not configured).

System.Threading.Tasks.Task<NexusLabs.Needlr.AgentFramework.Langfuse.LangfusePrompt?> GetPromptAsync(string name, string? label=null, System.Nullable<int> version=null, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));

Parameters

name System.String

The prompt name. URL-encode folder paths.

label System.String

An optional label to resolve (for example production).

version System.Nullable<System.Int32>

An optional specific version. Takes precedence over label.

cancellationToken System.Threading.CancellationToken

A cancellation token.

Returns

System.Threading.Tasks.Task<LangfusePrompt>
The prompt, or null.