This repository was archived by the owner on Jul 16, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +22
-6
lines changed
tests/Chain/InputProcessor Expand file tree Collapse file tree 1 file changed +22
-6
lines changed Original file line number Diff line number Diff line change @@ -69,15 +69,31 @@ public function processInputDoesNotAddSystemMessageWhenOneExists(): void
6969 }
7070
7171 #[Test]
72- public function needsToolboxToBeAbleToIncludeToolDefinitions (): void
72+ public function doesNotIncludeToolsIfToolboxIsEmpty (): void
7373 {
74- $ this ->expectException (\InvalidArgumentException::class);
75- $ this ->expectExceptionMessage ('Tool definitions cannot be included without a ToolBox. ' );
76-
77- new SystemPromptInputProcessor (
74+ $ processor = new SystemPromptInputProcessor (
7875 'This is a system prompt ' ,
79- toolBox: null ,
76+ new class implements ToolBoxInterface {
77+ public function getMap (): array
78+ {
79+ return [];
80+ }
81+
82+ public function execute (ToolCall $ toolCall ): mixed
83+ {
84+ return null ;
85+ }
86+ }
8087 );
88+
89+ $ input = new Input (new GPT (), new MessageBag (Message::ofUser ('This is a user message ' )), []);
90+ $ processor ->processInput ($ input );
91+
92+ $ messages = $ input ->messages ->getMessages ();
93+ self ::assertCount (2 , $ messages );
94+ self ::assertInstanceOf (SystemMessage::class, $ messages [0 ]);
95+ self ::assertInstanceOf (UserMessage::class, $ messages [1 ]);
96+ self ::assertSame ('This is a system prompt ' , $ messages [0 ]->content );
8197 }
8298
8399 #[Test]
You can’t perform that action at this time.
0 commit comments