Skip to content

Commit 3dbf0ec

Browse files
committed
ref
1 parent 230e973 commit 3dbf0ec

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
@@ -599,16 +599,32 @@
599599
->end()
600600
->end()
601601
->end()
602+
->arrayNode('mariadb')
603+
->useAttributeAsKey('name')
604+
->arrayPrototype()
605+
->children()
606+
->stringNode('connection')->cannotBeEmpty()->end()
607+
->stringNode('table_name')->cannotBeEmpty()->end()
608+
->stringNode('index_name')->cannotBeEmpty()->end()
609+
->stringNode('vector_field_name')->cannotBeEmpty()->end()
610+
->arrayNode('setup_options')
611+
->children()
612+
->integerNode('dimensions')->end()
613+
->end()
614+
->end()
615+
->end()
616+
->end()
617+
->end()
602618
->arrayNode('meilisearch')
603619
->useAttributeAsKey('name')
604620
->arrayPrototype()
605621
->children()
606622
->stringNode('endpoint')->cannotBeEmpty()->end()
607623
->stringNode('api_key')->cannotBeEmpty()->end()
608624
->stringNode('index_name')->cannotBeEmpty()->end()
609-
->stringNode('embedder')->end()
610-
->stringNode('vector_field')->end()
611-
->integerNode('dimensions')->end()
625+
->stringNode('embedder')->cannotBeEmpty()->end()
626+
->stringNode('vector_field')->cannotBeEmpty()->end()
627+
->integerNode('dimensions')->isRequired()->end()
612628
->floatNode('semantic_ratio')
613629
->info('The ratio between semantic (vector) and full-text search (0.0 to 1.0). Default: 1.0 (100% semantic)')
614630
->defaultValue(1.0)
@@ -626,22 +642,6 @@
626642
->end()
627643
->end()
628644
->end()
629-
->arrayNode('mariadb')
630-
->useAttributeAsKey('name')
631-
->arrayPrototype()
632-
->children()
633-
->stringNode('connection')->cannotBeEmpty()->end()
634-
->stringNode('table_name')->cannotBeEmpty()->end()
635-
->stringNode('index_name')->cannotBeEmpty()->end()
636-
->stringNode('vector_field_name')->cannotBeEmpty()->end()
637-
->arrayNode('setup_options')
638-
->children()
639-
->integerNode('dimensions')->end()
640-
->end()
641-
->end()
642-
->end()
643-
->end()
644-
->end()
645645
->arrayNode('milvus')
646646
->useAttributeAsKey('name')
647647
->arrayPrototype()
@@ -650,8 +650,8 @@
650650
->stringNode('api_key')->isRequired()->end()
651651
->stringNode('database')->isRequired()->end()
652652
->stringNode('collection')->isRequired()->end()
653-
->stringNode('vector_field')->end()
654-
->integerNode('dimensions')->end()
653+
->stringNode('vector_field')->isRequired()->end()
654+
->integerNode('dimensions')->isRequired()->end()
655655
->stringNode('metric_type')->end()
656656
->end()
657657
->end()
@@ -667,7 +667,7 @@
667667
->stringNode('database')->isRequired()->end()
668668
->stringNode('collection')->isRequired()->end()
669669
->stringNode('index_name')->isRequired()->end()
670-
->stringNode('vector_field')->end()
670+
->stringNode('vector_field')->isRequired()->end()
671671
->booleanNode('bulk_write')->end()
672672
->end()
673673
->end()
@@ -682,9 +682,9 @@
682682
->stringNode('database')->cannotBeEmpty()->end()
683683
->stringNode('vector_index_name')->cannotBeEmpty()->end()
684684
->stringNode('node_name')->cannotBeEmpty()->end()
685-
->stringNode('vector_field')->end()
686-
->integerNode('dimensions')->end()
687-
->stringNode('distance')->end()
685+
->stringNode('vector_field')->isRequired()->end()
686+
->integerNode('dimensions')->isRequired()->end()
687+
->stringNode('distance')->isRequired()->end()
688688
->booleanNode('quantization')->end()
689689
->end()
690690
->end()
@@ -699,21 +699,49 @@
699699
->end()
700700
->stringNode('namespace')->end()
701701
->arrayNode('filter')
702-
->scalarPrototype()->end()
702+
->scalarPrototype()
703+
->defaultValue([])
704+
->end()
703705
->end()
704706
->integerNode('top_k')->end()
705707
->end()
706708
->end()
707709
->end()
710+
->arrayNode('postgres')
711+
->useAttributeAsKey('name')
712+
->arrayPrototype()
713+
->children()
714+
->stringNode('dsn')->cannotBeEmpty()->end()
715+
->stringNode('username')->end()
716+
->stringNode('password')->end()
717+
->stringNode('table_name')->isRequired()->end()
718+
->stringNode('vector_field')->isRequired()->end()
719+
->enumNode('distance')
720+
->info('Distance metric to use for vector similarity search')
721+
->enumFqcn(PostgresDistance::class)
722+
->defaultValue(PostgresDistance::L2)
723+
->end()
724+
->stringNode('dbal_connection')->cannotBeEmpty()->end()
725+
->end()
726+
->validate()
727+
->ifTrue(static fn ($v): bool => !isset($v['dsn']) && !isset($v['dbal_connection']))
728+
->thenInvalid('Either "dsn" or "dbal_connection" must be configured.')
729+
->end()
730+
->validate()
731+
->ifTrue(static fn ($v): bool => isset($v['dsn'], $v['dbal_connection']))
732+
->thenInvalid('Either "dsn" or "dbal_connection" can be configured, but not both.')
733+
->end()
734+
->end()
735+
->end()
708736
->arrayNode('qdrant')
709737
->useAttributeAsKey('name')
710738
->arrayPrototype()
711739
->children()
712740
->stringNode('endpoint')->cannotBeEmpty()->end()
713741
->stringNode('api_key')->cannotBeEmpty()->end()
714742
->stringNode('collection_name')->cannotBeEmpty()->end()
715-
->integerNode('dimensions')->end()
716-
->stringNode('distance')->end()
743+
->integerNode('dimensions')->isRequired()->end()
744+
->stringNode('distance')->isRequired()->end()
717745
->booleanNode('async')->end()
718746
->end()
719747
->end()
@@ -805,32 +833,6 @@
805833
->end()
806834
->end()
807835
->end()
808-
->arrayNode('postgres')
809-
->useAttributeAsKey('name')
810-
->arrayPrototype()
811-
->children()
812-
->stringNode('dsn')->cannotBeEmpty()->end()
813-
->stringNode('username')->end()
814-
->stringNode('password')->end()
815-
->stringNode('table_name')->isRequired()->end()
816-
->stringNode('vector_field')->end()
817-
->enumNode('distance')
818-
->info('Distance metric to use for vector similarity search')
819-
->enumFqcn(PostgresDistance::class)
820-
->defaultValue(PostgresDistance::L2)
821-
->end()
822-
->stringNode('dbal_connection')->cannotBeEmpty()->end()
823-
->end()
824-
->validate()
825-
->ifTrue(static fn ($v) => !isset($v['dsn']) && !isset($v['dbal_connection']))
826-
->thenInvalid('Either "dsn" or "dbal_connection" must be configured.')
827-
->end()
828-
->validate()
829-
->ifTrue(static fn ($v) => isset($v['dsn'], $v['dbal_connection']))
830-
->thenInvalid('Either "dsn" or "dbal_connection" can be configured, but not both.')
831-
->end()
832-
->end()
833-
->end()
834836
->end()
835837
->end()
836838
->arrayNode('message_store')

0 commit comments

Comments
 (0)