pub struct PromptVariableMappingInput {
pub variable: String,
pub source: PromptVariableMappingSource,
pub json_path: Option<Option<String>>,
}Expand description
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.
Fields§
§variable: StringPrompt variable name without braces. Example: for the prompt Judge {{input}} against {{output}}, use input and output.
source: PromptVariableMappingSource§json_path: Option<Option<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
Implementations§
Source§impl PromptVariableMappingInput
impl PromptVariableMappingInput
Sourcepub fn builder() -> PromptVariableMappingInputBuilder
pub fn builder() -> PromptVariableMappingInputBuilder
Create an instance of PromptVariableMappingInput using the builder syntax
Source§impl PromptVariableMappingInput
impl PromptVariableMappingInput
Sourcepub fn new(
variable: String,
source: PromptVariableMappingSource,
) -> PromptVariableMappingInput
pub fn new( variable: String, source: PromptVariableMappingSource, ) -> 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.
Trait Implementations§
Source§impl Clone for PromptVariableMappingInput
impl Clone for PromptVariableMappingInput
Source§impl Debug for PromptVariableMappingInput
impl Debug for PromptVariableMappingInput
Source§impl<'de> Deserialize<'de> for PromptVariableMappingInput
impl<'de> Deserialize<'de> for PromptVariableMappingInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for PromptVariableMappingInput
Source§impl Validate for PromptVariableMappingInput
impl Validate for PromptVariableMappingInput
Source§fn validate_into(&self, _path: &Path<'_>, _errors: &mut Vec<ValidationError>)
fn validate_into(&self, _path: &Path<'_>, _errors: &mut Vec<ValidationError>)
errors, with its path below path, and nothing when the value
is valid. validate() calls it with Path::root; a model calls it on the models it holds with their path.