Package-level declarations

Types

Link copied to clipboard
abstract class SimpleTool<TArgs>(argsType: TypeToken, name: String, description: String) : Tool<TArgs, String>

Represents a simplified tool base class that processes specific arguments and produces a textual result.

Link copied to clipboard
abstract class Tool<TArgs, TResult>(val argsType: TypeToken, val resultType: TypeToken, val descriptor: ToolDescriptor, val metadata: Map<String, String> = emptyMap())

Base class representing a tool that can be invoked by the LLM. Tools are usually used to return results, make changes to the environment, or perform other actions.

Link copied to clipboard
interface ToolArgs

Represents the arguments for a tool operation. Args should be serializable, serializer should be presented in the Tool the arguments belong to.

Link copied to clipboard
open class ToolDescriptor(val name: String, val description: String, val requiredParameters: List<ToolParameterDescriptor> = emptyList(), val optionalParameters: List<ToolParameterDescriptor> = emptyList())

Represents a descriptor for a tool that contains information about the tool's name, description, required parameters, and optional parameters.

Link copied to clipboard

A base sealed class representing exceptions specific to tools. This class provides a structure for exceptions with a custom message.

Link copied to clipboard
data class ToolParameterDescriptor(val name: String, val description: String, val type: ToolParameterType)

Represents a descriptor for a tool parameter. A tool parameter descriptor contains information about a specific tool parameter, such as its name, description, data type, and default value.

Link copied to clipboard
sealed class ToolParameterType

Sealed class representing different types of tool parameters.

Link copied to clipboard

A registry that manages a collection of tools for use by agents.

Link copied to clipboard
expect class ToolRegistryBuilder

A builder class for creating a ToolRegistry instance. This class provides methods to configure and register tools, either individually or as a list, and then constructs a registry containing the defined tools.

actual class ToolRegistryBuilder
actual class ToolRegistryBuilder
Link copied to clipboard
interface ToolResult

Represents a result produced by a tool operation. This is a marker interface implemented by various result types.

Functions

Link copied to clipboard
fun fail(message: String): Nothing

Throws a ToolException.ValidationFailure exception with the specified error message.

Link copied to clipboard
fun validate(expectation: Boolean, message: () -> String)

Validates a given condition and throws a ToolException.ValidationFailure exception if the condition is not met.

Link copied to clipboard
fun <T : Any> validateNotNull(value: T?, message: () -> String): T

Validates that the provided value is not null. If the value is null, a ToolException.ValidationFailure exception is thrown with the provided error message.