mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-08 03:01:47 +00:00
feat(providers): make all 33 providers pluggable under plugins/model-providers/
Every provider profile is now a self-contained plugin under plugins/model-providers/<name>/, mirroring the plugins/platforms/ pattern established for IRC and Teams. The ProviderProfile ABC stays in providers/; the per-provider profile data moves out. - plugins/model-providers/<name>/__init__.py calls register_provider() - plugins/model-providers/<name>/plugin.yaml declares kind: model-provider - providers/__init__.py._discover_providers() lazily scans bundled plugins then $HERMES_HOME/plugins/model-providers/<name>/ (user override path) - User plugins with the same name override bundled ones (last-writer-wins in register_provider) - Legacy providers/<name>.py layout still supported for back-compat with out-of-tree editable installs - Hermes PluginManager: new kind=model-provider; skipped like memory plugins (providers/ discovery owns them); standalone plugins with register_provider+ProviderProfile in their __init__.py auto-coerce to this kind (same heuristic as memory providers) - skip_names extended to include 'model-providers' so the general PluginManager doesn't double-scan the category - 4 new tests in tests/providers/test_plugin_discovery.py covering bundled discovery, user override, and general-loader isolation - Docs updated: website/docs/developer-guide/adding-providers.md, provider-runtime.md, providers/README.md, plugins/model-providers/README.md No API break: auth.py / config.py / doctor.py / models.py / runtime_provider.py / model_metadata.py / auxiliary_client.py / chat_completions.py / run_agent.py all still consume providers via get_provider_profile() / list_providers() — they just now see plugin-discovered entries instead of pkgutil-iterated ones. Third parties can now drop a single directory into ~/.hermes/plugins/model-providers/<name>/ to add or override an inference provider without touching the repo.
This commit is contained in:
parent
20a4f79ed1
commit
9022804d78
63 changed files with 585 additions and 309 deletions
|
|
@ -99,10 +99,12 @@ If your provider is just an OpenAI-compatible endpoint that authenticates with a
|
|||
|
||||
All you need is:
|
||||
|
||||
1. A file in `providers/` (e.g. `providers/myprovider.py`) that calls `register_provider()` with the provider config.
|
||||
2. That's it. `auth.py` auto-registers every file in `providers/` at startup via a module-level import sweep.
|
||||
1. A plugin directory under `plugins/model-providers/<your-provider>/` containing:
|
||||
- `__init__.py` — calls `register_provider(profile)` at module-level
|
||||
- `plugin.yaml` — manifest (name, kind: model-provider, version, description)
|
||||
2. That's it. Provider plugins auto-load the first time anything calls `get_provider_profile()` or `list_providers()` — bundled plugins (this repo) and user plugins at `$HERMES_HOME/plugins/model-providers/` both get picked up.
|
||||
|
||||
When you add a `providers/*.py` file and call `register_provider()`, the following wire up automatically:
|
||||
When you add a plugin and it calls `register_provider()`, the following wire up automatically:
|
||||
|
||||
1. `PROVIDER_REGISTRY` entry in `auth.py` (credential resolution, env-var lookup)
|
||||
2. `api_mode` set to `chat_completions`
|
||||
|
|
@ -117,7 +119,9 @@ When you add a `providers/*.py` file and call `register_provider()`, the followi
|
|||
11. `HERMES_INFERENCE_PROVIDER` env-var override accepts the provider id
|
||||
12. Fallback model activation can switch into the provider cleanly
|
||||
|
||||
See `providers/nvidia.py` or `providers/gmi.py` as a template.
|
||||
User plugins at `$HERMES_HOME/plugins/model-providers/<name>/` override bundled plugins of the same name (last-writer-wins in `register_provider()`) — so third parties can monkey-patch or replace any built-in profile without editing the repo.
|
||||
|
||||
See `plugins/model-providers/nvidia/` or `plugins/model-providers/gmi/` as a template, and `plugins/model-providers/README.md` for the full contract.
|
||||
|
||||
## Full path: OAuth and complex providers
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue