feat: give zhipu, moonshot, anthropic and google a wire of their own
Eight segments now, and each one holds a ThinkingWire instead of two fixed fragments: off, on_base, and the key a tier gets written to. The two fragments could not say "on, at this depth", which is what every current generation model wants. Two deliberate behaviour changes fall out of it. The openai segment stops reporting its shape as unknown — reasoning_effort is OpenAI's own field, not a vendor dialect, so a compatible endpoint behind the gateway takes it. And minimax's on-tier stops carrying a hardcoded medium: that was the library picking a price for the caller, and medium is not even a tier GLM, kimi or deepseek serve. The issue #5 guards stay; their sample moves from "the openai segment" to an explicitly registered unknown one, which is what they always meant to test.
This commit is contained in:
@@ -8,6 +8,7 @@ from loguru import logger
|
||||
|
||||
from polygateway.client import GatewayClient
|
||||
from polygateway.config import EmbeddingSettings, GatewaySettings, OcrSettings
|
||||
from polygateway.providers import ProviderProfile, ThinkingWire, register_provider
|
||||
|
||||
_BASE_ENV = {
|
||||
"LLM__QWEN__1__BASE_URL": "https://gw-a.example/v1",
|
||||
@@ -637,10 +638,23 @@ class TestCrossFieldInvariants:
|
||||
GatewayClient.from_settings(settings)
|
||||
|
||||
def test_unknown_thinking_shape_fails_at_assembly(self):
|
||||
"""provider=openai 是任意兼容厂商的兜底段名,形态未知即报错并指路。"""
|
||||
settings = self._thinking_sources("openai", "kimi-k3", False)
|
||||
# 形态未知即报错并指路。2026-09-04 起默认表 8 段全部有形态(openai 段改发
|
||||
# OpenAI 标准的 reasoning_effort),故样本改为显式注册一个未知段——守卫测的
|
||||
# 是机制,不是某个段当时的配置
|
||||
mystery = ProviderProfile(
|
||||
name="mystery",
|
||||
thinking=ThinkingWire(off=None, on_base=None, effort_key=None),
|
||||
strip_think_tags=False,
|
||||
)
|
||||
settings = self._thinking_sources("mystery", "kimi-k3", False)
|
||||
with pytest.raises(ValueError, match="register_provider"):
|
||||
GatewayClient.from_settings(settings)
|
||||
GatewayClient.from_settings(settings, registry=register_provider(mystery))
|
||||
|
||||
def test_openai_segment_now_assembles_with_the_standard_field(self):
|
||||
# 行为变更(2026-09-04): reasoning_effort 是 OpenAI 官方字段而非厂商方言,
|
||||
# 经网关的兼容端点收得下,故兜底段不再把"关闭"判为形态未知
|
||||
settings = self._thinking_sources("openai", "gpt-5.5", False)
|
||||
assert GatewayClient.from_settings(settings) is not None
|
||||
|
||||
def test_supported_combination_assembles(self):
|
||||
settings = self._thinking_sources("minimax", "MiniMax-M3", False)
|
||||
|
||||
Reference in New Issue
Block a user