test: verify sampling parameters through the full governance stack

This commit is contained in:
2026-07-31 21:46:05 -04:00
parent 2958dc8231
commit cce7562d07
5 changed files with 78 additions and 16 deletions
+2 -6
View File
@@ -59,9 +59,7 @@ def validate_request_overlay(overlay: Mapping[str, Any], *, origin: str) -> dict
return dict(overlay)
def merge_sampling(
extra_body: Mapping[str, Any], sampling: Mapping[str, Any]
) -> dict[str, Any]:
def merge_sampling(extra_body: Mapping[str, Any], sampling: Mapping[str, Any]) -> dict[str, Any]:
"""合并配置级与调用级采样参数;调用级优先(issue #4 设计决策 A)。"""
return {**extra_body, **sampling}
@@ -237,9 +235,7 @@ class SourceConfig:
object.__setattr__(self, "extra_body", MappingProxyType(validated))
def strip_unsupported_extra_body(
sources: list[SourceConfig], *, path: str
) -> list[SourceConfig]:
def strip_unsupported_extra_body(sources: list[SourceConfig], *, path: str) -> list[SourceConfig]:
"""剥离非 chat 路径不消费的 `extra_body` 并 warning(issue #4 决策 G)。
剥离是必需的而非顺手清理: embedding 的 payload 硬编码 `{model, input}`、