|
27 | 27 | use Symfony\AI\Store\Document\Loader\InMemoryLoader; |
28 | 28 | use Symfony\AI\Store\Document\Transformer\TextTrimTransformer; |
29 | 29 | use Symfony\AI\Store\Document\Vectorizer; |
| 30 | +use Symfony\AI\Store\Document\VectorizerInterface; |
| 31 | +use Symfony\AI\Store\IndexerInterface; |
30 | 32 | use Symfony\AI\Store\StoreInterface; |
31 | 33 | use Symfony\Component\Clock\ClockInterface; |
32 | 34 | use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; |
@@ -1784,6 +1786,25 @@ public function testVectorizerWithLoggerInjection() |
1784 | 1786 | $this->assertSame(ContainerInterface::IGNORE_ON_INVALID_REFERENCE, $arguments[2]->getInvalidBehavior()); |
1785 | 1787 | } |
1786 | 1788 |
|
| 1789 | + public function testInjectionVectorizerAliasIsRegistered() |
| 1790 | + { |
| 1791 | + $container = $this->buildContainer([ |
| 1792 | + 'ai' => [ |
| 1793 | + 'vectorizer' => [ |
| 1794 | + 'test' => [ |
| 1795 | + 'model' => 'text-embedding-3-small?dimensions=512', |
| 1796 | + ], |
| 1797 | + 'another' => [ |
| 1798 | + 'model' => 'text-embedding-3-small?dimensions=512', |
| 1799 | + ], |
| 1800 | + ], |
| 1801 | + ], |
| 1802 | + ]); |
| 1803 | + |
| 1804 | + $this->assertTrue($container->hasAlias(VectorizerInterface::class.' $test')); |
| 1805 | + $this->assertTrue($container->hasAlias(VectorizerInterface::class.' $another')); |
| 1806 | + } |
| 1807 | + |
1787 | 1808 | public function testIndexerWithConfiguredVectorizer() |
1788 | 1809 | { |
1789 | 1810 | $container = $this->buildContainer([ |
@@ -2262,6 +2283,36 @@ public function testIndexerWithSourceFiltersAndTransformers() |
2262 | 2283 | $this->assertSame('logger', (string) $arguments[6]); |
2263 | 2284 | } |
2264 | 2285 |
|
| 2286 | + public function testInjectionIndexerAliasIsRegistered() |
| 2287 | + { |
| 2288 | + $container = $this->buildContainer([ |
| 2289 | + 'ai' => [ |
| 2290 | + 'store' => [ |
| 2291 | + 'memory' => [ |
| 2292 | + 'my_store' => [], |
| 2293 | + ], |
| 2294 | + ], |
| 2295 | + 'indexer' => [ |
| 2296 | + 'my_indexer' => [ |
| 2297 | + 'loader' => InMemoryLoader::class, |
| 2298 | + 'transformers' => [], |
| 2299 | + 'vectorizer' => 'my_vectorizer_service', |
| 2300 | + 'store' => 'ai.store.memory.my_store', |
| 2301 | + ], |
| 2302 | + 'another' => [ |
| 2303 | + 'loader' => InMemoryLoader::class, |
| 2304 | + 'transformers' => [], |
| 2305 | + 'vectorizer' => 'my_vectorizer_service', |
| 2306 | + 'store' => 'ai.store.memory.my_store', |
| 2307 | + ], |
| 2308 | + ], |
| 2309 | + ], |
| 2310 | + ]); |
| 2311 | + |
| 2312 | + $this->assertTrue($container->hasAlias(IndexerInterface::class.' $myIndexer')); |
| 2313 | + $this->assertTrue($container->hasAlias(IndexerInterface::class.' $another')); |
| 2314 | + } |
| 2315 | + |
2265 | 2316 | public function testValidMultiAgentConfiguration() |
2266 | 2317 | { |
2267 | 2318 | $container = $this->buildContainer([ |
|
0 commit comments