fix(llm): support Volcengine Coding model aliases (#411)
* fix(llm): support Volcengine Coding model aliases * refactor(llm): add Volcengine Coding provider * style: format Volcengine Coding test
This commit is contained in:
@@ -202,3 +202,8 @@ def test_lookup_is_case_insensitive():
|
||||
# GLM-5 capitalized variant
|
||||
glm = SimpleNamespace(model_name="Pro/zai-org/GLM-5", profile=None)
|
||||
assert get_context_window(glm) == 203_000
|
||||
|
||||
|
||||
def test_volcengine_glm_5_2_alias_keeps_exact_context_window():
|
||||
model = SimpleNamespace(model_name="glm-5-2", profile=None)
|
||||
assert get_context_window(model) == 1_000_000
|
||||
|
||||
@@ -41,6 +41,7 @@ class TestModelsRegistry:
|
||||
assert "zhipu" in providers
|
||||
assert "zhipu-code" in providers
|
||||
assert "volcengine" in providers
|
||||
assert "volcengine-code" in providers
|
||||
assert "dashscope" in providers
|
||||
assert "dashscope-code" in providers
|
||||
assert "deepseek" in providers
|
||||
@@ -62,6 +63,7 @@ class TestModelsRegistry:
|
||||
"zhipu",
|
||||
"zhipu-code",
|
||||
"volcengine",
|
||||
"volcengine-code",
|
||||
"dashscope",
|
||||
"dashscope-code",
|
||||
"custom-openai",
|
||||
@@ -1128,6 +1130,28 @@ class TestThirdPartyRouting:
|
||||
assert call_kwargs["base_url"] == "https://ark.cn-beijing.volces.com/api/v3"
|
||||
assert call_kwargs["api_key"] == "ve-key-123"
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
("configured_model", "api_model"),
|
||||
[("glm-5.2", "glm-5-2"), ("kimi-k2.5", "kimi-k2-5")],
|
||||
)
|
||||
@patch("EvoScientist.llm.models.init_chat_model")
|
||||
def test_volcengine_code_routes_through_openai(
|
||||
self, mock_init, configured_model, api_model, monkeypatch
|
||||
):
|
||||
"""Volcengine Coding Plan uses its endpoint, IDs, and vendor API key."""
|
||||
mock_init.return_value = "mock_model"
|
||||
monkeypatch.setenv("VOLCENGINE_API_KEY", "ve-code-key-123")
|
||||
|
||||
get_chat_model(configured_model, provider="volcengine-code")
|
||||
|
||||
call_kwargs = mock_init.call_args[1]
|
||||
assert call_kwargs["model_provider"] == "openai"
|
||||
assert call_kwargs["model"] == api_model
|
||||
assert (
|
||||
call_kwargs["base_url"] == "https://ark.cn-beijing.volces.com/api/coding/v3"
|
||||
)
|
||||
assert call_kwargs["api_key"] == "ve-code-key-123"
|
||||
|
||||
@patch("EvoScientist.llm.models.init_chat_model")
|
||||
def test_dashscope_routes_through_openai(self, mock_init, monkeypatch):
|
||||
"""DashScope provider should route through OpenAI with correct base_url."""
|
||||
|
||||
Reference in New Issue
Block a user