fromMethod

open fun fromMethod(instance: Any, method: KFunction<*>, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): Tool

Create a Tool from a Kotlin method annotated with LlmTool.

Return

A Tool that invokes the method

Parameters

instance

The object instance containing the method

method

The Kotlin method to wrap as a tool

objectMapper

ObjectMapper for JSON parsing (optional)

Throws

if the method is not annotated with @LlmTool


open fun fromMethod(instance: Any, method: Method, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): Tool

Create a Tool from a Java method annotated with LlmTool.

Return

A Tool that invokes the method

Parameters

instance

The object instance containing the method

method

The Java method to wrap as a tool

objectMapper

ObjectMapper for JSON parsing (optional)

Throws

if the method is not annotated with @LlmTool