6666use Symfony \AI \Store \Bridge \Postgres \Distance as PostgresDistance ;
6767use Symfony \AI \Store \Bridge \Postgres \Store as PostgresStore ;
6868use Symfony \AI \Store \Bridge \Qdrant \Store as QdrantStore ;
69+ use Symfony \AI \Store \Bridge \Qdrant \StoreFactory ;
6970use Symfony \AI \Store \Bridge \Redis \Distance as RedisDistance ;
7071use Symfony \AI \Store \Bridge \Redis \Store as RedisStore ;
7172use Symfony \AI \Store \Bridge \Supabase \Store as SupabaseStore ;
@@ -2668,17 +2669,19 @@ public function testQdrantStoreCanBeConfigured()
26682669 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
26692670
26702671 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2672+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
26712673 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2672-
26732674 $ this ->assertTrue ($ definition ->isLazy ());
2674- $ this -> assertCount ( 6 , $ definition -> getArguments ());
2675- $ this ->assertInstanceOf (Reference::class , $ definition ->getArgument ( 0 ));
2676- $ this ->assertSame ('http_client ' , ( string ) $ definition ->getArgument (0 ));
2675+
2676+ $ this ->assertCount ( 7 , $ definition ->getArguments ( ));
2677+ $ this ->assertSame ('my_qdrant_store ' , $ definition ->getArgument (0 ));
26772678 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
26782679 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2679- $ this ->assertSame ('my_qdrant_store ' , $ definition ->getArgument (3 ));
2680+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2681+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
26802682 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
26812683 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2684+ $ this ->assertFalse ($ definition ->getArgument (6 ));
26822685
26832686 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
26842687 $ this ->assertSame ([
@@ -2692,10 +2695,7 @@ public function testQdrantStoreCanBeConfigured()
26922695 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
26932696 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
26942697 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2695- }
26962698
2697- public function testQdrantStoreWithCustomCollectionCanBeConfigured ()
2698- {
26992699 $ container = $ this ->buildContainer ([
27002700 'ai ' => [
27012701 'store ' => [
@@ -2713,17 +2713,19 @@ public function testQdrantStoreWithCustomCollectionCanBeConfigured()
27132713 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27142714
27152715 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2716+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
27162717 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2717-
27182718 $ this ->assertTrue ($ definition ->isLazy ());
2719- $ this -> assertCount ( 6 , $ definition -> getArguments ());
2720- $ this ->assertInstanceOf (Reference::class , $ definition ->getArgument ( 0 ));
2721- $ this ->assertSame ('http_client ' , ( string ) $ definition ->getArgument (0 ));
2719+
2720+ $ this ->assertCount ( 7 , $ definition ->getArguments ( ));
2721+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
27222722 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
27232723 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2724- $ this ->assertSame ('foo ' , $ definition ->getArgument (3 ));
2724+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2725+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
27252726 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
27262727 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2728+ $ this ->assertFalse ($ definition ->getArgument (6 ));
27272729
27282730 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
27292731 $ this ->assertSame ([
@@ -2737,10 +2739,7 @@ public function testQdrantStoreWithCustomCollectionCanBeConfigured()
27372739 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
27382740 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
27392741 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2740- }
27412742
2742- public function testQdrantStoreWithAsyncCanBeConfigured ()
2743- {
27442743 $ container = $ this ->buildContainer ([
27452744 'ai ' => [
27462745 'store ' => [
@@ -2759,15 +2758,62 @@ public function testQdrantStoreWithAsyncCanBeConfigured()
27592758 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27602759
27612760 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2761+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
27622762 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2763+ $ this ->assertTrue ($ definition ->isLazy ());
2764+
2765+ $ this ->assertCount (7 , $ definition ->getArguments ());
2766+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
2767+ $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
2768+ $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2769+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2770+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
2771+ $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
2772+ $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2773+ $ this ->assertTrue ($ definition ->getArgument (6 ));
2774+
2775+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
2776+ $ this ->assertSame ([
2777+ ['interface ' => StoreInterface::class],
2778+ ['interface ' => ManagedStoreInterface::class],
2779+ ], $ definition ->getTag ('proxy ' ));
2780+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
2781+
2782+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_qdrant_store ' ));
2783+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myQdrantStore ' ));
2784+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
2785+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
2786+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2787+
2788+ $ container = $ this ->buildContainer ([
2789+ 'ai ' => [
2790+ 'store ' => [
2791+ 'qdrant ' => [
2792+ 'my_qdrant_store ' => [
2793+ 'endpoint ' => 'http://127.0.0.1:8000 ' ,
2794+ 'api_key ' => 'test ' ,
2795+ 'collection_name ' => 'foo ' ,
2796+ 'async ' => true ,
2797+ 'http_client ' => 'http_client ' ,
2798+ ],
2799+ ],
2800+ ],
2801+ ],
2802+ ]);
2803+
2804+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27632805
2806+ $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2807+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
2808+ $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
27642809 $ this ->assertTrue ($ definition ->isLazy ());
2810+
27652811 $ this ->assertCount (7 , $ definition ->getArguments ());
2766- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
2767- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
2812+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
27682813 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
27692814 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2770- $ this ->assertSame ('foo ' , $ definition ->getArgument (3 ));
2815+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2816+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
27712817 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
27722818 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
27732819 $ this ->assertTrue ($ definition ->getArgument (6 ));
@@ -2784,6 +2830,49 @@ public function testQdrantStoreWithAsyncCanBeConfigured()
27842830 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
27852831 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
27862832 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2833+
2834+ $ container = $ this ->buildContainer ([
2835+ 'ai ' => [
2836+ 'store ' => [
2837+ 'qdrant ' => [
2838+ 'my_qdrant_store ' => [
2839+ 'collection_name ' => 'foo ' ,
2840+ 'http_client ' => 'scoped_http_client ' ,
2841+ ],
2842+ ],
2843+ ],
2844+ ],
2845+ ]);
2846+
2847+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
2848+
2849+ $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2850+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
2851+ $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2852+ $ this ->assertTrue ($ definition ->isLazy ());
2853+
2854+ $ this ->assertCount (7 , $ definition ->getArguments ());
2855+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
2856+ $ this ->assertNull ($ definition ->getArgument (1 ));
2857+ $ this ->assertNull ($ definition ->getArgument (2 ));
2858+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2859+ $ this ->assertSame ('scoped_http_client ' , (string ) $ definition ->getArgument (3 ));
2860+ $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
2861+ $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2862+ $ this ->assertFalse ($ definition ->getArgument (6 ));
2863+
2864+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
2865+ $ this ->assertSame ([
2866+ ['interface ' => StoreInterface::class],
2867+ ['interface ' => ManagedStoreInterface::class],
2868+ ], $ definition ->getTag ('proxy ' ));
2869+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
2870+
2871+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_qdrant_store ' ));
2872+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myQdrantStore ' ));
2873+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
2874+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
2875+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
27872876 }
27882877
27892878 public function testRedisStoreCanBeConfigured ()
0 commit comments