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 -4
View File
@@ -29,7 +29,7 @@ if TYPE_CHECKING:
class TelemetryEmitter:
"""从请求与结果组装 20 字段并写入 recorder;一切写失败降级 warning。"""
"""从请求与结果组装 21 字段并写入 recorder;一切写失败降级 warning。"""
def __init__(self, recorder: TelemetryRecorder, *, pricing: PricingTable | None = None) -> None:
self._recorder = recorder
@@ -65,9 +65,7 @@ class TelemetryEmitter:
cached_prompt_tokens=response.cached_prompt_tokens if response else None,
model_reported=response.model_reported if response else None,
# 唯一有"生效源"的入口,故是唯一能并上 extra_body 的(设计决策 D)
sampling=canonical_sampling_json(
merge_sampling(source.extra_body, request.sampling)
),
sampling=canonical_sampling_json(merge_sampling(source.extra_body, request.sampling)),
)
async def emit_cache_hit(self, *, request: ChatRequest, response: LLMResponse) -> None: