The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(providers): restore the trimmed api_mode gates lost in the rebase onto #116853
teknium12dda23394658
diff --git a/hermes_cli/providers.py b/hermes_cli/providers.pyindex 6e1d233b1f5..f788b17d175 100644--- a/hermes_cli/providers.py+++ b/hermes_cli/providers.py@@ -3,7 +3,6 @@from __future__ import annotationsimport logging-import sysfrom dataclasses import dataclassfrom typing import Any, Dict, List, Optional, Tuple@@ -246,34 +245,6 @@ def _plugin_profile_pdef(name: str) -> Optional[ProviderDef]:auth_type=prof.auth_type or "api_key", source="plugin-profile")-def _registry_knows(api_mode: str) -> bool:- """True when ``api_mode`` names a transport someone registered.-- Reads the registry through ``agent.transports`` — but ONLY if that module is- already imported, and never by importing it here. This function is reached- from ``determine_api_mode``, which provider discovery itself calls while the- registry is being populated; pulling ``agent.transports`` at that moment- re-enters discovery and the nested call sees a half-built provider list- (observed live: a plugin profile absent from ``PROVIDER_REGISTRY``, so it- reported unauthenticated and disappeared from the model picker). When the- module is not loaded yet the caller is mid-discovery and the in-tree names- are the only ones that can be known anyway.- """- if not api_mode:- return False- if api_mode in TRANSPORT_TO_API_MODE:- return True- module = sys.modules.get("agent.transports")- if module is None:- return False- return api_mode in module.registered_api_modes()---def is_registered_api_mode(api_mode: str) -> bool:- """Public form of :func:`_registry_knows`, for callers outside this module."""- return _registry_knows(api_mode)--def get_label(provider_id: str) -> str:"""Human-readable display name: label override, else models.dev name, else the id."""canonical = normalize_provider(provider_id)@@ -408,13 +379,11 @@ def determine_api_mode(provider: str, base_url: str = "", model: str = "") -> streturn nous_api_mode(model)pdef = get_provider(provider)if pdef is not None:- # A plugin profile's transport IS its api_mode (e.g. "something_functions"),- # table has no entry for — it only names the in-tree overlays' transports. Reading- # the table alone degraded every plugin-supplied dialect to chat_completions here,- # so the plugin's transport was never selected. A transport that is already a- # registered api_mode passes through unchanged.- return TRANSPORT_TO_API_MODE.get(pdef.transport) or (- pdef.transport if _registry_knows(pdef.transport) else "chat_completions")+ if pdef.transport in TRANSPORT_TO_API_MODE:+ return TRANSPORT_TO_API_MODE[pdef.transport]+ # A plugin profile's transport IS its api_mode when a plugin registered that dialect.+ from agent.transports import registered_api_modes+ return pdef.transport if pdef.transport in registered_api_modes() else "chat_completions"if provider == "bedrock":return "bedrock_converse"return "chat_completions"