Skip to content

Commit b47b979

Browse files
committed
ref
1 parent c538f07 commit b47b979

File tree

4 files changed

+975
-273
lines changed

4 files changed

+975
-273
lines changed

src/ai-bundle/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"symfony/string": "^7.3|^8.0"
2828
},
2929
"require-dev": {
30+
"codewithkyrian/chromadb-php": "^0.2.1 || ^0.3 || ^0.4",
3031
"google/auth": "^1.47",
3132
"mongodb/mongodb": "^1.21 || ^2.0",
3233
"phpstan/phpstan": "^2.1",

src/ai-bundle/config/options.php

Lines changed: 56 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -584,16 +584,32 @@
584584
->end()
585585
->end()
586586
->end()
587+
->arrayNode('mariadb')
588+
->useAttributeAsKey('name')
589+
->arrayPrototype()
590+
->children()
591+
->stringNode('connection')->cannotBeEmpty()->end()
592+
->stringNode('table_name')->cannotBeEmpty()->end()
593+
->stringNode('index_name')->cannotBeEmpty()->end()
594+
->stringNode('vector_field_name')->cannotBeEmpty()->end()
595+
->arrayNode('setup_options')
596+
->children()
597+
->integerNode('dimensions')->end()
598+
->end()
599+
->end()
600+
->end()
601+
->end()
602+
->end()
587603
->arrayNode('meilisearch')
588604
->useAttributeAsKey('name')
589605
->arrayPrototype()
590606
->children()
591607
->stringNode('endpoint')->cannotBeEmpty()->end()
592608
->stringNode('api_key')->cannotBeEmpty()->end()
593609
->stringNode('index_name')->cannotBeEmpty()->end()
594-
->stringNode('embedder')->end()
595-
->stringNode('vector_field')->end()
596-
->integerNode('dimensions')->end()
610+
->stringNode('embedder')->cannotBeEmpty()->end()
611+
->stringNode('vector_field')->cannotBeEmpty()->end()
612+
->integerNode('dimensions')->isRequired()->end()
597613
->floatNode('semantic_ratio')
598614
->info('The ratio between semantic (vector) and full-text search (0.0 to 1.0). Default: 1.0 (100% semantic)')
599615
->defaultValue(1.0)
@@ -611,22 +627,6 @@
611627
->end()
612628
->end()
613629
->end()
614-
->arrayNode('mariadb')
615-
->useAttributeAsKey('name')
616-
->arrayPrototype()
617-
->children()
618-
->stringNode('connection')->cannotBeEmpty()->end()
619-
->stringNode('table_name')->cannotBeEmpty()->end()
620-
->stringNode('index_name')->cannotBeEmpty()->end()
621-
->stringNode('vector_field_name')->cannotBeEmpty()->end()
622-
->arrayNode('setup_options')
623-
->children()
624-
->integerNode('dimensions')->end()
625-
->end()
626-
->end()
627-
->end()
628-
->end()
629-
->end()
630630
->arrayNode('milvus')
631631
->useAttributeAsKey('name')
632632
->arrayPrototype()
@@ -635,8 +635,8 @@
635635
->stringNode('api_key')->isRequired()->end()
636636
->stringNode('database')->isRequired()->end()
637637
->stringNode('collection')->isRequired()->end()
638-
->stringNode('vector_field')->end()
639-
->integerNode('dimensions')->end()
638+
->stringNode('vector_field')->isRequired()->end()
639+
->integerNode('dimensions')->isRequired()->end()
640640
->stringNode('metric_type')->end()
641641
->end()
642642
->end()
@@ -652,7 +652,7 @@
652652
->stringNode('database')->isRequired()->end()
653653
->stringNode('collection')->isRequired()->end()
654654
->stringNode('index_name')->isRequired()->end()
655-
->stringNode('vector_field')->end()
655+
->stringNode('vector_field')->isRequired()->end()
656656
->booleanNode('bulk_write')->end()
657657
->end()
658658
->end()
@@ -667,9 +667,9 @@
667667
->stringNode('database')->cannotBeEmpty()->end()
668668
->stringNode('vector_index_name')->cannotBeEmpty()->end()
669669
->stringNode('node_name')->cannotBeEmpty()->end()
670-
->stringNode('vector_field')->end()
671-
->integerNode('dimensions')->end()
672-
->stringNode('distance')->end()
670+
->stringNode('vector_field')->isRequired()->end()
671+
->integerNode('dimensions')->isRequired()->end()
672+
->stringNode('distance')->isRequired()->end()
673673
->booleanNode('quantization')->end()
674674
->end()
675675
->end()
@@ -684,21 +684,49 @@
684684
->end()
685685
->stringNode('namespace')->end()
686686
->arrayNode('filter')
687-
->scalarPrototype()->end()
687+
->scalarPrototype()
688+
->defaultValue([])
689+
->end()
688690
->end()
689691
->integerNode('top_k')->end()
690692
->end()
691693
->end()
692694
->end()
695+
->arrayNode('postgres')
696+
->useAttributeAsKey('name')
697+
->arrayPrototype()
698+
->children()
699+
->stringNode('dsn')->cannotBeEmpty()->end()
700+
->stringNode('username')->end()
701+
->stringNode('password')->end()
702+
->stringNode('table_name')->isRequired()->end()
703+
->stringNode('vector_field')->isRequired()->end()
704+
->enumNode('distance')
705+
->info('Distance metric to use for vector similarity search')
706+
->enumFqcn(PostgresDistance::class)
707+
->defaultValue(PostgresDistance::L2)
708+
->end()
709+
->stringNode('dbal_connection')->cannotBeEmpty()->end()
710+
->end()
711+
->validate()
712+
->ifTrue(static fn ($v): bool => !isset($v['dsn']) && !isset($v['dbal_connection']))
713+
->thenInvalid('Either "dsn" or "dbal_connection" must be configured.')
714+
->end()
715+
->validate()
716+
->ifTrue(static fn ($v): bool => isset($v['dsn'], $v['dbal_connection']))
717+
->thenInvalid('Either "dsn" or "dbal_connection" can be configured, but not both.')
718+
->end()
719+
->end()
720+
->end()
693721
->arrayNode('qdrant')
694722
->useAttributeAsKey('name')
695723
->arrayPrototype()
696724
->children()
697725
->stringNode('endpoint')->cannotBeEmpty()->end()
698726
->stringNode('api_key')->cannotBeEmpty()->end()
699727
->stringNode('collection_name')->cannotBeEmpty()->end()
700-
->integerNode('dimensions')->end()
701-
->stringNode('distance')->end()
728+
->integerNode('dimensions')->isRequired()->end()
729+
->stringNode('distance')->isRequired()->end()
702730
->booleanNode('async')->end()
703731
->end()
704732
->end()
@@ -790,32 +818,6 @@
790818
->end()
791819
->end()
792820
->end()
793-
->arrayNode('postgres')
794-
->useAttributeAsKey('name')
795-
->arrayPrototype()
796-
->children()
797-
->stringNode('dsn')->cannotBeEmpty()->end()
798-
->stringNode('username')->end()
799-
->stringNode('password')->end()
800-
->stringNode('table_name')->isRequired()->end()
801-
->stringNode('vector_field')->end()
802-
->enumNode('distance')
803-
->info('Distance metric to use for vector similarity search')
804-
->enumFqcn(PostgresDistance::class)
805-
->defaultValue(PostgresDistance::L2)
806-
->end()
807-
->stringNode('dbal_connection')->cannotBeEmpty()->end()
808-
->end()
809-
->validate()
810-
->ifTrue(static fn ($v) => !isset($v['dsn']) && !isset($v['dbal_connection']))
811-
->thenInvalid('Either "dsn" or "dbal_connection" must be configured.')
812-
->end()
813-
->validate()
814-
->ifTrue(static fn ($v) => isset($v['dsn'], $v['dbal_connection']))
815-
->thenInvalid('Either "dsn" or "dbal_connection" can be configured, but not both.')
816-
->end()
817-
->end()
818-
->end()
819821
->end()
820822
->end()
821823
->arrayNode('message_store')

0 commit comments

Comments
 (0)