LlmTool class

Marks a top-level function, or a method of an LlmToolset class, as a tool an LLM can call.

Run dart run build_runner build and the generator creates a <functionName>Tool ToolDefinition in the file's .g.dart part.

/// Gets the current weather for a city.
@LlmTool()
String getWeather(@Param('City name, e.g. Kanpur') String city) => '...';

Constructors

LlmTool({String? name, String? description, bool requiresConfirmation = false})
Marks a function as a tool. See the class docs for an example.
const

Properties

description → String?
What the tool does, written for the LLM.
final
hashCode → int
The hash code for this object.
no setterinherited
name → String?
The name sent to the LLM. Defaults to the function name.
final
requiresConfirmation → bool
Whether a human should approve each call before it runs.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited