feat(provider): support provider-native TTS / image / vision backends#9954
Closed
kapelame wants to merge 1 commit into
Closed
feat(provider): support provider-native TTS / image / vision backends#9954kapelame wants to merge 1 commit into
kapelame wants to merge 1 commit into
Conversation
7bb5274 to
06d8e3a
Compare
When a chat provider exposes TTS / image / vision capabilities on the same API base and credential, the setup wizard wires them as the default tool backends and the tool dispatchers route through this module instead of the generic FAL / auxiliary-client paths. Mirrors the shape of `hermes_cli/nous_subscription.py`: one apply hook for the wizard, plus runtime helpers consumed by the tool files. MiniMax is the first registered consumer (international + CN); adding another provider is one row in `NATIVE_TOOLS_BY_PROVIDER` plus a set of request helpers. Source: - `hermes_cli/provider_native_tools.py` (new): registry, `apply_provider_native_tool_defaults` (mirror of `apply_nous_provider_defaults`), `generate_image` / `analyze_image` runtime dispatchers, `active_provider_api_root` / `native_credential_present` / `minimax_endpoint_and_key` helpers, plus the MiniMax request bindings inline in the same file — same shape as `nous_subscription.py`. - `hermes_cli/setup.py` (+26 / −1): call the generic hook beside the existing Nous branch; skip the interactive TTS prompt when the active provider already owns `tts`. - `tools/image_generation_tool.py` (+24): early-call the native dispatcher, fall through on `None`. `check_fn` accepts the native credential as meeting the requirement. Zero MiniMax mentions. - `tools/vision_tools.py` (+28): early-call the native dispatcher when the user hasn't pinned `auxiliary.vision.provider`. Zero MiniMax mentions. - `tools/tts_tool.py` (+13 / −1): existing `_generate_minimax_tts` derives its URL + key from `minimax_endpoint_and_key` so CN users (`minimax-cn` → `api.minimaxi.com`) and the correct regional key are used automatically; falls back to the existing international defaults otherwise. Tests (`tests/hermes_cli/test_provider_native_tools.py`, new): 47 cases — registry, alias normalisation, URL derivation, apply_defaults idempotency / override preservation, CN parity, describe_changes phrasing, credential + endpoint helpers. Design notes: - URL derivation reuses `model.base_url`, stripping the `/anthropic` chat-compat suffix. CN users who pick `minimax-cn` automatically get `api.minimaxi.com` because their `base_url` already points there. No separate `MINIMAX_API_HOST` env var. - Provider detection uses `hermes_cli.providers.normalize_provider` so hand-edited aliases (`minimax-china`, `minimax_cn`) resolve to the canonical id. - Credential selection flips on region: `minimax-cn` prefers `MINIMAX_CN_API_KEY`; `minimax` prefers `MINIMAX_API_KEY`. Either falls back to the other on absence. - Vision uses runtime dispatch (no persisted config value) because chat models on `/anthropic/v1/messages` don't accept multimodal content; vision is served by `/v1/coding_plan/vlm` (the same endpoint MiniMax's official `mmx vision` CLI targets), which takes a non-chat request shape. Zero new pip dependencies (stdlib only). Zero behaviour change for users on chat providers not registered in `NATIVE_TOOLS_BY_PROVIDER`.
48ca8a3 to
db126c5
Compare
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.
Summary
Adds a provider-agnostic hook that wires TTS / image / vision tool defaults to the active chat provider when it serves those capabilities natively on the same credential. Mirrors
apply_nous_provider_defaults.MiniMax is the first registered consumer (international + CN). Adding another provider is one row in
NATIVE_TOOLS_BY_PROVIDERplus a set of request helpers.Files Changed
hermes_cli/provider_native_tools.pyapply_provider_native_tool_defaults, runtime dispatchers (generate_image,analyze_image), shared helpers (active_provider_api_root,native_credential_present,minimax_endpoint_and_key), MiniMax request bindingshermes_cli/setup.pyttstools/image_generation_tool.pyNone. Zero MiniMax mentionstools/vision_tools.pyauxiliary.vision.provider. Zero MiniMax mentionstools/tts_tool.py_generate_minimax_ttsderives URL + key fromminimax_endpoint_and_keysominimax-cnusers hitapi.minimaxi.comwith the CN key automaticallytests/hermes_cli/test_provider_native_tools.pyDesign Notes
model.base_url, stripping the/anthropicchat-compat suffix. CN users who pickminimax-cngetapi.minimaxi.comautomatically — no separate env var.minimax-cn→MINIMAX_CN_API_KEYfirst, falls back toMINIMAX_API_KEY.hermes_cli.providers.normalize_providerso hand-edited aliases (minimax-china,minimax_cn) resolve to the canonical id./anthropic/v1/messagesdon't accept multimodal content; vision is served by/v1/coding_plan/vlm, the same endpoint MiniMax's officialmmx visionCLI targets.Test Plan
Live end-to-end on both
api.minimax.ioandapi.minimaxi.comwith Token Plan keys: TTS, image, vision all return correctly.Zero new pip dependencies (stdlib only). Zero behaviour change for chat providers not in
NATIVE_TOOLS_BY_PROVIDER.