File tree Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Expand file tree Collapse file tree 3 files changed +11
-7
lines changed Original file line number Diff line number Diff line change 44 "license" : " MIT" ,
55 "require" : {
66 "php" : " ^8.3" ,
7- "llm-agents/agents" : " ^1.2 " ,
7+ "llm-agents/agents" : " ^1.5 " ,
88 "llm-agents/json-schema-mapper" : " ^1.0"
99 },
1010 "require-dev" : {
Original file line number Diff line number Diff line change 55namespace LLM \Agents \PromptGenerator \Interceptors ;
66
77use LLM \Agents \Agent \AgentRepositoryInterface ;
8+ use LLM \Agents \Agent \HasLinkedAgentsInterface ;
89use LLM \Agents \LLM \Prompt \Chat \MessagePrompt ;
910use LLM \Agents \LLM \Prompt \Chat \Prompt ;
1011use 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 }
Original file line number Diff line number Diff line change 44
55namespace LLM \Agents \PromptGenerator \Interceptors ;
66
7- use LLM \Agents \LLM \Prompt \Chat \ChatMessage ;
7+ use LLM \Agents \LLM \Prompt \Chat \MessagePrompt ;
88use LLM \Agents \LLM \Prompt \Chat \Prompt ;
99use LLM \Agents \LLM \Prompt \Chat \PromptInterface ;
10- use LLM \Agents \LLM \Prompt \Chat \Role ;
1110use LLM \Agents \PromptGenerator \InterceptorHandler ;
1211use LLM \Agents \PromptGenerator \PromptGeneratorInput ;
1312use LLM \Agents \PromptGenerator \PromptInterceptorInterface ;
@@ -23,10 +22,10 @@ public function generate(
2322 return $ next (
2423 input: $ input ->withPrompt (
2524 $ 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+ ] ),
3029 ),
3130 ),
3231 );
You can’t perform that action at this time.
0 commit comments