fromMethod

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

Create a Tool from a method annotated with com.embabel.agent.api.annotation.LlmTool.

Return

A Tool that invokes the method

Parameters

instance

The object instance containing the method

method

The method to wrap as a tool

objectMapper

ObjectMapper for JSON parsing (optional)

Throws

if the method is not annotated with @Tool.Method