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 ;
@@ -2667,17 +2668,19 @@ public function testQdrantStoreCanBeConfigured()
26672668 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
26682669
26692670 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2671+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
26702672 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2671-
26722673 $ this ->assertTrue ($ definition ->isLazy ());
2673- $ this -> assertCount ( 6 , $ definition -> getArguments ());
2674- $ this ->assertInstanceOf (Reference::class , $ definition ->getArgument ( 0 ));
2675- $ this ->assertSame ('http_client ' , ( string ) $ definition ->getArgument (0 ));
2674+
2675+ $ this ->assertCount ( 7 , $ definition ->getArguments ( ));
2676+ $ this ->assertSame ('my_qdrant_store ' , $ definition ->getArgument (0 ));
26762677 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
26772678 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2678- $ this ->assertSame ('my_qdrant_store ' , $ definition ->getArgument (3 ));
2679+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2680+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
26792681 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
26802682 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2683+ $ this ->assertFalse ($ definition ->getArgument (6 ));
26812684
26822685 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
26832686 $ this ->assertSame ([
@@ -2691,10 +2694,7 @@ public function testQdrantStoreCanBeConfigured()
26912694 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
26922695 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
26932696 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2694- }
26952697
2696- public function testQdrantStoreWithCustomCollectionCanBeConfigured ()
2697- {
26982698 $ container = $ this ->buildContainer ([
26992699 'ai ' => [
27002700 'store ' => [
@@ -2712,17 +2712,19 @@ public function testQdrantStoreWithCustomCollectionCanBeConfigured()
27122712 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27132713
27142714 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2715+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
27152716 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2716-
27172717 $ this ->assertTrue ($ definition ->isLazy ());
2718- $ this -> assertCount ( 6 , $ definition -> getArguments ());
2719- $ this ->assertInstanceOf (Reference::class , $ definition ->getArgument ( 0 ));
2720- $ this ->assertSame ('http_client ' , ( string ) $ definition ->getArgument (0 ));
2718+
2719+ $ this ->assertCount ( 7 , $ definition ->getArguments ( ));
2720+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
27212721 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
27222722 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2723- $ this ->assertSame ('foo ' , $ definition ->getArgument (3 ));
2723+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2724+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
27242725 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
27252726 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2727+ $ this ->assertFalse ($ definition ->getArgument (6 ));
27262728
27272729 $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
27282730 $ this ->assertSame ([
@@ -2736,10 +2738,7 @@ public function testQdrantStoreWithCustomCollectionCanBeConfigured()
27362738 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
27372739 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
27382740 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2739- }
27402741
2741- public function testQdrantStoreWithAsyncCanBeConfigured ()
2742- {
27432742 $ container = $ this ->buildContainer ([
27442743 'ai ' => [
27452744 'store ' => [
@@ -2758,15 +2757,62 @@ public function testQdrantStoreWithAsyncCanBeConfigured()
27582757 $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27592758
27602759 $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2760+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
27612761 $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2762+ $ this ->assertTrue ($ definition ->isLazy ());
2763+
2764+ $ this ->assertCount (7 , $ definition ->getArguments ());
2765+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
2766+ $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
2767+ $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2768+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2769+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
2770+ $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
2771+ $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2772+ $ this ->assertTrue ($ definition ->getArgument (6 ));
2773+
2774+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
2775+ $ this ->assertSame ([
2776+ ['interface ' => StoreInterface::class],
2777+ ['interface ' => ManagedStoreInterface::class],
2778+ ], $ definition ->getTag ('proxy ' ));
2779+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
2780+
2781+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_qdrant_store ' ));
2782+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myQdrantStore ' ));
2783+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
2784+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
2785+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2786+
2787+ $ container = $ this ->buildContainer ([
2788+ 'ai ' => [
2789+ 'store ' => [
2790+ 'qdrant ' => [
2791+ 'my_qdrant_store ' => [
2792+ 'endpoint ' => 'http://127.0.0.1:8000 ' ,
2793+ 'api_key ' => 'test ' ,
2794+ 'collection_name ' => 'foo ' ,
2795+ 'async ' => true ,
2796+ 'http_client ' => 'http_client ' ,
2797+ ],
2798+ ],
2799+ ],
2800+ ],
2801+ ]);
2802+
2803+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
27622804
2805+ $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2806+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
2807+ $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
27632808 $ this ->assertTrue ($ definition ->isLazy ());
2809+
27642810 $ this ->assertCount (7 , $ definition ->getArguments ());
2765- $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
2766- $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (0 ));
2811+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
27672812 $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
27682813 $ this ->assertSame ('test ' , $ definition ->getArgument (2 ));
2769- $ this ->assertSame ('foo ' , $ definition ->getArgument (3 ));
2814+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2815+ $ this ->assertSame ('http_client ' , (string ) $ definition ->getArgument (3 ));
27702816 $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
27712817 $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
27722818 $ this ->assertTrue ($ definition ->getArgument (6 ));
@@ -2783,6 +2829,49 @@ public function testQdrantStoreWithAsyncCanBeConfigured()
27832829 $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
27842830 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
27852831 $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
2832+
2833+ $ container = $ this ->buildContainer ([
2834+ 'ai ' => [
2835+ 'store ' => [
2836+ 'qdrant ' => [
2837+ 'my_qdrant_store ' => [
2838+ 'collection_name ' => 'foo ' ,
2839+ 'http_client ' => 'scoped_http_client ' ,
2840+ ],
2841+ ],
2842+ ],
2843+ ],
2844+ ]);
2845+
2846+ $ this ->assertTrue ($ container ->hasDefinition ('ai.store.qdrant.my_qdrant_store ' ));
2847+
2848+ $ definition = $ container ->getDefinition ('ai.store.qdrant.my_qdrant_store ' );
2849+ $ this ->assertSame ([StoreFactory::class, 'create ' ], $ definition ->getFactory ());
2850+ $ this ->assertSame (QdrantStore::class, $ definition ->getClass ());
2851+ $ this ->assertTrue ($ definition ->isLazy ());
2852+
2853+ $ this ->assertCount (7 , $ definition ->getArguments ());
2854+ $ this ->assertSame ('foo ' , $ definition ->getArgument (0 ));
2855+ $ this ->assertSame ('http://127.0.0.1:8000 ' , $ definition ->getArgument (1 ));
2856+ $ this ->assertNull ($ definition ->getArgument (2 ));
2857+ $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (3 ));
2858+ $ this ->assertSame ('scoped_http_client ' , (string ) $ definition ->getArgument (3 ));
2859+ $ this ->assertSame (1536 , $ definition ->getArgument (4 ));
2860+ $ this ->assertSame ('Cosine ' , $ definition ->getArgument (5 ));
2861+ $ this ->assertFalse ($ definition ->getArgument (6 ));
2862+
2863+ $ this ->assertTrue ($ definition ->hasTag ('proxy ' ));
2864+ $ this ->assertSame ([
2865+ ['interface ' => StoreInterface::class],
2866+ ['interface ' => ManagedStoreInterface::class],
2867+ ], $ definition ->getTag ('proxy ' ));
2868+ $ this ->assertTrue ($ definition ->hasTag ('ai.store ' ));
2869+
2870+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $my_qdrant_store ' ));
2871+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $myQdrantStore ' ));
2872+ $ this ->assertTrue ($ container ->hasAlias ('. ' .StoreInterface::class.' $qdrant_my_qdrant_store ' ));
2873+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class.' $qdrantMyQdrantStore ' ));
2874+ $ this ->assertTrue ($ container ->hasAlias (StoreInterface::class));
27862875 }
27872876
27882877 public function testRedisStoreCanBeConfigured ()
0 commit comments