feat: preserve governed OpenAI tool messages in 1.4.0

Add faithful single-choice chat results, tool stream activity, error-frame retries, and isolated protocol caching.

Reject empty cached completions with the same value predicate as transport, add regression coverage, and adopt Apache-2.0.
This commit is contained in:
2026-10-01 14:32:19 -04:00
parent 0e29deac1a
commit 9185eab8c9
42 changed files with 2227 additions and 78 deletions
+2 -6
View File
@@ -1397,9 +1397,7 @@ class TestStallConfig:
def test_stall_after_s_single_source_warns(self):
"""单源 scope 设 stall 阈值: 装配期 warning 放行(1.3.7 §5 同款)。"""
with _captured_warnings() as warnings:
s = GatewaySettings.from_env(
"LLM", env=_env(**{"LLM__HEDGE__STALL_AFTER_S": "8"})
)
s = GatewaySettings.from_env("LLM", env=_env(**{"LLM__HEDGE__STALL_AFTER_S": "8"}))
assert s.hedge_stall_after_s == 8.0
assert any("单源" in m for m in warnings)
@@ -1422,9 +1420,7 @@ class TestStallConfig:
"EMBED__BATCH_SIZE": "64",
}
with _captured_warnings() as warnings:
EmbeddingSettings.from_env(
"EMBED", env={**embed_env, "EMBED__HEDGE__AFTER_S": "8"}
)
EmbeddingSettings.from_env("EMBED", env={**embed_env, "EMBED__HEDGE__AFTER_S": "8"})
assert any("仅对 chat scope 生效" in m for m in warnings)
with _captured_warnings() as warnings:
EmbeddingSettings.from_env(