ToolFromCallable
A tool implementation that wraps a Kotlin callable (function, method, etc.).
See also
Constructors
Types
Represents a data structure to hold arguments conforming to the Args interface.
A serializer for the VarArgs class, enabling Kotlin serialization for arguments provided dynamically to a callable function (KCallable). This serializer facilitates encoding and decoding of arguments via their corresponding KParameter mappings.
Properties
A KSerializer responsible for encoding and decoding the arguments required for the tool execution.
A ToolDescriptor representing the tool's schema, including its name, description, and parameters.
The name of the tool from the descriptor
A KSerializer responsible for encoding and decoding the result returned by the tool execution.
Functions
Decodes the provided raw JSON arguments into an instance of the specified arguments type.
Decodes the provided raw JSON element into an instance of the specified result type.
Encodes the given arguments into a JSON representation.
Encodes the provided arguments into a JSON string representation using the configured serializer.
Encodes the provided arguments into a JSON string representation without type safety checks.
Encodes the given arguments into a JSON representation without type safety checks.
Encodes the given result into a JSON representation using the configured result serializer.
Encodes the given result of type TResult to its string representation for the LLM.s
Encodes the provided result object into a JSON string representation without type safety checks.
Encodes the given result object into a JSON representation without type safety checks. This method casts the provided result to the expected TResult type and leverages the encodeResult method to produce the JSON output.
Executes the tool's logic with the provided arguments.