|
51 | 51 | use Symfony\AI\Platform\Bridge\DockerModelRunner\PlatformFactory as DockerModelRunnerPlatformFactory; |
52 | 52 | use Symfony\AI\Platform\Bridge\ElevenLabs\PlatformFactory as ElevenLabsPlatformFactory; |
53 | 53 | use Symfony\AI\Platform\Bridge\Gemini\PlatformFactory as GeminiPlatformFactory; |
| 54 | +use Symfony\AI\Platform\Bridge\HuggingFace\PlatformFactory as HuggingFacePlatformFactory; |
54 | 55 | use Symfony\AI\Platform\Bridge\LmStudio\PlatformFactory as LmStudioPlatformFactory; |
55 | 56 | use Symfony\AI\Platform\Bridge\Mistral\PlatformFactory as MistralPlatformFactory; |
56 | 57 | use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory as OllamaPlatformFactory; |
@@ -397,6 +398,27 @@ private function processPlatformConfig(string $type, array $platform, ContainerB |
397 | 398 | return; |
398 | 399 | } |
399 | 400 |
|
| 401 | + if ('huggingface' === $type) { |
| 402 | + $platformId = 'ai.platform.huggingface'; |
| 403 | + $definition = (new Definition(Platform::class)) |
| 404 | + ->setFactory(HuggingFacePlatformFactory::class.'::create') |
| 405 | + ->setLazy(true) |
| 406 | + ->addTag('proxy', ['interface' => PlatformInterface::class]) |
| 407 | + ->setArguments([ |
| 408 | + $platform['api_key'], |
| 409 | + $platform['provider'], |
| 410 | + new Reference($platform['http_client'], ContainerInterface::NULL_ON_INVALID_REFERENCE), |
| 411 | + new Reference('ai.platform.model_catalog.huggingface'), |
| 412 | + new Reference('ai.platform.contract.huggingface'), |
| 413 | + new Reference('event_dispatcher'), |
| 414 | + ]) |
| 415 | + ->addTag('ai.platform', ['name' => 'huggingface']); |
| 416 | + |
| 417 | + $container->setDefinition($platformId, $definition); |
| 418 | + |
| 419 | + return; |
| 420 | + } |
| 421 | + |
400 | 422 | if ('vertexai' === $type && isset($platform['location'], $platform['project_id'])) { |
401 | 423 | if (!class_exists(ApplicationDefaultCredentials::class)) { |
402 | 424 | throw new RuntimeException('For using the Vertex AI platform, google/auth package is required. Try running "composer require google/auth".'); |
|
0 commit comments