mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-15 14:22:43 +00:00
test(caching): pin Kimi/Moonshot OpenRouter cache policy (#25970)
Adapted from PR #26014's test file to the canonical seam (tests/run_agent/test_anthropic_prompt_cache_policy.py _make_agent helper) instead of a new top-level file with sys.path manipulation. Covers: kimi-k2.6 + moonshot-v1 on OpenRouter (envelope layout), kimi via Nous Portal, and the non-OpenRouter negative case.
This commit is contained in:
parent
750c1310a6
commit
fbbb8415c3
1 changed files with 40 additions and 0 deletions
|
|
@ -75,6 +75,46 @@ class TestOpenRouter:
|
|||
assert agent._anthropic_prompt_cache_policy() == (False, False)
|
||||
|
||||
|
||||
class TestKimiMoonshotOnOpenRouter:
|
||||
"""Kimi/Moonshot on OpenRouter honour envelope-layout cache_control (#25970)."""
|
||||
|
||||
def test_kimi_k26_on_openrouter_caches_with_envelope_layout(self):
|
||||
agent = _make_agent(
|
||||
provider="openrouter",
|
||||
base_url="https://openrouter.ai/api/v1",
|
||||
api_mode="chat_completions",
|
||||
model="moonshotai/kimi-k2.6",
|
||||
)
|
||||
assert agent._anthropic_prompt_cache_policy() == (True, False)
|
||||
|
||||
def test_moonshot_v1_on_openrouter_caches_with_envelope_layout(self):
|
||||
agent = _make_agent(
|
||||
provider="openrouter",
|
||||
base_url="https://openrouter.ai/api/v1",
|
||||
api_mode="chat_completions",
|
||||
model="moonshotai/moonshot-v1-8k",
|
||||
)
|
||||
assert agent._anthropic_prompt_cache_policy() == (True, False)
|
||||
|
||||
def test_kimi_on_nous_portal_caches_with_envelope_layout(self):
|
||||
agent = _make_agent(
|
||||
provider="nous",
|
||||
base_url="https://api.nousresearch.com/v1",
|
||||
api_mode="chat_completions",
|
||||
model="moonshotai/kimi-k2.6",
|
||||
)
|
||||
assert agent._anthropic_prompt_cache_policy() == (True, False)
|
||||
|
||||
def test_kimi_on_non_openrouter_host_does_not_cache(self):
|
||||
agent = _make_agent(
|
||||
provider="custom",
|
||||
base_url="https://api.moonshot.cn/v1",
|
||||
api_mode="chat_completions",
|
||||
model="moonshotai/kimi-k2.6",
|
||||
)
|
||||
assert agent._anthropic_prompt_cache_policy() == (False, False)
|
||||
|
||||
|
||||
class TestThirdPartyAnthropicGateway:
|
||||
"""Third-party gateways speaking the Anthropic protocol (MiniMax, Zhipu GLM, LiteLLM)."""
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue