Langfuse JS/TS SDKs
    Preparing search index...

    Interface EvaluationRuleMapping

    Maps one evaluator variable to one source field from the target object.

    Manual mappings are used for llm_as_judge evaluators. code evaluators use a fixed runtime mapping managed by Langfuse.

    How to build a valid mapping list:

    1. Create the evaluator or fetch it with GET /evaluators/{id}.
    2. Read the evaluator variables array.
    3. Add exactly one mapping object for each variable in that array.
    4. Use the variable name exactly as returned, without braces such as {{ or }}.
    5. Choose a source that is valid for the selected target.

    jsonPath is optional. Use it only when the selected source is a JSON object and you want to extract one nested field before inserting it into the evaluator prompt.

    Recovery guidance:

    • invalid_variable_mapping: the variable name is unknown for this evaluator, or the selected source is not valid for the chosen target
    • missing_variable_mapping: one or more LLM-as-judge evaluator variables are not mapped yet
    • duplicate_variable_mapping: the same evaluator variable appears more than once
    • invalid_json_path: the JSONPath expression is malformed. Remove it or correct it.
    {
    * variable: "input",
    * source: LangfuseAPI.unstable.EvaluationRuleMappingSource.Input
    * }
    {
    * variable: "customer_tier",
    * source: LangfuseAPI.unstable.EvaluationRuleMappingSource.Metadata,
    * jsonPath: "$.customer.tier"
    * }
    {
    * variable: "expected_output",
    * source: LangfuseAPI.unstable.EvaluationRuleMappingSource.ExpectedOutput
    * }
    interface EvaluationRuleMapping {
        jsonPath?: string;
        source: unstable.EvaluationRuleMappingSource;
        variable: string;
    }
    Index

    Properties

    jsonPath?: string

    Optional JSONPath selector applied to the selected source before it is passed to the evaluator prompt.

    Requirements:

    • Must start with $
    • Must be a syntactically valid JSONPath expression
    • Most useful with source=metadata

    Source field that should populate the prompt variable.

    Quick reference:

    • target=observation: input, output, metadata
    • target=experiment: input, output, metadata, expected_output, experiment_item_metadata
    variable: string

    Prompt variable name without braces.

    Example: for the prompt Judge {{input}} against {{output}}, use input and output.