-
-
Notifications
You must be signed in to change notification settings - Fork 102
[Platform][Ollama] Add support for models with size in model catalog #708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
yield 'nomic-embed-text' => ['nomic-embed-text', Ollama::class, [Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STRUCTURED, Capability::INPUT_MULTIPLE]]; | ||
yield 'bge-m3' => ['bge-m3', Ollama::class, [Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STRUCTURED, Capability::INPUT_MULTIPLE]]; | ||
yield 'all-minilm' => ['all-minilm', Ollama::class, [Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STRUCTURED, Capability::INPUT_MULTIPLE]]; | ||
yield 'all-minilm:33m' => ['all-minilm:33m', Ollama::class, [Capability::INPUT_MESSAGES, Capability::OUTPUT_TEXT, Capability::OUTPUT_STRUCTURED, Capability::INPUT_MULTIPLE]]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for this model
|
||
return [ | ||
'name' => $actualModelName, | ||
'baseName' => explode(':', $actualModelName, 2)[0], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need the basename?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the basename fallback to avoid duplicating identical model registrations for every size suffix (e.g. qwen3:32b
, qwen3:64m
).
Almost every model supported by OLLAMA contains variants with size suffix. For example, the qwen3 model supports over 50 different variants. https://ollama.com/library/qwen3/tags
Registering each one of them would lead to a huge increase of the catalog
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, but what are you doing with the baseName in user land?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don’t expose or use the baseName in user land.
It’s only an internal fallback inside AbstractModelCatalog::getModel()
.
From the perspective of user land, they always pass the full name (e.g. qwen3:32b
) and get back a model with that exact name. The baseName is just used internally to resolve the model configuration when the variant isn’t explicitly registered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'baseName' => explode(':', $actualModelName, 2)[0], |
so we don't need it here, right? we will end up with model name qwen3:32b
which is fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since :size
suffixes are not a cross-vendor pattern (only use Ollama), it might be more appropriate to keep the fallback logic in the Symfony\AI\Platform\Bridge\Ollama\ModelCatalog::getModel()
(like in the first version of this PR 853d902).
Ah now I get it, it is working, but you need to create the model to be able to use it, which is fine IMHO. the "sizes" are not common enough through all platforms IMHO. So you should define the model on your end and use it |
From the user perspective you still need to explicitly register the model you want to use. The fallback only helps when a variant isn’t registered but the base model is. |
Also worth mentioning: before the recent refactoring (when |
Fixed in #712 with a slightly different approach. Thanks for proposing. |
This PR extends the
Ollama\ModelCatalog
to support model names that include asize
suffix after a colon (e.g.qwen3:32b
,all-minilm:33m
).getModel()
method now resolves the model by its base name (before the:
suffix).