Langfuse JS/TS SDKs
    Preparing search index...

    Type Alias ExperimentResult<Input, ExpectedOutput, Metadata>

    Complete result of an experiment execution.

    Contains all results from processing the experiment data, including individual item results, run-level evaluations, and utilities for result visualization.

    const result = await langfuse.experiment.run(config);

    // Access individual results
    console.log(`Processed ${result.itemResults.length} items`);

    // Check run-level evaluations
    const avgScore = result.runEvaluations.find(e => e.name === 'average_score');
    console.log(`Average score: ${avgScore?.value}`);

    // Print formatted results
    console.log(await result.format());

    // Print summary with individual item results
    console.log(await result.format({ includeItemResults: true }));

    // Link to dataset run (if available)
    if (result.datasetRunUrl) {
    console.log(`View in Langfuse: dataset run ${result.datasetRunUrl}`);
    }
    type ExperimentResult<
        Input = any,
        ExpectedOutput = any,
        Metadata extends Record<string, any> = Record<string, any>,
    > = {
        datasetRunId?: string;
        datasetRunUrl?: string;
        format: (options?: { includeItemResults?: boolean }) => Promise<string>;
        itemResults: ExperimentItemResult<Input, ExpectedOutput, Metadata>[];
        runEvaluations: Evaluation[];
        runName: string;
    }

    Type Parameters

    • Input = any
    • ExpectedOutput = any
    • Metadata extends Record<string, any> = Record<string, any>
    Index

    Properties

    datasetRunId?: string

    ID of the dataset run in Langfuse (only for experiments on Langfuse datasets).

    Present only when running experiments on Langfuse datasets. Use this ID to access the dataset run via the Langfuse API or UI for detailed analysis and comparison with other runs.

    datasetRunUrl?: string

    URL to the dataset run in the Langfuse UI (only for experiments on Langfuse datasets).

    Direct link to view the complete dataset run in the Langfuse web interface, including all experiment results, traces, and analytics. Provides easy access to detailed analysis and visualization of the experiment.

    format: (options?: { includeItemResults?: boolean }) => Promise<string>

    Function to format experiment results in a human-readable format.

    Generates a comprehensive, nicely formatted summary including individual results, aggregate statistics, evaluation scores, and links to traces and dataset runs.

    Type declaration

      • (options?: { includeItemResults?: boolean }): Promise<string>
      • Parameters

        • Optionaloptions: { includeItemResults?: boolean }

          Formatting options

          • OptionalincludeItemResults?: boolean

            Whether to include individual item details (default: false)

        Returns Promise<string>

        Promise resolving to formatted string representation

    Results from processing each individual data item.

    Contains the complete results for every item in your experiment data, including inputs, outputs, evaluations, and trace information. Use this for detailed analysis of individual item performance.

    runEvaluations: Evaluation[]

    Results from run-level evaluators that assessed the entire experiment.

    Contains aggregate evaluations that analyze the complete experiment, such as average scores, statistical measures, or overall quality assessments.

    runName: string

    The experiment run name.

    This is equal to the dataset run name if experiment was on Langfuse dataset. Either the provided runName parameter or generated name (experiment name + timestamp).