-
Notifications
You must be signed in to change notification settings - Fork 8
fix(embedder)!: Use FQCN for embedder model config, to allow any Model child class #99
fix(embedder)!: Use FQCN for embedder model config, to allow any Model child class #99
Conversation
4bdf0e5 to
30fbe63
Compare
|
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. |
|
It is ok to break BC, we don't take BC promise serious until now as we are anyway using 0.x versions |
|
Same behaviour could be applied to chain config: https://github.com/php-llm/llm-chain-bundle/blob/main/src/DependencyInjection/LlmChainExtension.php#L250 WDYT @OskarStark @chr-hertel? |
|
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 WDYT? |
…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
…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
Ref: #98
Before:
After
This way, any class extending
PhpLlm\LlmChain\Platform\Modelcan 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.