Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/ai-bundle/config/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down
47 changes: 47 additions & 0 deletions src/ai-bundle/tests/DependencyInjection/AiBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
],
],
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this logic also for the vectorizer.name.model config

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

]);

$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();
Expand Down