-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[Refactor] model family resolution to support non-prefixed names like Mistral #6158
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
[Refactor] model family resolution to support non-prefixed names like Mistral #6158
Conversation
2944bae to
6f7bd0a
Compare
python/packages/autogen-ext/src/autogen_ext/models/openai/_transformation/registry.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-ext/src/autogen_ext/models/openai/_openai_client.py
Outdated
Show resolved
Hide resolved
python/packages/autogen-ext/src/autogen_ext/models/openai/_transformation/registry.py
Show resolved
Hide resolved
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6158 +/- ##
==========================================
+ Coverage 77.32% 77.33% +0.01%
==========================================
Files 197 197
Lines 13797 13808 +11
==========================================
+ Hits 10669 10679 +10
- Misses 3128 3129 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…on-prefixed_names_like_Mistral
|
@ekzhu First of all, Done. 🙋♂️ Should fallback raise branches be covered by tests for Codecov?
|
…on-prefixed_names_like_Mistral
|
@ekzhu Sorry… Before the merge, there was no formatting error on my PC, but after the merge, one error was added (automatically resolved). So it’s now resolved. Ehhhhhh… Thank you for fixing it! ⸻ FYI: My typical contribution window is KST 9PM–2AM and 6AM–9AM. |
Why are these changes needed?
This PR improves how model_family is resolved when selecting a transformer from the registry.
Previously, model families were inferred using a simple prefix-based match like:
This works for cleanly prefixed models (e.g.,
gpt-4o,claude-3) but fails for models likemistral-large-latest,codestral-latest, etc., where prefix-based matching is ambiguous or misleading.To address this:
• model_family can now be passed explicitly (e.g., via ModelInfo)
• _find_model_family() is only used as a fallback when the value is "unknown"
• Transformer lookup is now more robust and predictable
• Example integration in to_oai_type() demonstrates this pattern using self._model_info["family"]
This change is required for safe support of models like Mistral and other future models that do not follow standard naming conventions.
Related issue number
Linked to discussion in #6151
Related : #6011
Checks