Class MathEvalDsl

Assembly: redb.Route.Llm.Tools.dll

DSL extension that wires an expression evaluator into a route step. Reads
{"expression":"2 * (3 + 4)"} from exchange.In.Body, evaluates
it via (same
compiled-lambda cache the rest of redb.Route uses for value expressions)
and writes the result re-serialised as JSON to exchange.Out.Body.

Grammar (whatever ExpressionResolver accepts): arithmetic
(+ - * / %), comparisons, ternary (?:), null-coalescing
(??), boolean operators (AND/OR/NOT), property / header /
body references and JsonPath via jpath(...). Expression compilation
is cached, so repeated calls with the same text are effectively free.


From("direct:llm.math_eval")
.AsLlmTool("math_eval").Description("Evaluate an arithmetic expression.").Then()
.MathEval(new MathEvalOptions());

public static class MathEvalDsl

Inheritance

Object→MathEvalDsl

Methods

MathEval(IRouteDefinition, MathEvalOptions?)

Adds an expression evaluator step. Uses default options when options is null.

public static IRouteDefinition MathEval(this IRouteDefinition self, MathEvalOptions? options = null)