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