MathTools

Math-related tools exposed as an UnfoldingTool.

When used as a tool group, exposes a single "math" UnfoldingTool. When the LLM invokes this tool, it reveals the individual math operations (add, subtract, multiply, divide, mean, min, max, floor, ceiling, round).

Can be used in two ways:

  1. As a tool group - register with the platform for automatic resolution

  2. Directly - use unfoldingTool or innerTools with PromptRunner

Example usage:

// As a tool group (exposes single UnfoldingTool)
val toolGroup: ToolGroup = MathTools()

// Direct use of the UnfoldingTool
ai.withTool(MathTools().unfoldingTool)

// Direct use of inner tools (bypasses UnfoldingTool)
ai.withTools(MathTools().innerTools)

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

The inner tools - individual math operations. These are the tools that get revealed when the UnfoldingTool is invoked.

Link copied to clipboard
open override val metadata: ToolGroupMetadata
Link copied to clipboard
open val name: String
Link copied to clipboard
Link copied to clipboard
open val provider: String
Link copied to clipboard
open override val tools: List<Tool>

As a tool group, exposes only the UnfoldingTool. The LLM sees a single "math" tool; when invoked, the inner tools are revealed.

Link copied to clipboard

The UnfoldingTool facade that wraps all math operations.

Link copied to clipboard
open val version: <Error class: unknown class>

Functions

Link copied to clipboard
fun add(a: Double, b: Double): Double
Link copied to clipboard
fun ceiling(number: Double): Double
Link copied to clipboard

Create the UnfoldingTool for math operations. Convenience method for Java interop.

Link copied to clipboard
fun divide(a: Double, b: Double): String
Link copied to clipboard
fun floor(number: Double): Double
Link copied to clipboard
open fun infoString(verbose: Boolean?, indent: Int): String
Link copied to clipboard
fun max(numbers: List<Double>): Double
Link copied to clipboard
fun mean(numbers: List<Double>): Double
Link copied to clipboard
fun min(numbers: List<Double>): Double
Link copied to clipboard
Link copied to clipboard
fun round(number: Double): Double
Link copied to clipboard