Arize Phoenix TS
    Preparing search index...

    Type Alias BindingContext<RecordType>

    Context for binding an evaluator with input mapping configuration.

    This type defines the structure for binding an evaluator to a specific data shape by mapping the evaluator's expected input fields to the actual data structure.

    // Map evaluator fields to your data structure
    const context: BindingContext<MyDataType> = {
    inputMapping: {
    input: "userQuery", // Maps "input" to "userQuery" field
    reference: "context", // Maps "reference" to "context" field
    output: "modelResponse", // Maps "output" to "modelResponse" field
    },
    };
    // Using nested property access
    const context: BindingContext<ApiResponse> = {
    inputMapping: {
    input: "request.body.query",
    reference: "request.body.context",
    output: "response.data.text",
    },
    };
    // Using function-based mapping for transformations
    const context: BindingContext<RawData> = {
    inputMapping: {
    input: "question",
    reference: (data) => data.context.join("\n"), // Transform array to string
    output: "answer",
    },
    };
    type BindingContext<RecordType extends Record<string, unknown>> = {
        inputMapping: ObjectMapping<RecordType>;
    }

    Type Parameters

    • RecordType extends Record<string, unknown>

      The type of the data record that will be evaluated

    Index

    Properties

    Properties

    inputMapping: ObjectMapping<RecordType>

    Mapping of evaluator input fields to data source fields.

    The keys represent the field names expected by the evaluator (e.g., "input", "output", "reference"), and the values specify how to extract those fields from your data structure.

    Supports:

    • Simple property names: "fieldName"
    • Dot notation: "user.profile.name"
    • Array access: "items[0].id"
    • JSONPath expressions: "$.items[*].id"
    • Function extractors: (data) => data.customField.toUpperCase()