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 ;
@@ -3513,7 +3514,7 @@ public function testTypesenseStoreWithCustomCollectionCanBeConfigured()
35133514 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
35143515 }
35153516
3516- public function testWevaviateStoreCanBeConfigured ()
3517+ public function testWeaviateStoreCanBeConfigured ()
35173518 {
35183519 $ container = $ this ->buildContainer ([
35193520 'ai ' => [
@@ -3532,14 +3533,15 @@ public function testWevaviateStoreCanBeConfigured()
35323533
35333534 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
35343535 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3535-
3536+ $ this -> assertSame ([WeaviateStoreFactory::class, ' create ' ], $ definition -> getFactory ());
35363537 $ this ->assertTrue ($ definition ->isLazy ());
3538+
35373539 $ this ->assertCount (4 , $ definition ->getArguments ());
3538- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3539- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3540+ $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (0 ));
35403541 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35413542 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3542- $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (3 ));
3543+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3544+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
35433545
35443546 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35453547 $ this ->assertSame ([
@@ -3553,10 +3555,7 @@ public function testWevaviateStoreCanBeConfigured()
35533555 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
35543556 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
35553557 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3556- }
35573558
3558- public function testWevaviateStoreWithCustomCollectionCanBeConfigured ()
3559- {
35603559 $ container = $ this ->buildContainer ([
35613560 'ai ' => [
35623561 'store ' => [
@@ -3574,15 +3573,58 @@ public function testWevaviateStoreWithCustomCollectionCanBeConfigured()
35743573 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
35753574
35763575 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3576+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
35773577 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3578+ $ this ->assertTrue ($ definition ->isLazy ());
3579+
3580+ $ this ->assertCount (4 , $ definition ->getArguments ());
3581+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
3582+ $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
3583+ $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3584+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3585+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
3586+
3587+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
3588+ $ this ->assertSame ([
3589+ ['interface ' => StoreInterface::class],
3590+ ['interface ' => ManagedStoreInterface::class],
3591+ ], $ definition ->getTag ('proxy ' ));
3592+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
3593+
3594+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_weaviate_store ' ));
3595+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myWeaviateStore ' ));
3596+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
3597+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
3598+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3599+
3600+ $ container = $ this ->buildContainer ([
3601+ 'ai ' => [
3602+ 'store ' => [
3603+ 'weaviate ' => [
3604+ 'my_weaviate_store ' => [
3605+ 'endpoint ' => 'http://localhost:8080 ' ,
3606+ 'api_key ' => 'bar ' ,
3607+ 'collection ' => 'my_weaviate_collection ' ,
3608+ 'http_client ' => 'scoped_http_client ' ,
3609+ ],
3610+ ],
3611+ ],
3612+ ],
3613+ ]);
35783614
3615+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
3616+
3617+ $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3618+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
3619+ $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
35793620 $ this ->assertTrue ($ definition ->isLazy ());
3621+
35803622 $ this ->assertCount (4 , $ definition ->getArguments ());
3581- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3582- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3623+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
35833624 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35843625 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3585- $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (3 ));
3626+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3627+ $ this ->assertSame ('scoped_http_client ' , (string ) $ definition ->getArgument (3 ));
35863628
35873629 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35883630 $ this ->assertSame ([
0 commit comments