Skip to content

Commit 29cdda7

Browse files
authored
Merge pull request #12 from llm-agents-php/feature/code-refactoring
Code refactoring
2 parents fc3a18f + 9b2e4cd commit 29cdda7

29 files changed

+5735
-1188
lines changed

app/src/Agents/AgentsCaller/AskAgentTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace App\Agents\AgentsCaller;
66

7-
use App\Domain\Tool\PhpTool;
87
use LLM\Agents\AgentExecutor\ExecutorInterface;
98
use LLM\Agents\LLM\Prompt\Chat\ToolCallResultMessage;
109
use LLM\Agents\LLM\Response\ToolCalledResponse;
1110
use LLM\Agents\PromptGenerator\Context;
11+
use LLM\Agents\Tool\PhpTool;
1212
use LLM\Agents\Tool\ToolExecutor;
1313

1414
/**

app/src/Agents/CodeReviewer/CodeReviewAgent.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use LLM\Agents\Agent\AgentAggregate;
99
use LLM\Agents\OpenAI\Client\OpenAIModel;
1010
use LLM\Agents\OpenAI\Client\Option;
11+
use LLM\Agents\Solution\ContextSourceLink;
1112
use LLM\Agents\Solution\MetadataType;
1213
use LLM\Agents\Solution\Model;
1314
use LLM\Agents\Solution\SolutionMetadata;
@@ -21,7 +22,11 @@ public static function create(): self
2122
key: 'code_review',
2223
name: 'Code Reviewer',
2324
description: 'Agent can list files in project with given id and then open each file and review the code',
24-
instruction: 'You are a code review assistant. Use the provided tools to list project files, read their contents, and submit a code review for each file.',
25+
instruction: <<<'INSTRUCTION'
26+
You are a code review assistant in Spiral Framework.
27+
Use the provided tools to list project files, read their contents, and submit a code review for each file.
28+
INSTRUCTION
29+
,
2530
);
2631

2732
$aggregate = new self($agent);
@@ -56,6 +61,8 @@ public static function create(): self
5661
$aggregate->addAssociation(new ToolLink(name: ReadFileTool::NAME));
5762
$aggregate->addAssociation(new ToolLink(name: ReviewTool::NAME));
5863

64+
$aggregate->addAssociation(new ContextSourceLink(name: 'spiral-docs'));
65+
5966
return $aggregate;
6067
}
6168
}

app/src/Agents/CodeReviewer/ListProjectTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace App\Agents\CodeReviewer;
66

7-
use App\Domain\Tool\PhpTool;
7+
use LLM\Agents\Tool\PhpTool;
88

99
/**
1010
* @extends PhpTool<ListProjectInput>

app/src/Agents/CodeReviewer/ReadFileTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace App\Agents\CodeReviewer;
66

7-
use App\Domain\Tool\PhpTool;
7+
use LLM\Agents\Tool\PhpTool;
88

99
/**
1010
* @extends PhpTool<ReadFileInput>

app/src/Agents/CodeReviewer/ReviewTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
namespace App\Agents\CodeReviewer;
66

7-
use App\Domain\Tool\PhpTool;
7+
use LLM\Agents\Tool\PhpTool;
88

99
/**
1010
* @extends PhpTool<ReviewInput>

app/src/Agents/Delivery/DeliveryAgent.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ public static function create(): self
2525
key: self::NAME,
2626
name: 'Order Assistant',
2727
description: 'Helps customers with order-related questions.',
28-
instruction: 'You are a helpful customer support assistant. Use the supplied tools to assist the user.',
28+
instruction: <<<'INSTRUCTION'
29+
You are a helpful customer support assistant.
30+
Use the supplied tools to assist the user.
31+
INSTRUCTION
32+
,
2933
);
3034

3135
$aggregate = new self($agent);

app/src/Agents/Delivery/GetDeliveryDateTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44

55
namespace App\Agents\Delivery;
66

7-
use App\Domain\Tool\PhpTool;
87
use Carbon\Carbon;
8+
use LLM\Agents\Tool\PhpTool;
99

1010
/**
11-
* @extends PhpTool<DeliveryDateInput>
11+
* @extends PhpTool<DeliveryDateInput>
1212
*/
1313
final class GetDeliveryDateTool extends PhpTool
1414
{

app/src/Agents/Delivery/GetOrderNumberTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace App\Agents\Delivery;
66

7-
use App\Domain\Tool\PhpTool;
7+
use LLM\Agents\Tool\PhpTool;
88

99
/**
10-
* @extends PhpTool<OrderNumberInput>
10+
* @extends PhpTool<OrderNumberInput>
1111
*/
1212
final class GetOrderNumberTool extends PhpTool
1313
{

app/src/Agents/Delivery/GetProfileTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
namespace App\Agents\Delivery;
66

7-
use App\Domain\Tool\PhpTool;
7+
use LLM\Agents\Tool\PhpTool;
88

99
/**
10-
* @extends PhpTool<ProfileInput>
10+
* @extends PhpTool<ProfileInput>
1111
*/
1212
final class GetProfileTool extends PhpTool
1313
{

app/src/Agents/DynamicMemoryTool/DynamicMemoryTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
namespace App\Agents\DynamicMemoryTool;
66

77
use App\Application\Entity\Uuid;
8-
use App\Domain\Tool\PhpTool;
98
use LLM\Agents\Solution\MetadataType;
109
use LLM\Agents\Solution\SolutionMetadata;
10+
use LLM\Agents\Tool\PhpTool;
1111

1212
final class DynamicMemoryTool extends PhpTool
1313
{

0 commit comments

Comments
 (0)