File tree 3 files changed +11
-7
lines changed
3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 4
4
"license" : " MIT" ,
5
5
"require" : {
6
6
"php" : " ^8.3" ,
7
- "llm-agents/agents" : " ^1.2 " ,
7
+ "llm-agents/agents" : " ^1.5 " ,
8
8
"llm-agents/json-schema-mapper" : " ^1.0"
9
9
},
10
10
"require-dev" : {
Original file line number Diff line number Diff line change 5
5
namespace LLM \Agents \PromptGenerator \Interceptors ;
6
6
7
7
use LLM \Agents \Agent \AgentRepositoryInterface ;
8
+ use LLM \Agents \Agent \HasLinkedAgentsInterface ;
8
9
use LLM \Agents \LLM \Prompt \Chat \MessagePrompt ;
9
10
use LLM \Agents \LLM \Prompt \Chat \Prompt ;
10
11
use LLM \Agents \LLM \Prompt \Chat \PromptInterface ;
@@ -27,6 +28,10 @@ public function generate(
27
28
): PromptInterface {
28
29
\assert ($ input ->prompt instanceof Prompt);
29
30
31
+ if (!$ input ->agent instanceof HasLinkedAgentsInterface) {
32
+ return $ next ($ input );
33
+ }
34
+
30
35
if (\count ($ input ->agent ->getAgents ()) === 0 ) {
31
36
return $ next ($ input );
32
37
}
Original file line number Diff line number Diff line change 4
4
5
5
namespace LLM \Agents \PromptGenerator \Interceptors ;
6
6
7
- use LLM \Agents \LLM \Prompt \Chat \ChatMessage ;
7
+ use LLM \Agents \LLM \Prompt \Chat \MessagePrompt ;
8
8
use LLM \Agents \LLM \Prompt \Chat \Prompt ;
9
9
use LLM \Agents \LLM \Prompt \Chat \PromptInterface ;
10
- use LLM \Agents \LLM \Prompt \Chat \Role ;
11
10
use LLM \Agents \PromptGenerator \InterceptorHandler ;
12
11
use LLM \Agents \PromptGenerator \PromptGeneratorInput ;
13
12
use LLM \Agents \PromptGenerator \PromptInterceptorInterface ;
@@ -23,10 +22,10 @@ public function generate(
23
22
return $ next (
24
23
input: $ input ->withPrompt (
25
24
$ input ->prompt ->withAddedMessage (
26
- new ChatMessage (
27
- content: ( string ) $ input -> userPrompt ,
28
- role: Role::User ,
29
- ),
25
+ MessagePrompt:: user ( ' {user_prompt} ' )
26
+ -> withValues ([
27
+ ' user_prompt ' => ( string ) $ input -> userPrompt ,
28
+ ] ),
30
29
),
31
30
),
32
31
);
You can’t perform that action at this time.
0 commit comments