Skip to content

Commit a010cfd

Browse files
committed
bug #176 [AIBundle] Fix dependency injection (valtzu)
This PR was merged into the main branch. Discussion ---------- [AIBundle] Fix dependency injection | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | Docs? | no | License | MIT Fix DI config after #163 / #154. Should've rebased before merge – now we're getting a bunch of errors on `main`: ``` Symfony\AI\Agent\Toolbox\Toolbox::__construct(): Argument #1 ($tools) must be of type Traversable|array, Symfony\AI\Agent\Toolbox\ToolFactory\ReflectionToolFactory given ``` etc Commits ------- 3c6290e [AIBundle] Fix dependency injection config after #163
2 parents 580ff6d + 3c6290e commit a010cfd

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ai-bundle/config/services.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@
6868
->set('ai.toolbox.abstract', Toolbox::class)
6969
->abstract()
7070
->args([
71-
service('ai.tool_factory'),
7271
abstract_arg('Collection of tools'),
72+
service('ai.tool_factory'),
7373
service('ai.tool_call_argument_resolver'),
7474
service('logger')->ignoreOnInvalid(),
7575
service('event_dispatcher')->nullOnInvalid(),
7676
])
7777
->set('ai.toolbox', Toolbox::class)
7878
->parent('ai.toolbox.abstract')
79-
->arg('index_1', tagged_iterator('ai.tool'))
79+
->arg('index_0', tagged_iterator('ai.tool'))
8080
->alias(ToolboxInterface::class, 'ai.toolbox')
8181
->set('ai.tool_factory.abstract', AbstractToolFactory::class)
8282
->abstract()

src/ai-bundle/src/AIBundle.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -347,8 +347,8 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
347347
}
348348

349349
$toolboxDefinition = (new ChildDefinition('ai.toolbox.abstract'))
350-
->replaceArgument(0, new Reference('ai.toolbox.'.$name.'.chain_factory'))
351-
->replaceArgument(1, $tools);
350+
->replaceArgument(0, $tools)
351+
->replaceArgument(1, new Reference('ai.toolbox.'.$name.'.chain_factory'));
352352
$container->setDefinition('ai.toolbox.'.$name, $toolboxDefinition);
353353

354354
if ($config['fault_tolerant_toolbox']) {

0 commit comments

Comments
 (0)