@@ -70,7 +70,7 @@ Tool calling can be enabled by registering the processors in the agent::
7070
7171 $yourTool = new YourTool();
7272
73- $toolbox = Toolbox::create( $yourTool);
73+ $toolbox = new Toolbox([ $yourTool] );
7474 $toolProcessor = new AgentProcessor($toolbox);
7575
7676 $agent = new Agent($platform, $model, inputProcessors: [$toolProcessor], outputProcessors: [$toolProcessor]);
@@ -157,7 +157,7 @@ To leverage JSON Schema validation rules, configure the ``#[With]`` attribute on
157157
158158See attribute class ``Symfony\AI\Platform\Contract\JsonSchema\Attribute\With `` for all available options.
159159
160- **Automatic Enum Validation **
160+ **Automatic Enum Validation **
161161
162162For PHP backed enums, Symfony AI provides automatic validation without requiring any ``#[With] `` attributes::
163163
@@ -340,7 +340,7 @@ messages will be added to your MessageBag::
340340
341341 $yourTool = new YourTool();
342342
343- $toolbox = Toolbox::create( $yourTool);
343+ $toolbox = new Toolbox([ $yourTool] );
344344 $toolProcessor = new AgentProcessor($toolbox, keepToolMessages: true);
345345
346346 $agent = new Agent($platform, $model, inputProcessor: [$toolProcessor], outputProcessor: [$toolProcessor]);
@@ -378,7 +378,7 @@ more accurate and context-aware results. Therefore, the component provides a bui
378378 // Initialize Platform & Models
379379
380380 $similaritySearch = new SimilaritySearch($model, $store);
381- $toolbox = Toolbox::create( $similaritySearch);
381+ $toolbox = new Toolbox([ $similaritySearch] );
382382 $processor = new Agent($toolbox);
383383 $agent = new Agent($platform, $model, [$processor], [$processor]);
384384
@@ -635,19 +635,19 @@ It provides predictable responses without making external API calls and includes
635635
636636 $messages = new MessageBag(Message::ofUser('What is Symfony?'));
637637 $result = $agent->call($messages);
638-
638+
639639 echo $result->getContent(); // "Symfony is a PHP web framework"
640640
641641Call Tracking and Assertions::
642642
643643 // Verify agent interactions
644644 $agent->assertCallCount(1);
645645 $agent->assertCalledWith('What is Symfony?');
646-
646+
647647 // Get detailed call information
648648 $calls = $agent->getCalls();
649649 $lastCall = $agent->getLastCall();
650-
650+
651651 // Reset call tracking
652652 $agent->reset();
653653
@@ -670,35 +670,35 @@ Callable Responses
670670Like ``MockHttpClient ``, ``MockAgent `` supports callable responses for dynamic behavior::
671671
672672 $agent = new MockAgent();
673-
673+
674674 // Dynamic response based on input and context
675675 $agent->addResponse('weather', function ($messages, $options, $input) {
676676 $messageCount = count($messages->getMessages());
677677 return "Weather info (context: {$messageCount} messages)";
678678 });
679-
679+
680680 // Callable can return string or MockResponse
681681 $agent->addResponse('complex', function ($messages, $options, $input) {
682682 return new MockResponse("Complex response for: {$input}");
683683 });
684-
684+
685685
686686Service Testing Example
687687~~~~~~~~~~~~~~~~~~~~~~~
688688
689689Testing a service that uses an agent::
690690
691- class ChatServiceTest extends TestCase
691+ class ChatServiceTest extends TestCase
692692 {
693693 public function testChatResponse(): void
694694 {
695695 $agent = new MockAgent([
696696 'Hello' => 'Hi there! How can I help?',
697697 ]);
698-
698+
699699 $chatService = new ChatService($agent);
700700 $response = $chatService->processMessage('Hello');
701-
701+
702702 $this->assertSame('Hi there! How can I help?', $response);
703703 $agent->assertCallCount(1);
704704 $agent->assertCalledWith('Hello');
0 commit comments