fix(runtime_provider): resolve named providers from config.yaml providers: dict (v12+)#5956
Closed
mfgering wants to merge 4 commits into
Closed
fix(runtime_provider): resolve named providers from config.yaml providers: dict (v12+)#5956mfgering wants to merge 4 commits into
mfgering wants to merge 4 commits into
Conversation
… dict (v12+) _get_named_custom_provider() previously only read the legacy custom_providers list format. Since config v12, providers are stored as a dict under the 'providers:' key (with 'api' for URL and 'transport' for api_mode). This meant named local providers like llama-server could only be resolved by hardcoding them as aliases in auth.py. Now _get_named_custom_provider() first checks the providers: dict, matching on the dict key or the optional display name field. Falls through to the legacy list for backward compatibility. Reverts the llama-server/llama_server aliases from auth.py — they are no longer needed since the provider entry in config.yaml handles it.
…oviders: dict (v12+)" This reverts commit 7185f2f.
…ders: dict (v12+)
_get_named_custom_provider() only read the legacy custom_providers list.
Since config v12, providers are stored as a dict under the 'providers:'
key (migrated by _run_migration()). Local endpoints configured there
(e.g. llama-server, lmstudio) were silently unresolvable without adding
them as hardcoded aliases in auth.py _PROVIDER_ALIASES.
Fix: check the providers: dict first (matching on dict key or display
name, supporting both 'api'/'base_url' and 'transport'/'api_mode' field
names), then fall through to the legacy list for backward compatibility.
Both bare name ('llama-server') and explicit menu key ('custom:llama-server')
forms now resolve correctly from config.
|
Friendly bump on this PR in case it fell through the cracks \u2014 would love a review when someone has a minute. Thanks! |
Contributor
|
Thanks for the report and the fix, @mfgering! This exact bug — Automated hermes-sweeper review
Closing as already implemented on main. |
Collaborator
|
Related to merged #17901 which fixes the transport field issue. This PR goes further to also resolve the named provider lookup itself from the v12+ providers: dict. |
Collaborator
|
Related to merged #17901 which fixes transport field. This PR resolves the broader named provider lookup from v12+ providers: dict. |
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.
Problem
_get_named_custom_provider()inhermes_cli/runtime_provider.pyonly reads the legacycustom_providerslist format. Since config v12, the migration in_run_migration()moves all custom provider entries to aproviders:dict with a different field schema (apiinstead ofbase_url,transportinstead ofapi_mode).This meant any named local provider (e.g.
llama-server,lmstudio) configured via the v12providers:dict was silently unresolvable — the only workaround was to hardcode it as an alias inauth.py _PROVIDER_ALIASES.Fix
Check the
providers:dict first in_get_named_custom_provider(), matching on both the dict key and the optionalnamedisplay field. Supports both field naming conventions (api/base_urlandtransport/api_mode). Falls through to the legacycustom_providerslist for backward compatibility.Both bare name (
llama-server) and explicit menu key (custom:llama-server) forms resolve correctly.Example config.yaml
With this fix,
--provider llama-serverorprovider: llama-serverin a cron job now resolves without needing a hardcoded alias.