ToolResponse class

Represents the response from a tool executed by the agent.

Constructors

ToolResponse({required String toolName, required bool isRequestSuccessful, required String message, Map<String, dynamic>? data, bool needsFurtherReasoning = false})
Constructs a ToolResponse with the tool name, success status, message, and optional data.
ToolResponse.fromJson(String source)
Constructs a ToolResponse object from a JSON string.
factory
ToolResponse.fromMap(Map<String, dynamic> map)
Constructs a ToolResponse object from a map (usually from Firestore or other storage).
factory

Properties

data Map<String, dynamic>?
Optional data returned by the tool. This will be used for chaining responses in later versios.
final
hashCode int
The hash code for this object.
no setteroverride
isRequestSuccessful bool
Indicates whether the request to the tool was successful. This is useful for error handling and debugging, is request fails add a personalized message to the user.
final
message String
This is the message the end user will see, if the tools fetches some data, add the info here or success or failure messages based on the request.
final
needsFurtherReasoning bool
If a tool has fetched data and the data requires further reasoning or processing, this flag can be set to true. This is useful for tools that need to perform additional reasoning or processing before returning a final result to the user.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
toolName String
The name of the tool that generated this response.
final

Methods

copyWith({String? toolName, bool? isRequestSuccessful, String? message, Map<String, dynamic>? data, bool? needsFurtherReasoning}) ToolResponse
Creates a copy of the current ToolResponse with optional new values for each field.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() String
Converts the ToolResponse object to a JSON string.
toMap() Map<String, dynamic>
Converts the ToolResponse object to a map for serialization or database storage.
toString() String
A string representation of this object.
override

Operators

operator ==(covariant ToolResponse other) bool
The equality operator.
override