diff --git a/src/ai-bundle/config/options.php b/src/ai-bundle/config/options.php index 3c95cf6be..714a2836d 100644 --- a/src/ai-bundle/config/options.php +++ b/src/ai-bundle/config/options.php @@ -252,6 +252,10 @@ throw new InvalidConfigurationException('Model name cannot be empty.'); } + if (isset($parsed['scheme'])) { + $model = $parsed['scheme'].':'.$model; + } + if (isset($parsed['query'])) { // If options array is also provided, throw an error if ([] !== $options) { @@ -659,6 +663,10 @@ throw new InvalidConfigurationException('Model name cannot be empty.'); } + if (isset($parsed['scheme'])) { + $model = $parsed['scheme'].':'.$model; + } + if (isset($parsed['query'])) { // If options array is also provided, throw an error if ([] !== $options) { diff --git a/src/ai-bundle/tests/DependencyInjection/AiBundleTest.php b/src/ai-bundle/tests/DependencyInjection/AiBundleTest.php index c4348381f..015c376b8 100644 --- a/src/ai-bundle/tests/DependencyInjection/AiBundleTest.php +++ b/src/ai-bundle/tests/DependencyInjection/AiBundleTest.php @@ -2518,6 +2518,53 @@ public function testComprehensiveMultiAgentHappyPath() $this->assertTrue($container->hasDefinition('ai.tool.agent_processor.orchestrator')); } + #[TestDox('Agent model configuration preserves colon notation in model names (e.g., qwen3:0.6b)')] + #[TestWith(['qwen3:0.6b'])] + #[TestWith(['deepseek-r1:70b'])] + #[TestWith(['qwen3-coder:30b'])] + #[TestWith(['qwen3:0.6b?think=false'])] + public function testModelConfigurationWithColonNotation(string $model) + { + $container = $this->buildContainer([ + 'ai' => [ + 'agent' => [ + 'test' => [ + 'model' => [ + 'name' => $model, + ], + ], + ], + ], + ]); + + $agentDefinition = $container->getDefinition('ai.agent.test'); + + $this->assertSame($model, $agentDefinition->getArgument(1)); + } + + #[TestDox('Vectorizer model configuration preserves colon notation in model names (e.g., bge-m3:1024)')] + #[TestWith(['bge-m3:567m'])] + #[TestWith(['nomic-embed-text:137m-v1.5-fp16'])] + #[TestWith(['qwen3-embedding:0.6b?normalize=true'])] + public function testVectorizerConfigurationWithColonNotation(string $model) + { + $container = $this->buildContainer([ + 'ai' => [ + 'vectorizer' => [ + 'test' => [ + 'model' => [ + 'name' => $model, + ], + ], + ], + ], + ]); + + $definition = $container->getDefinition('ai.vectorizer.test'); + + $this->assertSame($model, $definition->getArgument(1)); + } + private function buildContainer(array $configuration): ContainerBuilder { $container = new ContainerBuilder();