fromInstance

fun fromInstance(instance: Any, objectMapper: <Error class: unknown class> = jacksonObjectMapper()): List<Tool>

Create Tools from all methods annotated with LlmTool on an instance.

If the instance's class is annotated with @MatryoshkaTools, returns a single MatryoshkaTool containing all the inner tools. Otherwise, returns individual tools for each annotated method.

Return

List of Tools, one for each annotated method (or single MatryoshkaTool if @MatryoshkaTools present)

Parameters

instance

The object instance to scan for annotated methods

objectMapper

ObjectMapper for JSON parsing (optional)

Throws

if no methods are annotated with @LlmTool