Skip to content

Commit ae3de42

Browse files
authored
fix: remove unwanted tools in system prompt by autowire (#77)
1 parent 3aa39fd commit ae3de42

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/DependencyInjection/LlmChainExtension.php

+4-6
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,10 @@ private function processChainConfig(string $name, array $config, ContainerBuilde
320320
$systemPromptInputProcessorDefinition = new Definition(SystemPromptInputProcessor::class);
321321
$systemPromptInputProcessorDefinition
322322
->setAutowired(true)
323-
->setArgument('$systemPrompt', $config['system_prompt']);
324-
325-
if ($config['include_tools']) {
326-
$systemPromptInputProcessorDefinition
327-
->setArgument('$toolbox', new Reference('llm_chain.toolbox.'.$name));
328-
}
323+
->setArguments([
324+
'$systemPrompt' => $config['system_prompt'],
325+
'$toolbox' => $config['include_tools'] ? new Reference('llm_chain.toolbox.'.$name) : null,
326+
]);
329327

330328
$inputProcessors[] = $systemPromptInputProcessorDefinition;
331329
}

0 commit comments

Comments
 (0)