13
13
14
14
use PHPUnit \Framework \Attributes \CoversClass ;
15
15
use PHPUnit \Framework \Attributes \DoesNotPerformAssertions ;
16
+ use PHPUnit \Framework \Attributes \TestWith ;
16
17
use PHPUnit \Framework \Attributes \UsesClass ;
17
18
use PHPUnit \Framework \TestCase ;
18
19
use Symfony \AI \AiBundle \AiBundle ;
@@ -29,6 +30,46 @@ public function testExtensionLoadDoesNotThrow()
29
30
$ this ->buildContainer ($ this ->getFullConfig ());
30
31
}
31
32
33
+ #[TestWith([true ], 'enabled ' )]
34
+ #[TestWith([false ], 'disabled ' )]
35
+ public function testFaultTolerantAgentSpecificToolbox (bool $ enabled )
36
+ {
37
+ $ container = $ this ->buildContainer ([
38
+ 'ai ' => [
39
+ 'agent ' => [
40
+ 'my_agent ' => [
41
+ 'model ' => ['class ' => 'Symfony\AI\Platform\Bridge\OpenAi\Gpt ' ],
42
+ 'tools ' => [
43
+ ['service ' => 'some_service ' , 'description ' => 'Some tool ' ],
44
+ ],
45
+ 'fault_tolerant_toolbox ' => $ enabled ,
46
+ ],
47
+ ],
48
+ ],
49
+ ]);
50
+
51
+ $ this ->assertSame ($ enabled , $ container ->hasDefinition ('ai.fault_tolerant_toolbox.my_agent ' ));
52
+ }
53
+
54
+ #[TestWith([true ], 'enabled ' )]
55
+ #[TestWith([false ], 'disabled ' )]
56
+ public function testFaultTolerantDefaultToolbox (bool $ enabled )
57
+ {
58
+ $ container = $ this ->buildContainer ([
59
+ 'ai ' => [
60
+ 'agent ' => [
61
+ 'my_agent ' => [
62
+ 'model ' => ['class ' => 'Symfony\AI\Platform\Bridge\OpenAi\Gpt ' ],
63
+ 'tools ' => true ,
64
+ 'fault_tolerant_toolbox ' => $ enabled ,
65
+ ],
66
+ ],
67
+ ],
68
+ ]);
69
+
70
+ $ this ->assertSame ($ enabled , $ container ->hasDefinition ('ai.fault_tolerant_toolbox ' ));
71
+ }
72
+
32
73
public function testAgentsCanBeRegisteredAsTools ()
33
74
{
34
75
$ container = $ this ->buildContainer ([
0 commit comments