EdgeGenAITool class
A tool (function) the on-device model may call while generating a
response to an EdgeGenAIPrompt.generateContent call.
The name, description, and parameters are shown to the model so it knows when and how to call the tool; onCall is the Dart implementation that runs when it does.
On iOS this uses Foundation Models' native Tool support. Android's
ML Kit GenAI Prompt API has no native tool calling, so the plugin
emulates it there by instructing the model to reply with a tool-call
JSON object — treat tool calling on Android as best-effort: the small
on-device model may answer directly instead of calling a tool.
Constructors
-
EdgeGenAITool({required String name, required String description, List<
EdgeGenAIToolParameter> parameters = const [], required Future<String> onCall(Map<String, Object?> arguments)})
Properties
- description → String
-
What the tool does, so the model knows when to call it.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- name → String
-
The tool's unique name (unique within one
EdgeGenAIPromptinstance).final -
onCall
→ Future<
String> Function(Map<String, Object?> arguments) -
Runs the tool with the
argumentsthe model provided (decoded from JSON) and returns the result text the model continues generating with.final -
parameters
→ List<
EdgeGenAIToolParameter> -
The parameters the model should pass when calling the tool.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
argumentsJsonSchema(
) → Map< String, Object?> -
This tool's arguments as one JSON Schema object: each parameter is a
property (its
descriptionmerged into its value schema), and every EdgeGenAIToolParameter.isRequired parameter is listed inrequired. -
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