Langfuse JS/TS SDKs
    Preparing search index...

    Interface PromptVariableMappingInput

    Connects one prompt variable to data from an observation or experiment.

    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 the source field that should populate the variable.

    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.

    Invalid, missing, or duplicate mappings return a validation error. Malformed JSONPath expressions are also rejected.

    {
    * variable: "input",
    * source: LangfuseAPI.PromptVariableMappingSource.Input
    * }
    {
    * variable: "customer_tier",
    * source: LangfuseAPI.PromptVariableMappingSource.Metadata,
    * jsonPath: "$.customer.tier"
    * }
    {
    * variable: "expected_output",
    * source: LangfuseAPI.PromptVariableMappingSource.ExpectedOutput
    * }
    interface PromptVariableMappingInput {
        jsonPath?: string;
        source: PromptVariableMappingSource;
        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.

    Available sources are input, output, metadata, tool_calls, expected_output, and experiment_item_metadata.

    variable: string

    Prompt variable name without braces.

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