7474use Symfony \AI \Store \Bridge \Typesense \Store as TypesenseStore ;
7575use Symfony \AI \Store \Bridge \Vektor \Store as VektorStore ;
7676use Symfony \AI \Store \Bridge \Weaviate \Store as WeaviateStore ;
77+ use Symfony \AI \Store \Bridge \Weaviate \StoreFactory as WeaviateStoreFactory ;
7778use Symfony \AI \Store \Distance \DistanceCalculator ;
7879use Symfony \AI \Store \Distance \DistanceStrategy ;
7980use Symfony \AI \Store \Document \Filter \TextContainsFilter ;
@@ -3521,7 +3522,7 @@ public function testTypesenseStoreWithCustomCollectionCanBeConfigured()
35213522 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
35223523 }
35233524
3524- public function testWevaviateStoreCanBeConfigured ()
3525+ public function testWeaviateStoreCanBeConfigured ()
35253526 {
35263527 $ container = $ this ->buildContainer ([
35273528 'ai ' => [
@@ -3540,14 +3541,15 @@ public function testWevaviateStoreCanBeConfigured()
35403541
35413542 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
35423543 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3543-
3544+ $ this -> assertSame ([WeaviateStoreFactory::class, ' create ' ], $ definition -> getFactory ());
35443545 $ this ->assertTrue ($ definition ->isLazy ());
3546+
35453547 $ this ->assertCount (4 , $ definition ->getArguments ());
3546- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3547- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3548+ $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (0 ));
35483549 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35493550 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3550- $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (3 ));
3551+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3552+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
35513553
35523554 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35533555 $ this ->assertSame ([
@@ -3561,10 +3563,7 @@ public function testWevaviateStoreCanBeConfigured()
35613563 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
35623564 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
35633565 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3564- }
35653566
3566- public function testWevaviateStoreWithCustomCollectionCanBeConfigured ()
3567- {
35683567 $ container = $ this ->buildContainer ([
35693568 'ai ' => [
35703569 'store ' => [
@@ -3582,15 +3581,58 @@ public function testWevaviateStoreWithCustomCollectionCanBeConfigured()
35823581 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
35833582
35843583 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3584+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
35853585 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3586+ $ this ->assertTrue ($ definition ->isLazy ());
3587+
3588+ $ this ->assertCount (4 , $ definition ->getArguments ());
3589+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
3590+ $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
3591+ $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3592+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3593+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
3594+
3595+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
3596+ $ this ->assertSame ([
3597+ ['interface ' => StoreInterface::class],
3598+ ['interface ' => ManagedStoreInterface::class],
3599+ ], $ definition ->getTag ('proxy ' ));
3600+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
3601+
3602+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_weaviate_store ' ));
3603+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myWeaviateStore ' ));
3604+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
3605+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
3606+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3607+
3608+ $ container = $ this ->buildContainer ([
3609+ 'ai ' => [
3610+ 'store ' => [
3611+ 'weaviate ' => [
3612+ 'my_weaviate_store ' => [
3613+ 'endpoint ' => 'http://localhost:8080 ' ,
3614+ 'api_key ' => 'bar ' ,
3615+ 'collection ' => 'my_weaviate_collection ' ,
3616+ 'http_client ' => 'scoped_http_client ' ,
3617+ ],
3618+ ],
3619+ ],
3620+ ],
3621+ ]);
35863622
3623+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
3624+
3625+ $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3626+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
3627+ $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
35873628 $ this ->assertTrue ($ definition ->isLazy ());
3629+
35883630 $ this ->assertCount (4 , $ definition ->getArguments ());
3589- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3590- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3631+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
35913632 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35923633 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3593- $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (3 ));
3634+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3635+ $ this ->assertSame ('scoped_http_client ' , (string ) $ definition ->getArgument (3 ));
35943636
35953637 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35963638 $ this ->assertSame ([
0 commit comments