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 ;
@@ -3512,7 +3513,7 @@ public function testTypesenseStoreWithCustomCollectionCanBeConfigured()
35123513 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
35133514 }
35143515
3515- public function testWevaviateStoreCanBeConfigured ()
3516+ public function testWeaviateStoreCanBeConfigured ()
35163517 {
35173518 $ container = $ this ->buildContainer ([
35183519 'ai ' => [
@@ -3531,14 +3532,15 @@ public function testWevaviateStoreCanBeConfigured()
35313532
35323533 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
35333534 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3534-
3535+ $ this -> assertSame ([WeaviateStoreFactory::class, ' create ' ], $ definition -> getFactory ());
35353536 $ this ->assertTrue ($ definition ->isLazy ());
3537+
35363538 $ this ->assertCount (4 , $ definition ->getArguments ());
3537- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3538- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3539+ $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (0 ));
35393540 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35403541 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3541- $ this ->assertSame ('my_weaviate_store ' , $ definition ->getArgument (3 ));
3542+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3543+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
35423544
35433545 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35443546 $ this ->assertSame ([
@@ -3552,10 +3554,7 @@ public function testWevaviateStoreCanBeConfigured()
35523554 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
35533555 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
35543556 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3555- }
35563557
3557- public function testWevaviateStoreWithCustomCollectionCanBeConfigured ()
3558- {
35593558 $ container = $ this ->buildContainer ([
35603559 'ai ' => [
35613560 'store ' => [
@@ -3573,15 +3572,58 @@ public function testWevaviateStoreWithCustomCollectionCanBeConfigured()
35733572 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
35743573
35753574 $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3575+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
35763576 $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
3577+ $ this ->assertTrue ($ definition ->isLazy ());
3578+
3579+ $ this ->assertCount (4 , $ definition ->getArguments ());
3580+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
3581+ $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
3582+ $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3583+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3584+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
3585+
3586+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
3587+ $ this ->assertSame ([
3588+ ['interface ' => StoreInterface::class],
3589+ ['interface ' => ManagedStoreInterface::class],
3590+ ], $ definition ->getTag ('proxy ' ));
3591+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
3592+
3593+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_weaviate_store ' ));
3594+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myWeaviateStore ' ));
3595+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $weaviate_my_weaviate_store ' ));
3596+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $weaviateMyWeaviateStore ' ));
3597+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
3598+
3599+ $ container = $ this ->buildContainer ([
3600+ 'ai ' => [
3601+ 'store ' => [
3602+ 'weaviate ' => [
3603+ 'my_weaviate_store ' => [
3604+ 'endpoint ' => 'http://localhost:8080 ' ,
3605+ 'api_key ' => 'bar ' ,
3606+ 'collection ' => 'my_weaviate_collection ' ,
3607+ 'http_client ' => 'scoped_http_client ' ,
3608+ ],
3609+ ],
3610+ ],
3611+ ],
3612+ ]);
35773613
3614+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.weaviate.my_weaviate_store ' ));
3615+
3616+ $ definition = $ container ->getDefinition ('ai.store.weaviate.my_weaviate_store ' );
3617+ $ this ->assertSame ([WeaviateStoreFactory::class, 'create ' ], $ definition ->getFactory ());
3618+ $ this ->assertSame (WeaviateStore::class, $ definition ->getClass ());
35783619 $ this ->assertTrue ($ definition ->isLazy ());
3620+
35793621 $ this ->assertCount (4 , $ definition ->getArguments ());
3580- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
3581- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
3622+ $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (0 ));
35823623 $ this ->assertSame ('http://localhost:8080 ' , $ definition ->getArgument (1 ));
35833624 $ this ->assertSame ('bar ' , $ definition ->getArgument (2 ));
3584- $ this ->assertSame ('my_weaviate_collection ' , $ definition ->getArgument (3 ));
3625+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
3626+ $ this ->assertSame ('scoped_http_client ' , (string ) $ definition ->getArgument (3 ));
35853627
35863628 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
35873629 $ this ->assertSame ([
0 commit comments