Skip to content

Commit 6fc61d8

Browse files
committed
Use HasLinkedAgentsInterface interface for linked agents handling
1 parent 371ba1c commit 6fc61d8

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"require": {
66
"php": "^8.3",
7-
"llm-agents/agents": "^1.2",
7+
"llm-agents/agents": "dev-feature/embeddings as 1.0",
88
"llm-agents/json-schema-mapper": "^1.0"
99
},
1010
"require-dev": {

src/Interceptors/LinkedAgentsInjector.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
namespace LLM\Agents\PromptGenerator\Interceptors;
66

77
use LLM\Agents\Agent\AgentRepositoryInterface;
8+
use LLM\Agents\Agent\HasLinkedAgentsInterface;
89
use LLM\Agents\LLM\Prompt\Chat\MessagePrompt;
910
use LLM\Agents\LLM\Prompt\Chat\Prompt;
1011
use LLM\Agents\LLM\Prompt\Chat\PromptInterface;
@@ -27,6 +28,10 @@ public function generate(
2728
): PromptInterface {
2829
\assert($input->prompt instanceof Prompt);
2930

31+
if (!$input->agent instanceof HasLinkedAgentsInterface) {
32+
return $next($input);
33+
}
34+
3035
if (\count($input->agent->getAgents()) === 0) {
3136
return $next($input);
3237
}

0 commit comments

Comments
 (0)