Given this user configuration:
ai:
indexer:
default:
platform: 'symfony_ai.platform.mistral'
model:
name: 'Embeddings'
version: 'mistral-embed'
If the embeddings model name is "Embeddings" (as is the case for OpenAI, Mistral and Google), the model object injected in Embedder object will always be Symfony\AI\Platform\Bridge\OpenAI\Embeddings due to https://github.com/symfony/ai/blob/main/src/ai-bundle/src/DependencyInjection/AIExtension.php#L474
I see 3 solutions to fix this issue:
- Force to (prefix|suffix) Embeddings model name with the platform name (e.g.
MistralEmbeddings, OpenAIEmbeddings)
- Check the platform name to determine the Embeddings class to set in Definition
- Change the
name config entry to className and allow users to pass Symfony/AI\Platform\Bridge\Mistral\Embeddings as value. In AIExtension we could check the class existence and if it extends Symfony\AI\Platform\Model.
@chr-hertel you probably have a clear idea of what is the best solution here, maybe a third one?
Mirror issue of php-llm/llm-chain-bundle#98
Given this user configuration:
If the embeddings model name is "Embeddings" (as is the case for OpenAI, Mistral and Google), the model object injected in
Embedderobject will always beSymfony\AI\Platform\Bridge\OpenAI\Embeddingsdue to https://github.com/symfony/ai/blob/main/src/ai-bundle/src/DependencyInjection/AIExtension.php#L474I see 3 solutions to fix this issue:
MistralEmbeddings,OpenAIEmbeddings)nameconfig entry toclassNameand allow users to passSymfony/AI\Platform\Bridge\Mistral\Embeddingsas value. InAIExtensionwe could check the class existence and if it extendsSymfony\AI\Platform\Model.@chr-hertel you probably have a clear idea of what is the best solution here, maybe a third one?
Mirror issue of php-llm/llm-chain-bundle#98