ToolFunction

org.llm4s.toolapi.ToolFunction
case class ToolFunction[T, R](name: String, description: String, schema: SchemaDefinition[T], handler: SafeParameterExtractor => Either[String, R])(implicit evidence$1: ReadWriter[R])

Core model for tool function definitions

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def execute(args: Value): Either[ToolCallError, Value]

Executes the tool with the given arguments

Executes the tool with the given arguments

Attributes

def executeEnhanced(args: Value, enhancedHandler: SafeParameterExtractor => Either[List[ToolParameterError], R]): Either[ToolCallError, Value]

Executes the tool with enhanced error reporting. Uses SafeParameterExtractor in enhanced mode for better error messages.

Executes the tool with enhanced error reporting. Uses SafeParameterExtractor in enhanced mode for better error messages.

Value parameters

args

The arguments to pass to the tool

enhancedHandler

Handler that uses enhanced extraction methods

Attributes

Returns

Either an error or the result as JSON

def toOpenAITool(strict: Boolean): Value

Converts the tool definition to the format expected by OpenAI's API

Converts the tool definition to the format expected by OpenAI's API

Attributes

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product