execute method

Future<Object?> execute({
  1. required String name,
  2. required Map<String, Object?> arguments,
})

Executes a tool function by its name with the given arguments.

Implementation

Future<Object?> execute({
  required String name,
  required Map<String, Object?> arguments,
}) async {
  final tool = _tools[name];
  if (tool == null) {
    throw LiteRtLmException('Tool "$name" was not found.');
  }
  final result = await tool.execute(arguments);
  return _normalizeJsonValue(result);
}