Description
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 toclassName
and allow users to passSymfony/AI\Platform\Bridge\Mistral\Embeddings
as value. InAIExtension
we 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