Repository navigation
fix(models): pass selected models into verify and catch constructor errors - #17132
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughProvider verification now accepts ChangesProvider verification alignment
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant InstanceCard
participant useVerifyProvider
participant ProviderAPI
participant verify_api_key
participant ModelMeta
participant CapabilityVerifier
InstanceCard->>useVerifyProvider: provide selected models and URL fields
useVerifyProvider->>ProviderAPI: submit model_info and normalized base_url
ProviderAPI->>verify_api_key: verify credentials and model capabilities
verify_api_key->>ModelMeta: fetch models when local catalog is empty
ModelMeta-->>verify_api_key: return model list or failure
verify_api_key->>CapabilityVerifier: initialize and verify capability models
CapabilityVerifier-->>verify_api_key: return capability outcomes
verify_api_key-->>ProviderAPI: preserve successful per-model statuses
ProviderAPI-->>InstanceCard: return verification result
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@api/apps/services/provider_api_service.py`:
- Around line 664-667: Preserve successful verification results when processing
multiple capability types for the same model. In the downstream assignment
within the model verification loop, update the FAIL path to write
ModelVerifyStatusEnum.FAIL only when model_verify_result does not already
contain SUCCESS for llm["llm_name"], while leaving successful assignments
unchanged.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 9a7b68da-4111-4574-9d85-57b173fe1618
📒 Files selected for processing (7)
api/apps/restful_apis/provider_api.pyapi/apps/services/provider_api_service.pyweb/src/pages/user-setting/setting-model/instance-card/hooks.tsxweb/src/pages/user-setting/setting-model/instance-card/provider-instance-card.tsxweb/src/pages/user-setting/setting-model/provider-schema/field-config/generic-api-key-config.tsweb/src/pages/user-setting/setting-model/provider-schema/field-config/local-llm-configs.tsweb/src/pages/user-setting/setting-model/provider-schema/field-config/provider-config-map.ts
Note after #17158#17158 already landed the frontend What remains here is the Verify path for local / OpenAI-compatible providers (e.g. VLLM):
Happy to retitle / trim the description to focus on Verify if that helps review. |
…er type fail Two remaining verify-path fixes after infiniflow#17158 (api_base -> base_url rename) and infiniflow#17364/infiniflow#17397 (empty-catalog remote model discovery) landed on main: - useVerifyProvider now accepts a modelInfoRef carrying the models selected in the List-models picker (not registered as form fields) and folds them into the verify payload, so local/compatible providers no longer verify against an empty model_info. - _record_model_verify_failure records FAIL without overwriting a prior SUCCESS for the same llm_name. model_info is unrolled into one factory_llms entry per capability type, so a later type failure must not erase an earlier successful capability result. - Wrap Embedding/Chat model construction in try/except so an init failure is recorded as a per-model FAIL instead of aborting the whole verify. Co-authored-by: Cursor <[email protected]>
eec7389 to
48e9247
Compare
Lynn-Inf
left a comment
There was a problem hiding this comment.
I think a later verification failure should be able to overwrite a previous success — since API key balance or model availability may change over time, the latest status should always be reflected to the user.
As for the frontend changes, I'll ask my colleague @dcc123456 to take over the review on that side.
Address Lynn-Inf's review: the latest verification status should always be shown. Keep constructor try/except and passing List-models selection into Verify. Co-authored-by: Cursor <[email protected]>
|
Thanks @Lynn-Inf — agreed. The SUCCESS-preservation was meant to avoid a later capability-type failure in the same verify call (unrolled Dropped Still in this PR (not in v0.27.0 /
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #17132 +/- ##
==========================================
- Coverage 94.56% 90.65% -3.91%
==========================================
Files 10 10
Lines 717 717
Branches 118 118
==========================================
- Hits 678 650 -28
- Misses 25 39 +14
- Partials 14 28 +14 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Summary
Two remaining verify-path fixes after #17158 (
api_base->base_urlrename) and #17364 / #17397 (empty-catalog remote model discovery) landed onmain.The original scope of this PR also covered "Save all dropping the URL" and "Verify against an empty factory catalog". Those two sides are now fully addressed upstream, so this PR is trimmed to the parts that are not yet on
main(including v0.27.0):1. Pass selected models from the List-models picker into Verify
useVerifyProvidernow accepts amodelInfoRefcarrying the models selected in the List-models picker (which are not registered as form fields) and folds them into the verify payload. Without this, verify payloads for local / OpenAI-compatible providers often omitmodel_info, so the backend cannot verify the user's actual selection.2. Guard Embedding/Chat model construction
Wrap
EmbeddingModel[...]/ChatModel[...]construction intry/exceptso an init failure is recorded as a per-modelFAIL(with a message) instead of aborting the wholeverify_api_keycall.Review follow-up
Dropped SUCCESS-preserving failure recording per @Lynn-Inf: a later verification failure now overwrites a previous success so the latest status is always shown.
Already covered upstream (dropped from this PR)
api_basealias on create/update/verify and the frontendapi_base->base_urlrename -> Update from api_base to base_url #17158get_model_listdiscovery, GoListModelsdiscovery) -> Fix: verify remote model when model_list in argument and factory_llms is empty #17364 and Fix: simplify verify go #17397Test plan
base_urland API key.model_info).SUCCESSfor the samellm_name.