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
16 changes: 0 additions & 16 deletions src/ai-bundle/config/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
->end()
->end()
->arrayNode('azure')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand Down Expand Up @@ -95,7 +94,6 @@
->end()
->end()
->arrayNode('agent')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand Down Expand Up @@ -175,7 +173,6 @@
->arrayNode('store')
->children()
->arrayNode('azure_search')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -188,7 +185,6 @@
->end()
->end()
->arrayNode('cache')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -199,7 +195,6 @@
->end()
->end()
->arrayNode('chroma_db')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -209,7 +204,6 @@
->end()
->end()
->arrayNode('clickhouse')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -225,7 +219,6 @@
->end()
->end()
->arrayNode('meilisearch')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -239,7 +232,6 @@
->end()
->end()
->arrayNode('memory')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -248,7 +240,6 @@
->end()
->end()
->arrayNode('milvus')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -263,7 +254,6 @@
->end()
->end()
->arrayNode('mongodb')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -277,7 +267,6 @@
->end()
->end()
->arrayNode('neo4j')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -295,7 +284,6 @@
->end()
->end()
->arrayNode('pinecone')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -309,7 +297,6 @@
->end()
->end()
->arrayNode('qdrant')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -322,7 +309,6 @@
->end()
->end()
->arrayNode('surreal_db')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -340,7 +326,6 @@
->end()
->end()
->arrayNode('typesense')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand All @@ -355,7 +340,6 @@
->end()
->end()
->arrayNode('indexer')
->normalizeKeys(false)
->useAttributeAsKey('name')
->arrayPrototype()
->children()
Expand Down
39 changes: 39 additions & 0 deletions src/ai-bundle/tests/DependencyInjection/AiBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,45 @@ public function testInMemoryStoreWithCustomStrategyCanBeConfigured()
$this->assertSame('ai.store.distance_calculator.my_memory_store_with_custom_strategy', (string) $definition->getArgument(0));
}

public function testConfigurationWithUseAttributeAsKeyWorksWithoutNormalizeKeys()
Copy link
Contributor Author

@OskarStark OskarStark Sep 2, 2025

Choose a reason for hiding this comment

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

We can also remove this test case before merging, I just wanted to showcase, that it is working

{
// Test that configurations using useAttributeAsKey work correctly
// after removing redundant normalizeKeys(false) calls
$container = $this->buildContainer([
'ai' => [
'platform' => [
'azure' => [
'Test_Instance-123' => [ // Mixed case and special chars in key
'api_key' => 'test_key',
'base_url' => 'https://test.openai.azure.com/',
'deployment' => 'gpt-35-turbo',
'api_version' => '2024-02-15-preview',
],
],
],
'agent' => [
'My-Agent_Name.v2' => [ // Mixed case and special chars in key
'model' => ['class' => 'Symfony\AI\Platform\Bridge\OpenAi\Gpt'],
],
],
'store' => [
'mongodb' => [
'Production_DB-v3' => [ // Mixed case and special chars in key
'database' => 'test_db',
'collection' => 'test_collection',
'index_name' => 'test_index',
],
],
],
],
]);

// Verify that the services are created with the exact key names
$this->assertTrue($container->hasDefinition('ai.platform.azure.Test_Instance-123'));
$this->assertTrue($container->hasDefinition('ai.agent.My-Agent_Name.v2'));
$this->assertTrue($container->hasDefinition('ai.store.mongodb.Production_DB-v3'));
}

private function buildContainer(array $configuration): ContainerBuilder
{
$container = new ContainerBuilder();
Expand Down