mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
The startup warning that Nous Research Hermes 3 & 4 models are not agentic fired on any model whose name contained "hermes" anywhere, via a plain substring check. That false-positived on unrelated local Modelfiles such as `hermes-brain:qwen3-14b-ctx16k` — a tool-capable Qwen3 wrapper that happens to live under a custom "hermes" tag namespace — making the warning noise for legitimate setups. Replace the substring check with a narrow regex anchored on `^`, `/`, or `:` boundaries that only matches the real Hermes-3 / Hermes-4 chat family (e.g. `NousResearch/Hermes-3-Llama-3.1-70B`, `hermes-4-405b`, `openrouter/hermes3:70b`). Consolidate into a single helper `is_nous_hermes_non_agentic()` in `hermes_cli.model_switch` so the CLI and the canonical check don't drift, and route the duplicate inline site in `cli.HermesCLI._print_warnings()` through the helper. Add a parametrized test covering positive matches (real Hermes-3/-4 names) and a broad set of negatives (custom Modelfiles, Qwen/Claude/GPT, older Nous-Hermes-2 families, bare "hermes", empty string, and the "brain-hermes-3-impostor" boundary case).
84 lines
2.6 KiB
Python
84 lines
2.6 KiB
Python
"""Tests for the Nous-Hermes-3/4 non-agentic warning detector.
|
|
|
|
Prior to this check, the warning fired on any model whose name contained
|
|
``"hermes"`` anywhere (case-insensitive). That false-positived on unrelated
|
|
local Modelfiles such as ``hermes-brain:qwen3-14b-ctx16k`` — a tool-capable
|
|
Qwen3 wrapper that happens to live under the "hermes" tag namespace.
|
|
|
|
``is_nous_hermes_non_agentic`` should only match the actual Nous Research
|
|
Hermes-3 / Hermes-4 chat family.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import pytest
|
|
|
|
from hermes_cli.model_switch import (
|
|
_HERMES_MODEL_WARNING,
|
|
_check_hermes_model_warning,
|
|
is_nous_hermes_non_agentic,
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"model_name",
|
|
[
|
|
"NousResearch/Hermes-3-Llama-3.1-70B",
|
|
"NousResearch/Hermes-3-Llama-3.1-405B",
|
|
"hermes-3",
|
|
"Hermes-3",
|
|
"hermes-4",
|
|
"hermes-4-405b",
|
|
"hermes_4_70b",
|
|
"openrouter/hermes3:70b",
|
|
"openrouter/nousresearch/hermes-4-405b",
|
|
"NousResearch/Hermes3",
|
|
"hermes-3.1",
|
|
],
|
|
)
|
|
def test_matches_real_nous_hermes_chat_models(model_name: str) -> None:
|
|
assert is_nous_hermes_non_agentic(model_name), (
|
|
f"expected {model_name!r} to be flagged as Nous Hermes 3/4"
|
|
)
|
|
assert _check_hermes_model_warning(model_name) == _HERMES_MODEL_WARNING
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"model_name",
|
|
[
|
|
# Kyle's local Modelfile — qwen3:14b under a custom tag
|
|
"hermes-brain:qwen3-14b-ctx16k",
|
|
"hermes-brain:qwen3-14b-ctx32k",
|
|
"hermes-honcho:qwen3-8b-ctx8k",
|
|
# Plain unrelated models
|
|
"qwen3:14b",
|
|
"qwen3-coder:30b",
|
|
"qwen2.5:14b",
|
|
"claude-opus-4-6",
|
|
"anthropic/claude-sonnet-4.5",
|
|
"gpt-5",
|
|
"openai/gpt-4o",
|
|
"google/gemini-2.5-flash",
|
|
"deepseek-chat",
|
|
# Non-chat Hermes models we don't warn about
|
|
"hermes-llm-2",
|
|
"hermes2-pro",
|
|
"nous-hermes-2-mistral",
|
|
# Edge cases
|
|
"",
|
|
"hermes", # bare "hermes" isn't the 3/4 family
|
|
"hermes-brain",
|
|
"brain-hermes-3-impostor", # "3" not preceded by /: boundary
|
|
],
|
|
)
|
|
def test_does_not_match_unrelated_models(model_name: str) -> None:
|
|
assert not is_nous_hermes_non_agentic(model_name), (
|
|
f"expected {model_name!r} NOT to be flagged as Nous Hermes 3/4"
|
|
)
|
|
assert _check_hermes_model_warning(model_name) == ""
|
|
|
|
|
|
def test_none_like_inputs_are_safe() -> None:
|
|
assert is_nous_hermes_non_agentic("") is False
|
|
# Defensive: the helper shouldn't crash on None-ish falsy input either.
|
|
assert _check_hermes_model_warning("") == ""
|