Skip to content

Commit b527ecb

Browse files
committed
[AI Bundle] Fix null model names
1 parent 68b6181 commit b527ecb

File tree

3 files changed

+46
-50
lines changed

3 files changed

+46
-50
lines changed

src/ai-bundle/config/options.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
->thenInvalid(\sprintf('The model class "%%s" must extend %s.', Model::class))
191191
->end()
192192
->end()
193-
->stringNode('name')->defaultNull()->end()
193+
->stringNode('name')->isRequired()->end()
194194
->arrayNode('options')
195195
->variablePrototype()->end()
196196
->end()
@@ -531,7 +531,7 @@
531531
->thenInvalid(\sprintf('The model class "%%s" must extend %s.', Model::class))
532532
->end()
533533
->end()
534-
->stringNode('name')->defaultNull()->end()
534+
->stringNode('name')->isRequired()->end()
535535
->arrayNode('options')
536536
->variablePrototype()->end()
537537
->end()

src/ai-bundle/src/AiBundle.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,7 @@ private function processAgentConfig(string $name, array $config, ContainerBuilde
504504
['class' => $modelClass, 'name' => $modelName, 'options' => $options] = $config['model'];
505505

506506
$modelDefinition = new Definition($modelClass);
507-
if (null !== $modelName) {
508-
$modelDefinition->setArgument(0, $modelName);
509-
}
507+
$modelDefinition->setArgument(0, $modelName);
510508
if ([] !== $options) {
511509
$modelDefinition->setArgument(1, $options);
512510
}
@@ -1105,9 +1103,7 @@ private function processVectorizerConfig(string $name, array $config, ContainerB
11051103
['class' => $modelClass, 'name' => $modelName, 'options' => $options] = $config['model'];
11061104

11071105
$modelDefinition = (new Definition((string) $modelClass));
1108-
if (null !== $modelName) {
1109-
$modelDefinition->setArgument(0, $modelName);
1110-
}
1106+
$modelDefinition->setArgument(0, $modelName);
11111107
if ([] !== $options) {
11121108
$modelDefinition->setArgument(1, $options);
11131109
}

0 commit comments

Comments
 (0)