mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-29 01:31:41 +00:00
feat(agent): add lmstudio integration
This commit is contained in:
parent
7d4648461a
commit
214ca943ac
26 changed files with 1137 additions and 40 deletions
|
|
@ -260,6 +260,33 @@ class TestProviderPersistsAfterModelSave:
|
|||
assert model.get("default") == "minimax-m2.5"
|
||||
assert model.get("api_mode") == "anthropic_messages"
|
||||
|
||||
def test_lmstudio_provider_saved_when_selected(self, config_home, monkeypatch):
|
||||
from hermes_cli.config import load_config
|
||||
from hermes_cli.main import _model_flow_api_key_provider
|
||||
|
||||
monkeypatch.setenv("LM_API_KEY", "lm-token")
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.auth._prompt_model_selection",
|
||||
lambda models, current_model="": "publisher/model-a",
|
||||
)
|
||||
monkeypatch.setattr("hermes_cli.auth.deactivate_provider", lambda: None)
|
||||
monkeypatch.setattr(
|
||||
"hermes_cli.models.fetch_lmstudio_models",
|
||||
lambda api_key=None, base_url=None, timeout=5.0: ["publisher/model-a"],
|
||||
)
|
||||
|
||||
with patch("builtins.input", side_effect=[""]):
|
||||
_model_flow_api_key_provider(load_config(), "lmstudio", "old-model")
|
||||
|
||||
import yaml
|
||||
|
||||
config = yaml.safe_load((config_home / "config.yaml").read_text()) or {}
|
||||
model = config.get("model")
|
||||
assert isinstance(model, dict)
|
||||
assert model.get("provider") == "lmstudio"
|
||||
assert model.get("base_url") == "http://127.0.0.1:1234/v1"
|
||||
assert model.get("default") == "publisher/model-a"
|
||||
|
||||
|
||||
class TestBaseUrlValidation:
|
||||
"""Reject non-URL values in the base URL prompt (e.g. shell commands)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue