69 lines
2.0 KiB
Python
69 lines
2.0 KiB
Python
from scripts.lib.zenmux_client import ZenMuxClient, normalize_zenmux_model
|
|
|
|
|
|
def test_normalize_zenmux_adapter_models() -> None:
|
|
assert normalize_zenmux_model("zenmux/openai/gpt-5.4-mini") == "openai/gpt-5.4-mini"
|
|
assert (
|
|
normalize_zenmux_model("zenmux/google/gemini-3.1-pro-preview")
|
|
== "google/gemini-3.1-pro-preview"
|
|
)
|
|
assert (
|
|
normalize_zenmux_model("zenmux-anthropic/claude-sonnet-4-6")
|
|
== "anthropic/claude-sonnet-4.6"
|
|
)
|
|
assert (
|
|
normalize_zenmux_model("anthropic/claude-opus-4.7")
|
|
== "anthropic/claude-opus-4.7"
|
|
)
|
|
|
|
|
|
class _FakeResponse:
|
|
status_code = 200
|
|
text = '{"choices":[{"message":{"content":"OK"}}]}'
|
|
|
|
def json(self) -> dict:
|
|
return {"choices": [{"message": {"content": "OK"}}], "usage": {}}
|
|
|
|
|
|
class _RecordingClient:
|
|
def __init__(self) -> None:
|
|
self.bodies: list[dict] = []
|
|
|
|
def post(self, _url: str, *, json: dict, headers: dict) -> _FakeResponse:
|
|
self.bodies.append(json)
|
|
return _FakeResponse()
|
|
|
|
|
|
def test_opus_47_probe_omits_deprecated_temperature_param() -> None:
|
|
client = ZenMuxClient(api_key="test")
|
|
recorder = _RecordingClient()
|
|
client._client = recorder # type: ignore[assignment]
|
|
|
|
client.chat_complete(
|
|
model="zenmux-anthropic/claude-opus-4-7",
|
|
system="Health check.",
|
|
user="Reply OK.",
|
|
temperature=0,
|
|
max_tokens=16,
|
|
)
|
|
|
|
assert recorder.bodies[0]["model"] == "anthropic/claude-opus-4.7"
|
|
assert "temperature" not in recorder.bodies[0]
|
|
|
|
|
|
def test_sonnet_keeps_temperature_param() -> None:
|
|
client = ZenMuxClient(api_key="test")
|
|
recorder = _RecordingClient()
|
|
client._client = recorder # type: ignore[assignment]
|
|
|
|
client.chat_complete(
|
|
model="zenmux-anthropic/claude-sonnet-4-6",
|
|
system="Health check.",
|
|
user="Reply OK.",
|
|
temperature=0.2,
|
|
max_tokens=16,
|
|
)
|
|
|
|
assert recorder.bodies[0]["model"] == "anthropic/claude-sonnet-4.6"
|
|
assert recorder.bodies[0]["temperature"] == 0.2
|