Skip to main content

Interface: LocalMetricConfig

Defined in: src/types/metrics.types.ts Configuration for a local metric that is computed client-side. This interface defines metrics that are evaluated on the client rather than server-side. Local metrics are useful for custom scoring logic that needs to run in the client environment.

Properties

aggregatableTypes?

optional aggregatableTypes: string[];
Defined in: src/types/metrics.types.ts The step types that can have aggregated scores. Must not contain any types in scorableTypes. Can only contain ‘trace’ or ‘workflow’ step types.

Default

["trace"];

aggregatorFn()?

optional aggregatorFn: (scores: MetricValueType[]) => MetricValueType;
Defined in: src/types/metrics.types.ts Optional aggregator function to combine scores from child spans. Takes an array of metric values and returns an aggregated value.

Parameters

scores
MetricValueType[]

Returns

MetricValueType

name

name: string;
Defined in: src/types/metrics.types.ts The name of the metric

scorableTypes?

optional scorableTypes: string[];
Defined in: src/types/metrics.types.ts The step types that can be scored by this metric.

Default

["llm"];

scorerFn()

scorerFn: (traceOrSpan: Span | Trace) => MetricValueType;
Defined in: src/types/metrics.types.ts The scoring function that computes the metric value. Takes a trace or span and returns a metric value.

Parameters

traceOrSpan
Span | Trace

Returns

MetricValueType