Skip to content

[AiBundle] OpenAI Embeddings model used no matter the platform defined on the indexed #59

Open
@welcoMattic

Description

@welcoMattic

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    AI BundleIssues & PRs about the AI integration bundleBugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions