Skip to content

bmel:avg-inline-of

Category: Math · Returns: bmel:number

Signature
bmel:avg-inline-of(values...: bmel:number)

Description

Returns the arithmetic mean of two or more inline numeric arguments. Unlike bmel:avg which operates on an array source, this function accepts individual scalar values directly — useful for averaging a fixed set of fields (e.g. averaging three separate score fields from different parts of a payload).

Variadic function

Accepts a variable number of arguments of the same type.

Arguments

Parameter Type Required Description
values ... bmel:number Two or more numeric values to average.

Examples

Average of three scores in the same response
bmel:avg-inline-of({invokeAgent:Response Payload}.$.scores.relevance, {invokeAgent:Response Payload}.$.scores.accuracy, {invokeAgent:Response Payload}.$.scores.tone)
Average of input and output tokens
bmel:avg-inline-of({invokeAgent:Response Payload}.$.usage.prompt_tokens, {invokeAgent:Response Payload}.$.usage.completion_tokens)

← Back to BMEL Reference