|
25 | 25 | use PhpLlm\LlmChain\Platform\Bridge\Meta\Llama;
|
26 | 26 | use PhpLlm\LlmChain\Platform\Bridge\Mistral\Mistral;
|
27 | 27 | use PhpLlm\LlmChain\Platform\Bridge\Mistral\PlatformFactory as MistralPlatformFactory;
|
28 |
| -use PhpLlm\LlmChain\Platform\Bridge\OpenAI\Embeddings; |
29 | 28 | use PhpLlm\LlmChain\Platform\Bridge\OpenAI\GPT;
|
30 | 29 | use PhpLlm\LlmChain\Platform\Bridge\OpenAI\PlatformFactory as OpenAIPlatformFactory;
|
31 | 30 | use PhpLlm\LlmChain\Platform\Bridge\OpenRouter\PlatformFactory as OpenRouterPlatformFactory;
|
32 |
| -use PhpLlm\LlmChain\Platform\Bridge\Voyage\Voyage; |
33 | 31 | use PhpLlm\LlmChain\Platform\Model;
|
34 | 32 | use PhpLlm\LlmChain\Platform\ModelClientInterface;
|
35 | 33 | use PhpLlm\LlmChain\Platform\Platform;
|
@@ -457,14 +455,13 @@ private function processStoreConfig(string $type, array $stores, ContainerBuilde
|
457 | 455 | */
|
458 | 456 | private function processEmbedderConfig(int|string $name, array $config, ContainerBuilder $container): void
|
459 | 457 | {
|
460 |
| - ['name' => $modelName, 'version' => $version, 'options' => $options] = $config['model']; |
| 458 | + ['className' => $modelClassName, 'version' => $version, 'options' => $options] = $config['model']; |
461 | 459 |
|
462 |
| - $modelClass = match (strtolower((string) $modelName)) { |
463 |
| - 'embeddings' => Embeddings::class, |
464 |
| - 'voyage' => Voyage::class, |
465 |
| - default => throw new \InvalidArgumentException(sprintf('Model "%s" is not supported.', $modelName)), |
466 |
| - }; |
467 |
| - $modelDefinition = (new Definition($modelClass)); |
| 460 | + if (!is_a($modelClassName, Model::class, true)) { |
| 461 | + throw new \InvalidArgumentException(sprintf('"%s" class is not extending PhpLlm\LlmChain\Platform\Model.', $modelClassName)); |
| 462 | + } |
| 463 | + |
| 464 | + $modelDefinition = (new Definition((string) $modelClassName)); |
468 | 465 | if (null !== $version) {
|
469 | 466 | $modelDefinition->setArgument('$name', $version);
|
470 | 467 | }
|
|
0 commit comments