|
71 | 71 | use Symfony\AI\Store\Bridge\Supabase\Store as SupabaseStore; |
72 | 72 | use Symfony\AI\Store\Bridge\SurrealDb\Store as SurrealDbStore; |
73 | 73 | use Symfony\AI\Store\Bridge\Typesense\Store as TypesenseStore; |
| 74 | +use Symfony\AI\Store\Bridge\Vektor\Store as VektorStore; |
74 | 75 | use Symfony\AI\Store\Bridge\Weaviate\Store as WeaviateStore; |
75 | 76 | use Symfony\AI\Store\Distance\DistanceCalculator; |
76 | 77 | use Symfony\AI\Store\Distance\DistanceStrategy; |
@@ -3507,6 +3508,115 @@ public function testWevaviateStoreWithCustomCollectionCanBeConfigured() |
3507 | 3508 | $this->assertTrue($container->hasAlias(StoreInterface::class)); |
3508 | 3509 | } |
3509 | 3510 |
|
| 3511 | + public function testVektorStoreCanBeConfigured() |
| 3512 | + { |
| 3513 | + $container = $this->buildContainer([ |
| 3514 | + 'ai' => [ |
| 3515 | + 'store' => [ |
| 3516 | + 'vektor' => [ |
| 3517 | + 'main' => [], |
| 3518 | + ], |
| 3519 | + ], |
| 3520 | + ], |
| 3521 | + ]); |
| 3522 | + |
| 3523 | + $this->assertTrue($container->hasDefinition('ai.store.vektor.main')); |
| 3524 | + |
| 3525 | + $definition = $container->getDefinition('ai.store.vektor.main'); |
| 3526 | + $this->assertSame(VektorStore::class, $definition->getClass()); |
| 3527 | + $this->assertTrue($definition->isLazy()); |
| 3528 | + |
| 3529 | + $this->assertCount(3, $definition->getArguments()); |
| 3530 | + $this->assertSame('%kernel.project_dir%/var/share', $definition->getArgument(0)); |
| 3531 | + $this->assertSame(1536, $definition->getArgument(1)); |
| 3532 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 3533 | + $this->assertSame('filesystem', (string) $definition->getArgument(2)); |
| 3534 | + |
| 3535 | + $this->assertTrue($definition->hasTag('proxy')); |
| 3536 | + $this->assertSame([ |
| 3537 | + ['interface' => StoreInterface::class], |
| 3538 | + ['interface' => ManagedStoreInterface::class], |
| 3539 | + ], $definition->getTag('proxy')); |
| 3540 | + $this->assertTrue($definition->hasTag('ai.store')); |
| 3541 | + |
| 3542 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $main')); |
| 3543 | + $this->assertTrue($container->hasAlias('.Symfony\AI\Store\StoreInterface $vektor_main')); |
| 3544 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $vektorMain')); |
| 3545 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface')); |
| 3546 | + |
| 3547 | + $container = $this->buildContainer([ |
| 3548 | + 'ai' => [ |
| 3549 | + 'store' => [ |
| 3550 | + 'vektor' => [ |
| 3551 | + 'main' => [ |
| 3552 | + 'storage_path' => '%kernel.project_dir%/var/share/vektor', |
| 3553 | + ], |
| 3554 | + ], |
| 3555 | + ], |
| 3556 | + ], |
| 3557 | + ]); |
| 3558 | + |
| 3559 | + $this->assertTrue($container->hasDefinition('ai.store.vektor.main')); |
| 3560 | + |
| 3561 | + $definition = $container->getDefinition('ai.store.vektor.main'); |
| 3562 | + $this->assertSame(VektorStore::class, $definition->getClass()); |
| 3563 | + $this->assertTrue($definition->isLazy()); |
| 3564 | + |
| 3565 | + $this->assertCount(3, $definition->getArguments()); |
| 3566 | + $this->assertSame('%kernel.project_dir%/var/share/vektor', $definition->getArgument(0)); |
| 3567 | + $this->assertSame(1536, $definition->getArgument(1)); |
| 3568 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 3569 | + $this->assertSame('filesystem', (string) $definition->getArgument(2)); |
| 3570 | + |
| 3571 | + $this->assertTrue($definition->hasTag('proxy')); |
| 3572 | + $this->assertSame([ |
| 3573 | + ['interface' => StoreInterface::class], |
| 3574 | + ['interface' => ManagedStoreInterface::class], |
| 3575 | + ], $definition->getTag('proxy')); |
| 3576 | + $this->assertTrue($definition->hasTag('ai.store')); |
| 3577 | + |
| 3578 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $main')); |
| 3579 | + $this->assertTrue($container->hasAlias('.Symfony\AI\Store\StoreInterface $vektor_main')); |
| 3580 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $vektorMain')); |
| 3581 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface')); |
| 3582 | + |
| 3583 | + $container = $this->buildContainer([ |
| 3584 | + 'ai' => [ |
| 3585 | + 'store' => [ |
| 3586 | + 'vektor' => [ |
| 3587 | + 'main' => [ |
| 3588 | + 'dimensions' => 764, |
| 3589 | + ], |
| 3590 | + ], |
| 3591 | + ], |
| 3592 | + ], |
| 3593 | + ]); |
| 3594 | + |
| 3595 | + $this->assertTrue($container->hasDefinition('ai.store.vektor.main')); |
| 3596 | + |
| 3597 | + $definition = $container->getDefinition('ai.store.vektor.main'); |
| 3598 | + $this->assertSame(VektorStore::class, $definition->getClass()); |
| 3599 | + $this->assertTrue($definition->isLazy()); |
| 3600 | + |
| 3601 | + $this->assertCount(3, $definition->getArguments()); |
| 3602 | + $this->assertSame('%kernel.project_dir%/var/share', $definition->getArgument(0)); |
| 3603 | + $this->assertSame(764, $definition->getArgument(1)); |
| 3604 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 3605 | + $this->assertSame('filesystem', (string) $definition->getArgument(2)); |
| 3606 | + |
| 3607 | + $this->assertTrue($definition->hasTag('proxy')); |
| 3608 | + $this->assertSame([ |
| 3609 | + ['interface' => StoreInterface::class], |
| 3610 | + ['interface' => ManagedStoreInterface::class], |
| 3611 | + ], $definition->getTag('proxy')); |
| 3612 | + $this->assertTrue($definition->hasTag('ai.store')); |
| 3613 | + |
| 3614 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $main')); |
| 3615 | + $this->assertTrue($container->hasAlias('.Symfony\AI\Store\StoreInterface $vektor_main')); |
| 3616 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface $vektorMain')); |
| 3617 | + $this->assertTrue($container->hasAlias('Symfony\AI\Store\StoreInterface')); |
| 3618 | + } |
| 3619 | + |
3510 | 3620 | public function testConfigurationWithUseAttributeAsKeyWorksWithoutNormalizeKeys() |
3511 | 3621 | { |
3512 | 3622 | // Test that configurations using useAttributeAsKey work correctly |
@@ -8033,6 +8143,15 @@ private function getFullConfig(): array |
8033 | 8143 | 'collection' => 'my_weaviate_collection', |
8034 | 8144 | ], |
8035 | 8145 | ], |
| 8146 | + 'vektor' => [ |
| 8147 | + 'my_vektor_store' => [], |
| 8148 | + 'my_vektor_store_with_custom_path' => [ |
| 8149 | + 'storage_path' => 'foo', |
| 8150 | + ], |
| 8151 | + 'my_vektor_store_with_custom_dimensions' => [ |
| 8152 | + 'dimensions' => 764, |
| 8153 | + ], |
| 8154 | + ], |
8036 | 8155 | ], |
8037 | 8156 | 'message_store' => [ |
8038 | 8157 | 'cache' => [ |
|
0 commit comments