fix(agent): resolve custom: prefix in vision provider before normalisation - #44398
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(agent): resolve custom: prefix in vision provider before normalisation#44398liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…ation When auxiliary.vision.provider is set to `custom:<name>` where <name> matches a built-in provider (e.g. `custom:minimax`), _normalize_aux_provider strips the `custom:` prefix before the named custom provider lookup, collapsing it to the bare built-in provider. The user's custom_providers entry is never consulted, causing 401 on the wrong endpoint. Fix: save the raw requested provider before normalisation in resolve_vision_provider_client and try _get_named_custom_provider with the raw `custom:<name>` before falling through to general dispatch. Fixes NousResearch#44349
Collaborator
Contributor
Author
|
Thanks for the flag @alt-glitch. Comparing the two PRs:
This PR provides more comprehensive coverage with tests and addresses the vision provider path that #13781 doesn't cover. Keeping open. |
1 task
Contributor
Author
|
Thanks for flagging @alt-glitch. Comparing the two PRs:
This PR includes regression tests verifying custom provider resolution. Keeping open for the more complete fix. |
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes
auxiliary.vision.provider: custom:<name>collapsing to the bare built-in provider when<name>matches a built-in (e.g.custom:minimax→minimax). The user'scustom_providersentry was never consulted, causing 401 on the wrong endpoint.Related Issue
Fixes #44349
Type of Change
Changes Made
agent/auxiliary_client.py: Inresolve_vision_provider_client, save the raw provider before_normalize_vision_providerstrips thecustom:prefix. When the raw name starts withcustom:, try_get_named_custom_provider(raw)before falling through to general dispatch. This ensures the user's custom_providers entry is found.tests/agent/test_auxiliary_named_custom_providers.py: 3 new tests — custom prefix resolves to named provider, unknown custom prefix returns None, custom prefix matches providers: dict format.How to Test
custom_providers: [{name: minimax, base_url: http://custom.local/v1, api_key: k}]in config.yamlauxiliary.vision.provider: custom:minimaxresolve_vision_provider_client("custom:minimax")— should use the custom endpoint, not built-in minimaxpytest tests/agent/test_auxiliary_named_custom_providers.py -xvs— all 32 tests passChecklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
agent/auxiliary_client.py(_normalize_aux_provider,resolve_vision_provider_client,_get_named_custom_provider)custom:<name>vision provider resolution path