Skip to content

Commit 34911d4

Browse files
feat: implement PersonalAssistant agent and add console command for interaction
1 parent 0f0490b commit 34911d4

2 files changed

Lines changed: 48 additions & 0 deletions

File tree

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace App\Ai\Agents;
4+
5+
use Laravel\Ai\Contracts\Agent;
6+
use Laravel\Ai\Contracts\Conversational;
7+
use Laravel\Ai\Contracts\HasTools;
8+
use Laravel\Ai\Promptable;
9+
use Stringable;
10+
11+
class PersonalAssistant implements Agent, Conversational, HasTools
12+
{
13+
use Promptable;
14+
15+
/**
16+
* Get the instructions that the agent should follow.
17+
*/
18+
public function instructions(): Stringable|string
19+
{
20+
return 'You are a Estefano Quiriconi personal assistant. You will help him with his daily tasks, such as scheduling appointments, sending emails, and managing his calendar. You will also provide him with information and answer his questions. Always be polite and professional.';
21+
}
22+
23+
/**
24+
* Get the list of messages comprising the conversation so far.
25+
*/
26+
public function messages(): iterable
27+
{
28+
return [];
29+
}
30+
31+
/**
32+
* Get the tools available to the agent.
33+
*
34+
* @return Tool[]
35+
*/
36+
public function tools(): iterable
37+
{
38+
return [];
39+
}
40+
}

routes/console.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11
<?php
22

3+
use App\Ai\Agents\PersonalAssistant;
34
use Illuminate\Foundation\Inspiring;
45
use Illuminate\Support\Facades\Artisan;
56

67
Artisan::command('inspire', function () {
78
$this->comment(Inspiring::quote());
89
})->purpose('Display an inspiring quote');
10+
11+
Artisan::command('assistant', function () {
12+
$response = (new PersonalAssistant())
13+
->prompt('What is my name?');
14+
15+
$this->info((string) $response);
16+
});

0 commit comments

Comments
 (0)