Avoid listing models for explicit text model IDs#231
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #231 +/- ##
============================================
+ Coverage 88.12% 88.26% +0.13%
- Complexity 1213 1225 +12
============================================
Files 60 61 +1
Lines 3934 3962 +28
============================================
+ Hits 3467 3497 +30
+ Misses 467 465 -2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
4b2547d to
3e79f62
Compare
The OpenAI-compatible abstraction is about HTTP/JSON shape, not OpenAI's model namespace. Drop the gpt-/o3/dall-e prefix gating and the synthetic text-generation metadata override; the per-provider override belongs in ai-provider-for-openai (and similar repos for other compatible providers). The generic createModelMetadataForExplicitModelId() hook on AbstractApiBasedModelMetadataDirectory is unchanged so providers can still opt in.
felixarntz
left a comment
There was a problem hiding this comment.
@chubes4 While this addresses the reported concern, it creates data inconsistencies when considering the API surface of this class holistically.
I think there's a path forward, but it requires some modifications in the approach.
|
Updated this to address the consistency concern:
Verified with:
|
Summary
getModelMetadata(),hasModelMetadata(), and listed model metadata for matching listed IDs.Fixes #230.
Why
Explicit provider/model selection currently calls the provider model-list endpoint before the model can be instantiated. For providers that accept explicit/current model IDs, that means
getProviderModel( 'openai', 'gpt-5.4' )can fail on a transientGET /modelsissue before the actual generation endpoint has a chance to validate the explicitly requested model.Testing
composer test -- --filter AbstractApiBasedModelMetadataDirectoryTestcomposer lintAI assistance