Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Conversation

@welcoMattic
Copy link
Contributor

Ref: #98

Before:

llm_chain:
    embedder:
        default:
            platform: 'llm_chain.platform.mistral'
            model:
                name: 'Embeddings'
                version: 'mistral-embed'

After

llm_chain:
    embedder:
        default:
            platform: 'llm_chain.platform.mistral'
            model:
                name: 'PhpLlm\LlmChain\Platform\Bridge\Mistral\Embeddings'
                version: 'mistral-embed'

This way, any class extending PhpLlm\LlmChain\Platform\Model can be used as embedder model, even one written by users themselves. This way, embeddings model of providers (OpenAI, Mistral, ...) can have the same class name.

@welcoMattic welcoMattic force-pushed the fix/config-embeddings-model-name branch from 4bdf0e5 to 30fbe63 Compare July 3, 2025 14:09
@welcoMattic
Copy link
Contributor Author

I didn't handle the BC here, let me know it this solution is ok. Then, I will add a BC layer to not break user's apps.

@OskarStark
Copy link
Contributor

It is ok to break BC, we don't take BC promise serious until now as we are anyway using 0.x versions

@OskarStark OskarStark changed the title fix(embedder): Use FQCN for embedder model config, to allow any Model child class fix(embedder)!: Use FQCN for embedder model config, to allow any Model child class Jul 4, 2025
@welcoMattic
Copy link
Contributor Author

@chr-hertel
Copy link
Member

Yup, that first implementation was def too stupid, true. And I guess the className thing is something that should be supported - especially when you thin about user land model classes for example.

However, looking at this config:

llm_chain:
    embedder:
        default:
            platform: 'llm_chain.platform.mistral'
            model:
                name: 'PhpLlm\LlmChain\Platform\Bridge\Mistral\Embeddings'
                version: 'mistral-embed'

This is a bit redundant, right? the service llm_chain.platform.mistral would anyways only support one embeddings class - I think we could also solve that by the Platform exposing which models (and their names) it would support. so that we would basically only chose from a subset of those classes.

WDYT?

chr-hertel added a commit to symfony/ai that referenced this pull request Jul 15, 2025
…ymfony\AI\Platform\Model` child class (welcoMattic)

This PR was merged into the main branch.

Discussion
----------

[AiBundle] Use model FQCN for indexer config, to allow any `Symfony\AI\Platform\Model` child class

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Docs?         | no <!-- required for new features -->
| Issues        | Fix #59 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

Before:

```yaml
ai:
    indexer:
        default:
            platform: 'symfony_ai.platform.mistral'
            model:
                name: 'Embeddings'
                version: 'mistral-embed'

```

After

```yaml
ai:
    indexer:
        default:
            platform: 'symfony_ai.platform.mistral'
            model:
                class: 'Symfony\AI\Platform\Bridge\Mistral\Embeddings'
                name: !php/const Symfony\AI\Platform\Bridge\Mistral\Embeddings::MISTRAL_EMBED
```

This way, any class extending `Symfony\AI\Platform\Model` can be used as embedder model, even one written by users themselves.
Embeddings model of providers (OpenAI, Mistral, Gemini, ...) can be named `Embeddings` with no issue.

---

Replace php-llm/llm-chain-bundle#99

Commits
-------

66b6cbc Use model FQCN for indexer config, to allow any Symfony\AI\Platform\Model child class
symfony-splitter pushed a commit to symfony/ai-bundle that referenced this pull request Jul 15, 2025
…ymfony\AI\Platform\Model` child class (welcoMattic)

This PR was merged into the main branch.

Discussion
----------

[AiBundle] Use model FQCN for indexer config, to allow any `Symfony\AI\Platform\Model` child class

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Docs?         | no <!-- required for new features -->
| Issues        | Fix symfony/ai#59 <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License       | MIT

Before:

```yaml
ai:
    indexer:
        default:
            platform: 'symfony_ai.platform.mistral'
            model:
                name: 'Embeddings'
                version: 'mistral-embed'

```

After

```yaml
ai:
    indexer:
        default:
            platform: 'symfony_ai.platform.mistral'
            model:
                class: 'Symfony\AI\Platform\Bridge\Mistral\Embeddings'
                name: !php/const Symfony\AI\Platform\Bridge\Mistral\Embeddings::MISTRAL_EMBED
```

This way, any class extending `Symfony\AI\Platform\Model` can be used as embedder model, even one written by users themselves.
Embeddings model of providers (OpenAI, Mistral, Gemini, ...) can be named `Embeddings` with no issue.

---

Replace php-llm/llm-chain-bundle#99

Commits
-------

66b6cbc Use model FQCN for indexer config, to allow any Symfony\AI\Platform\Model child class
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants