Holds the outcome of a ChatTool execution, with data on success or an error string on failure.
// ChatTool.Result is returned from ChatTool.execute(). const { Result } = await import('LensStudio:ChatTool'); // Success result: set data, leave error empty const success = new Result(); success.data = { items: ['Sunset Pack', 'Golden Hour'] }; success.error = ''; console.log('Success data:', JSON.stringify(success.data)); // Error result: set error string, leave data undefined const failure = new Result(); failure.error = 'Tool execution timed out'; console.log('Error:', failure.error); Copy
// ChatTool.Result is returned from ChatTool.execute(). const { Result } = await import('LensStudio:ChatTool'); // Success result: set data, leave error empty const success = new Result(); success.data = { items: ['Sunset Pack', 'Golden Hour'] }; success.error = ''; console.log('Success data:', JSON.stringify(success.data)); // Error result: set error string, leave data undefined const failure = new Result(); failure.error = 'Tool execution timed out'; console.log('Error:', failure.error);
Constructs a new Result object for returning operation outcomes from a ChatTool execute() method.
Holds the successful output payload returned by the tool operation.
Error message string set when the tool operation fails; empty on success.
Holds the outcome of a ChatTool execution, with data on success or an error string on failure.
Example