Example: Create a Report
php
/**
* Create a report with specified parameters.
*
* Write detailed instructions for the AI to learn
* how to create a report with the specified parameters.
*
* @param string $person Name of the person to create the report for.
* @param string $topic Topic of the report (ie: "sales").
* @param string $timeframe Timeframe for the report to include.
* @return SkillResponse
*/
public static function createReport(string $person, string $topic, string $timeframe): SkillResponse
{
/**
* Write your custom implementation for creating a report.
*
* For example, determine which user is being referenced
* and generate a relevant report spanning the given timeframe.
*/
// If validation fails
if (!$valid) {
// Return error message
return new SkillResponse([
'success' => false,
'message' => "Unable to generate a {$topic} report about {$person} spanning {$timeframe}."
]);
}
// Return success message
return new SkillResponse([
'success' => true,
'message' => "Successfully generated a {$topic} report about {$person} spanning {$timeframe}.",
// 'response' => '(any data you want to send back to the API for further processing)'
]);
}
How to Add Skills
The snippet above is just an example (obviously). See the AddSkillsEvent
for more detailed instructions.