arch(cccl): Agent-pattern numerical stability patch + protocol required fix

CCCL design patterns translated:
- optionally_static: detect existing guards, inject only missing
- agent_radix_sort_histogram: Init->Detect->Patch->Verify flow
- overflow_cast: clamp BEFORE accumulation, not after

Changes:
1. patch_numerical_stability.py - reads base image qwen3_5.py,
   detects existing guards, injects clamps to prevent 99.98% NaN
   Preserves corex kernel paths.
2. patch_ops.sh - targeted in-place patches instead of never-touch
3. protocol.py - tool_choice=required now disables thinking
This commit is contained in:
project6
2026-08-07 09:54:55 +00:00
parent 4eea584c9d
commit b47a5d4b95
3 changed files with 345 additions and 31 deletions

View File

@@ -453,7 +453,8 @@ class ChatCompletionRequest(OpenAIBaseModel):
if not thinking_explicitly_set:
has_tools = data.get("tools") is not None and len(data.get("tools", [])) > 0
tc = data.get("tool_choice")
tool_choice_active = (tc == "auto" or (tc is None and has_tools)
tool_choice_active = (tc == "auto" or tc == "required"
or (tc is None and has_tools)
or isinstance(tc, dict))
if has_tools and tool_choice_active:
ctk = data.get("chat_template_kwargs") or {}