Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit b32ff86

Browse files
committed
-
1 parent 180332b commit b32ff86

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

tests/Chain/InputProcessor/SystemPromptInputProcessorTest.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff 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]

0 commit comments

Comments
 (0)